|
Post by doxidad on Nov 8, 2021 8:02:35 GMT -8
I have setup the WS SkyCam and seem to have a problem. I can get a MQTT connection but there is never any data sent from the camera. The camera LED Flash does flash about 1/minute.
Here's the mosquitto log for the connections. You can see the both connections, ans subscribe messages from both SkyWeather2 and SkyCam. Also, everytime the camera flashes there is a ping request from SkyCam and response but the only data received is the the WeatherRack2 and the indoor temp/humidity sensors(3).
08-Nov-2021T10:45:39: New connection from ::1:35327 on port 1883. 08-Nov-2021T10:45:39: New client connected from ::1:35327 as SkyWeather2 (p2, c1, k60). 08-Nov-2021T10:45:39: No will message specified. 08-Nov-2021T10:45:39: Sending CONNACK to SkyWeather2 (0, 0) 08-Nov-2021T10:45:39: New connection from ::1:34753 on port 1883. 08-Nov-2021T10:45:39: New client connected from ::1:34753 as SkyCam (p2, c1, k60). 08-Nov-2021T10:45:39: No will message specified. 08-Nov-2021T10:45:39: Sending CONNACK to SkyCam (0, 0) 08-Nov-2021T10:45:39: Received SUBSCRIBE from SkyCam 08-Nov-2021T10:45:39: SKYCAM/+/PICTURECHUNKS (QoS 0) 08-Nov-2021T10:45:39: SkyCam 0 SKYCAM/+/PICTURECHUNKS 08-Nov-2021T10:45:39: Sending SUBACK to SkyCam 08-Nov-2021T10:45:39: Received SUBSCRIBE from SkyCam 08-Nov-2021T10:45:39: SKYCAM/+/INFO (QoS 0) 08-Nov-2021T10:45:39: SkyCam 0 SKYCAM/+/INFO 08-Nov-2021T10:45:39: Sending SUBACK to SkyCam 08-Nov-2021T10:45:45: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/FT020T', ... (285 bytes)) 08-Nov-2021T10:45:45: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/F016TH/1', ... (212 bytes)) 08-Nov-2021T10:45:50: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/F016TH/3', ... (212 bytes)) 08-Nov-2021T10:46:01: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/FT020T', ... (285 bytes)) 08-Nov-2021T10:46:17: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/FT020T', ... (285 bytes)) 08-Nov-2021T10:46:20: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/F016TH/2', ... (212 bytes)) 08-Nov-2021T10:46:33: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/FT020T', ... (285 bytes)) 08-Nov-2021T10:46:38: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/F016TH/1', ... (212 bytes)) 08-Nov-2021T10:46:40: Received PINGREQ from SkyCam 08-Nov-2021T10:46:40: Sending PINGRESP to SkyCam 08-Nov-2021T10:46:48: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/F016TH/3', ... (212 bytes)) 08-Nov-2021T10:46:49: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/FT020T', ... (284 bytes)) 08-Nov-2021T10:47:05: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/FT020T', ... (283 bytes)) 08-Nov-2021T10:47:17: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/F016TH/2', ... (212 bytes)) 08-Nov-2021T10:47:21: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/FT020T', ... (284 bytes)) 08-Nov-2021T10:47:31: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/F016TH/1', ... (212 bytes)) 08-Nov-2021T10:47:37: Received PUBLISH from SkyWeather2 (d0, q0, r0, m0, 'skyweather2/FT020T', ... (283 bytes)) 08-Nov-2021T10:47:40: Received PINGREQ from SkyCam 08-Nov-2021T10:47:40: Sending PINGRESP to SkyCam 08-Nov-2021T10:47:47: Client SkyWeather2 closed its connection. 08-Nov-2021T10:47:47: Client SkyCam closed its connection.
I also ran the testSkyCamRemote and got the following with the PINGREQ from SkyCam coinciding with the camera flash
pi@WPI2:~/SDL_Pi_SkyWeather2 $ sudo python testSkyCamRemote.py log: Sending CONNECT (u0, p0, wr0, wq0, wf0, c1, k60) client_id=b'' log: Received CONNACK (0, 0) Connected with result code 0 log: Sending SUBSCRIBE (d0, m1) [(b'SKYCAM/+/INFO', 0)] log: Received SUBACK log: Sending PINGREQ log: Received PINGRESP log: Sending PINGREQ log: Received PINGRESP
So, the question is this - What did I miss on the setup? or is something scrogged with the SkyCam?
Also, I noticed that the value USEWSSKYCAM is really not used anywhere - only reporting that it is disabled on startup even though it is configured true in SkyWeather2.JSON (with the configure tool).
Suggestions?
|
|
|
Post by SDL on Nov 8, 2021 13:15:47 GMT -8
Let me run a SkyCam on a test system and get a successful mosquitto log so we can see what a good one looks like. Then we will figure it out. I'm thinking SkyCam may not be seeing the camera. What is in your SkyCamSensors database? replace localhost with your ip address if not running your browser on the pi. "admin" password: "password". Clever, eh? BP
|
|
|
Post by doxidad on Nov 8, 2021 13:33:15 GMT -8
Let me run a SkyCam on a test system and get a successful mosquitto log so we can see what a good one looks like. Then we will figure it out. I'm thinking SkyCam may not be seeing the camera. What is in your SkyCamSensors database? replace localhost with your ip address if not running your browser on the pi. "admin" password: "password". Clever, eh? BP
Nothing in the SkyCamSensor Table. Only table that has any entries is the TB433MHZ table since I have the lightning detector.
|
|
|
Post by SDL on Nov 9, 2021 8:10:51 GMT -8
Did you provision your SkyCam as shown in the manual?
BP
|
|
|
Post by doxidad on Nov 9, 2021 9:14:16 GMT -8
It is connected to the router through SSID/password with the the default MQTT port and the MQTT broker IP (Pi) and the router has given it a IP. The camera subscribes to the broker and it is ACKed, also the camera pings the broker and is ACKed from the Mosquitto logs.
Is there anything else to setup? I know the test program wants the camera ID. Is the camera ID used anywhere else?
Also, how do you force the ESP32 back into AP mode if you need/want to move it to another SSID?
|
|
|
Post by doxidad on Nov 9, 2021 14:51:55 GMT -8
Here's more information.
I have another ESP32 cam with the USB/RS232 programmer and I flashed it with the SkyCamera code. It does the same thing. It connects and asks to publish gets a Ack and about every minute it does a ping and gets an ack in response. Still no data sent or maybe it is and the broker can't see it for some reason. I would think once the connection is made and the request for publish is successful the pipe should be open. It looks like it is some sort of network problem - though I can't imagine what it would be. There are no filters on any local LAN addresses. Looks like I need to pull out wireshark and see if I can see anything.
I thought my days doing this stuff were done when I retired - bummer
|
|
|
Post by doxidad on Nov 10, 2021 7:55:13 GMT -8
FYI This is NOT your SD card distribution for the PI
I set up a terminal on the camera serial port. I have a couple of questions since I don't know what I should be expecting. The output says it has 10 chunks to send. Each chunk looks like it created 3 connections to broker. It seems it tries to send 11 chunks - 3 connections and then says Chunk Failure Then sending MQTT packet with data
All of the connection results are 0 (success)
All of the publish results are 0 (success). So I'm not sure if this is what I should see or not (3 connections for each chunk?, and trying to send 11 chunks?) and then a MQTT message. If so - where's it going that it is not recognized and written in the database?
Any special configuration for mosquitto other than listener 1883 and allow_anonymous true ?
Here's one iteration of a picture after CPU Freq = 240 MHz XTAL Freq = 40 MHz APB Bus Clock Freq = 80000000 Hz In Loop
Battery Voltage: 3.82 V Battery Current: 17.60 mA
Solar Panel Voltage: 2.65 V Solar Panel Current: 0.00 mA
Load Voltage: 5.00 V Load Current: 2.40 mA start of contrast delay CLICK Picture Size=22757 after take picture setupWiFiandMQTT GPIO0=1 RequestedReset=1 Using existing SSID/psk SSID=XXXXX psk=XXXXX Waiting for Saved WiFi .... WiFI Connected. SSID=XXXXXX psk=XXXXXX
IP Address: 192.168.200.222 WiFi Channel= 8 Gateway Address:192.168.200.1 Subnet Mask:255.255.255.0 -------- MQTT Start -------- MQTT_IP=192.168.200.85 MQTT_PORT=0 Attempting MQTT connection...client name=SKYCAMWireless-39e6 connected sub to topic=SKYCAM/C939/COMMANDS ----Writing Preferences--- SSID=XXXXX psk=XXXXXXX Admin Password:ad****** MQTT_IP=192.168.200.85 MQTT_PORT=0 time_to_sleep=50 contrast_delay=1000 Sensor Settings=0;0;0;0;1;1;0;1;0;0;300;1;0;0;0;1;1;1;0;0;1;0; blinkLight=1 frame_size=9 -------------------------- rssi:-44
numberOfFullChunks=10 lastChunkSize=257 Chunk Count=0 start of chunk=0 / end of chunk=2249 fb->len = 22757 ChunkStringLength=3000 Attempting MQTT connection...client name=SKYCAMWireless-77f9 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 1 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-3df4 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 1 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-b924 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 1 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Chunk Count=1 start of chunk=2250 / end of chunk=4499 fb->len = 22757 ChunkStringLength=3000 Attempting MQTT connection...client name=SKYCAMWireless-d658 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 2 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-880a connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 2 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-5980 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 2 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Chunk Count=2 start of chunk=4500 / end of chunk=6749 fb->len = 22757 ChunkStringLength=3000 Attempting MQTT connection...client name=SKYCAMWireless-4990 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 3 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-98cd connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 3 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-491f connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 3 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Chunk Count=3 start of chunk=6750 / end of chunk=8999 fb->len = 22757 ChunkStringLength=3000 Attempting MQTT connection...client name=SKYCAMWireless-1773 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 4 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-2bd connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 4 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-7a64 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 4 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Chunk Count=4 start of chunk=9000 / end of chunk=11249 fb->len = 22757 ChunkStringLength=3000 Attempting MQTT connection...client name=SKYCAMWireless-1b29 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 5 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-1fbe connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 5 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-2813 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 5 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Chunk Count=5 start of chunk=11250 / end of chunk=13499 fb->len = 22757 ChunkStringLength=3000 Attempting MQTT connection...client name=SKYCAMWireless-8089 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 6 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-41ce connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 6 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-9068 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 6 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Chunk Count=6 start of chunk=13500 / end of chunk=15749 fb->len = 22757 ChunkStringLength=3000 Attempting MQTT connection...client name=SKYCAMWireless-6da1 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 7 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-5f84 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 7 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-b5b3 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 7 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Chunk Count=7 start of chunk=15750 / end of chunk=17999 fb->len = 22757 ChunkStringLength=3000 Attempting MQTT connection...client name=SKYCAMWireless-fb0c connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 8 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-6e2d connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 8 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-49b8 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 8 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Chunk Count=8 start of chunk=18000 / end of chunk=20249 fb->len = 22757 ChunkStringLength=3000 Attempting MQTT connection...client name=SKYCAMWireless-5d9d connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 9 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-27f5 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 9 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-7b8f connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 9 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Chunk Count=9 start of chunk=20250 / end of chunk=22499 fb->len = 22757 ChunkStringLength=3000 Attempting MQTT connection...client name=SKYCAMWireless-d77e connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 10 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-d2a9 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 10 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 Attempting MQTT connection...client name=SKYCAMWireless-68ba connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Chunk 10 of 11 Topic=SKYCAM/C939/PICTURECHUNKS MQTT publish result=0 ->>>>Chunk Failure<<<<< Size of image:22757 Shape->width:800height:600 sendMQTTStats Attempting MQTT connection...client name=SKYCAMWireless-612 connected sub to topic=SKYCAM/C939/COMMANDS Sending MQTT Packet {"id": "C939", "messageid": "4223", "messagetype": "4", "softwareversion": "22", "sunairplusdevicepresent": "1", "hdc1080devicepresent": "0", "internaltemperature": "0.00", "internalhumidity": "0.00", "currentrssi": "-44", "batteryvoltage": "3.82", "batterycurrent": "17.60", "loadvoltage": "5.00", "loadcurrent": "2.40", "solarpanelvoltage": "2.65", "solarpanelcurrent": "0.00", "gndrreboots": "0"} Topic=SKYCAM/C939/INFO MQTT publish result=0 ----Writing MessageID Preferences--- MessageID=4224 -------------------------- RequestedReset=1 GPIO0=0 No Sleep - vTask Delay reducing power disable radio after CPU Freq = 10 MHz XTAL Freq = 40 MHz APB Bus Clock Freq = 10000000 Hz
|
|
|
Post by doxidad on Nov 11, 2021 4:32:26 GMT -8
OK - found the problem. It is in the ESP32 code.
Here is the output from the ESP32 when sending information. MQTT Start -------- MQTT_IP=192.168.200.85 MQTT_PORT=0 <-------< Attempting MQTT connection...client name=SKYCAMWireless-39e6 connected
Notice the MQTT Port is 0!
You can send stuff to port 0 all you want and it will be accepted - it's just like /dev/null
The port default when you set the camera through the AP is 1883 - for some reason this doesn't get stored properly?
I set up the Camera again through the AP and manually put in 1883 instead of taking the default and it still wasn't stored.
I added this line MQTT_PORT=1883;
right before
MQTTclient.setServer(MQTT_IP.c_str(), MQTT_PORT);
Recompiled the code and uploaded it to the camera.
It now works correctly and is publishing the data properly to mosquitto
To see if port is now correctly stored, I took the line I added out - recompiled/reloaded and it still works.
MQTT_IP=192.168.200.85 MQTT_PORT=1883 <-------< Attempting MQTT connection...client name=SKYCAMWireless-5a7a connected
So, once the port is stored it works OK. I assume the variable MQTT_PORT is store in a non volatile location? I didn't spend much time looking for the storage mechanism and where this value is stored.
If I had this problem maybe others will too!
|
|
|
Post by SDL on Nov 11, 2021 14:58:35 GMT -8
Hmm. How did 1883 not get stored?
Great debugging. I did NOT know that about port 0. MQTT_PORT is stored in non-volitle location. Look under Preferences in the code.
Should have been flashed in the provisioning.
There isn't a direct way to reset preferences. I tried, but the ESP32 got in the way of proper reading of the GPIO pin switch.
You can unplug your router and then it will go into the AP mode. Disconnecting your antenna will probably do that too.
BP
|
|
|
Post by doxidad on Nov 11, 2021 16:10:40 GMT -8
I'm wondering if it is a browser's problem. I provisioned it with an Samsung android tablet using Chrome. This was the easiest hardware I had to do the connecting to AP..
Since I had another camera/USB RS232 pair I flashed the 2nd esp32 with your code cloned from git and got the same results.
Once I changed the code and reflashed it worked. I put the code back to original and reflashed an it worked so the port number at that point got stored in the nonvolatile area.
|
|
|
Post by SDL on Nov 12, 2021 11:04:59 GMT -8
That could very well be. We tested on Chrome and Safari and Microsoft Edge. But not on an android tablet.
BP
|
|