tsathishkumar / MySController-rs

Controller for MySensors, exposes WoT APIs for the sensors. It supports OTA firmware updates, and also acts as proxy for all requests.
GNU Affero General Public License v3.0
20 stars 9 forks source link

Pick up on automatically assigned node ID's #22

Open flatsiedatsie opened 6 years ago

flatsiedatsie commented 6 years ago

In MySensors node ID's are often generated automatically.

As discussed, the MySController-rs software could pick up on these ID's.

Here's a typical ID message: Nov 20 09:06:07 DEBUG TSF:MSG:READ,15-15-0,s=255,c=3,t=11,pt=0,l=21,sg=0:SMS & password relays

Here's another one from a temperature-humidity-barometer node (using the popular Bosch BME280 sensor).

Nov 20 10:31:23 DEBUG TSF:MSG:BC
Nov 20 10:31:23 DEBUG TSF:MSG:FPAR REQ,ID=3
Nov 20 10:31:23 DEBUG TSF:PNG:SEND,TO=0
Nov 20 10:31:23 DEBUG TSF:CKU:OK
Nov 20 10:31:23 DEBUG TSF:MSG:GWL OK
Nov 20 10:31:24 DEBUG TSF:MSG:SEND,0-0-3-3,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
Nov 20 10:31:24 DEBUG TSF:MSG:READ,14-14-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
Nov 20 10:31:24 DEBUG TSF:MSG:PINGED,ID=14,HP=1
Nov 20 10:31:24 DEBUG TSF:MSG:SEND,0-0-14-14,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
Nov 20 10:31:25 DEBUG TSF:MSG:READ,3-3-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
Nov 20 10:31:25 DEBUG TSF:MSG:PINGED,ID=3,HP=1
Nov 20 10:31:25 DEBUG TSF:MSG:SEND,0-0-3-3,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
Nov 20 10:31:25 DEBUG TSF:MSG:READ,3-3-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
Nov 20 10:31:25 DEBUG TSF:MSG:SEND,0-0-3-3,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
Nov 20 10:31:25 DEBUG TSF:MSG:READ,3-3-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.3.0
Nov 20 10:31:25 DEBUG TSF:MSG:READ,3-3-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
Nov 20 10:31:27 DEBUG TSF:MSG:READ,3-3-0,s=255,c=3,t=11,pt=0,l=25,sg=0:Temperature and more sens
Nov 20 10:31:27 DEBUG TSF:MSG:READ,3-3-0,s=255,c=3,t=12,pt=0,l=3,sg=0:1.2
Nov 20 10:31:27 DEBUG TSF:MSG:READ,3-3-0,s=0,c=0,t=6,pt=0,l=0,sg=0:
Nov 20 10:31:27 DEBUG TSF:MSG:READ,3-3-0,s=1,c=0,t=7,pt=0,l=0,sg=0:
Nov 20 10:31:27 DEBUG TSF:MSG:READ,3-3-0,s=2,c=0,t=8,pt=0,l=0,sg=0:
Nov 20 10:31:27 DEBUG TSF:MSG:READ,3-3-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
flatsiedatsie commented 6 years ago

Woohoo! I will test it!

flatsiedatsie commented 6 years ago

It works.

However, the node name does not come through yet. They are all called "new node" in the JSON. I don't know if that matters.


0   
node_id 0
node_name   "New Node"
firmware_type   0
firmware_version    0
desired_firmware_type   0
desired_firmware_version    0
auto_update false
scheduled   false
parent_node_id  0
1   
node_id 1
node_name   "New Node"
firmware_type   0
firmware_version    0
desired_firmware_type   0
desired_firmware_version    0
auto_update false
scheduled   false
parent_node_id  0
2   
node_id 3
node_name   "New Node"
firmware_type   0
firmware_version    0
desired_firmware_type   0
desired_firmware_version    0
auto_update false
scheduled   false
parent_node_id  0
3   
node_id 9
node_name   "New Node"
firmware_type   0
firmware_version    0
desired_firmware_type   0
desired_firmware_version    0
auto_update false
scheduled   false
parent_node_id  0
4   
node_id 14
node_name   "New Node"
firmware_type   0
firmware_version    0
desired_firmware_type   0
desired_firmware_version    0
auto_update false
scheduled   false
parent_node_id  0
5   
node_id 15
node_name   "New Node"
firmware_type   0
firmware_version    0
desired_firmware_type   0
desired_firmware_version    0
auto_update false
scheduled   false
parent_node_id  0
tsathishkumar commented 6 years ago

Since we are creating the node during child sensor's presentation message - I couldn't determine the node name. This can be altered using a put request. For the sensors I like the idea of keeping the description in presentation message as sensor name. I'll work on that. For node name I was depending on the Firmware request message (which we get when the MySensorBootloader is used). Now we need to see if there is another presentation message by the (parent) node and use it.

flatsiedatsie commented 5 years ago

Wouldn't the "sendSketchInfo" call be the logical place to get the name?

sendSketchInfo(F("Gentle alarm clock"), F("1.6"));

Dec 10 15:20:30 DEBUG TSF:MSG:READ,15-15-0,s=255,c=3,t=11,pt=0,l=18,sg=0:Gentle alarm clock Dec 10 15:20:30 DEBUG TSF:MSG:READ,15-15-0,s=255,c=3,t=12,pt=0,l=3,sg=0:1.6

tsathishkumar commented 5 years ago

I'll look into it.