With commit e6f4b140 / the 1.0.017 release DomotiGa has support for MySensors.
Tested MySensors version¶
The following list of MySensors version have been successfully tested with DomotiGa:
You can enable the MySensors plugin under Interface --> MySensors
- With the InterfaceType you select either the serial or the ethernet gateway
- TCP Host and TCP Port give the name or IP address and port the ethernet gateway can be reached
- Serial Port gives the serial USB port the serial gateway can be found
- You can change the Baud Rate if you do not use the default baudrate of 115k2
- When Relay Enabled is selected data that is received from the gateway can be shared with others that can connect to the port given by the Relay Port field
- If Use Ack is set, outgoing message will have a flag set requesting for an Ack and thereby triggering retransmit in the case a packet is lost
- By enabling Debug you get debug output that includes all shared between the gateway and DomotiGa (the controller in MySensors terms)
- Create a value for the device that maps to the child-sensor-id (so ValueX with X being the child-sensor-id's + 1)
- Put in the Description of the value the sub-type, so V_LIGHT / V_DIMMER etc.
When a SendCommand is addressed to the MySensor plugin it will scan all values of the device/node and that the first value that has in the description V_LIGHT / V_DIMMER etc. That string will be used as sub-type for the MySensors SET message.
When you enable debug, restart and have a node without valid address the debug log will show something like:
16:14:04 [MySensors] < 0;0;3;0;14;Gateway startup complete. 16:14:04 [MySensors] Gateway ready: "Gateway startup complete." 16:14:04 [MySensors] Ask gateway for it's version 16:14:04 [MySensors] > 0;0;3;0;2; 16:14:04 [MySensors] < 0;0;3;0;2;1.5.4 16:14:04 [MySensors] Version of the MySensors gateway is '1.5.4'. 16:14:31 [MySensors] < 0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0: 16:14:31 [MySensors] Gateway log message: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0: 16:14:31 [MySensors] < 255;255;3;0;3; 16:14:31 [MySensors] Providing node id 1 16:14:31 [MySensors] > 255;255;3;0;4;1 16:14:32 [MySensors] < 0;0;3;0;9;send: 0-0-255-255 s=255,c=3,t=4,pt=0,l=1,st=fail:1 16:14:32 [MySensors] Gateway log message: send: 0-0-255-255 s=255,c=3,t=4,pt=0,l=1,st=fail:1 16:15:19 [MySensors] < 0;0;3;0;9;read: 1-1-0 s=0,c=1,t=23,pt=3,l=2:272 16:15:19 [MySensors] Gateway log message: read: 1-1-0 s=0,c=1,t=23,pt=3,l=2:272 16:15:19 [MySensors] < 1;0;1;0;23;272 16:15:19 [MySensors] Set value '272' for node 1 16:15:19 [Devices] Device with type 'MySensors', address '1', instance 1' and interface 'MySensors Interface' not found! 16:15:19 [Devices] Auto created device 'MySensors device #1' with address '1' of type 'MySensors Node' with interface 'MySensors Interface' and instance '1' 16:15:38 [MySensors] < 0;0;3;0;9;read: 1-1-0 s=0,c=1,t=23,pt=3,l=2:265 16:15:38 [MySensors] Gateway log message: read: 1-1-0 s=0,c=1,t=23,pt=3,l=2:265 16:15:38 [MySensors] < 1;0;1;0;23;265 16:15:38 [MySensors] Set value '265' for node 1 16:16:10 [MySensors] < 0;0;3;0;9;read: 1-1-0 s=0,c=1,t=23,pt=3,l=2:257 16:16:10 [MySensors] Gateway log message: read: 1-1-0 s=0,c=1,t=23,pt=3,l=2:257 16:16:10 [MySensors] < 1;0;1;0;23;257 16:16:10 [MySensors] Set value '257' for node 1 16:16:42 [MySensors] < 0;0;3;0;9;read: 1-1-0 s=0,c=1,t=23,pt=3,l=2:252 16:16:42 [MySensors] Gateway log message: read: 1-1-0 s=0,c=1,t=23,pt=3,l=2:252 16:16:42 [MySensors] < 1;0;1;0;23;252
To decode the messages like "< 1;0;1;0;23;272" see http://www.mysensors.org/build/serial_api
- A MySensors Node can have multiple (child-)sensor-id's; for every (child-)sensor-id a separate DomotiGa device is created where the address is set to <node-id>.<sensor-id>.
- The data provided in Presentation messages and the Set/Req sub-type is not yet used
Supported/not (yet) supported¶
- MySensors Serial Protocol (1.4/1.5)
- Set messages (C_SET)
- Request messages (C_REQ) (not tested yet)
- Internal messages (C_INTERNAL)
- Providing nodes an ID (I_ID_REQUEST/I_ID_RESPONSE)
- Nodes reporting their battery level (I_BATTERY_LEVEL)
- Nodes requesting the time (I_TIME)
- Nodes requesting the config (I_CONFIG)
Not (yet) supported¶Hardware
- Presentation messages (C_PRESENTATION) are only logged
- Stream messages (C_STREAM)
Added by mishoboss over 2 years ago
In the docs above it is said: "Different child-sensor-id's are mapped to different DomotiGa devices."
However what happens now is that different child-sensor-id's are mapped to the same device as different Values. And they are mapped strangely. For example, address 10.13 is mapped as Value 14 of the device.
Added by 1024jon over 2 years ago
Not sure if this will be helpful to anyone but I have been working on getting MySensors to work. I was getting a ton of [MySensors] ERROR: Query failed: Unknown column 'interface' in 'where clause' at CMySensors.ProvideNodeID.976 Errors and couldnt get anything to connect. My solution was to edit MySensors.h. Edit the line "#define AUTO 0xFF // 0-254. Id 255 is reserved for auto initialization of nodeId." and change the FF to anything else(ie 0X00). Then edit the gateway constructor "void begin(void (* msgCallback)(const MyMessage &)=NULL, uint8_t nodeId=AUTO, boolean repeaterMode=false, uint8_t parentNodeId=AUTO, rf24_pa_dbm_e paLevel=RF24_PA_LEVEL, uint8_t channel=RF24_CHANNEL, rf24_datarate_e dataRate=RF24_DATARATE);" Edit "uint8_t nodeId=AUTO" and change AUTO to a new value. This allows you to manually set the node id for each Arduino, instead of the node trying to acquire an id automatically. For example "uint8_t nodeId=0XFE". This sets the node id at 254. Domotiga will then automatically detect the new node and add it. At this point the child id that you set in your sketch, will be used by domotiga to set the value for the device. For example CHILD ID 3 will show up under Value 3 on the new device. The new device will have an address of 254.3. The address will be the NodeID.ChildID. Hope this is helpful for someone
Added by ivanxx over 2 years ago
the problem seems to be with Domotiga querying for an invalid column name on the devices table (interface instead of interface_id). I have submitted an issue report with the fix, but you can change line 769 on CMySensors.class to solve it immediately. Now the NodeIDs are correctly assigned, and you don't need to mess with de MySensors.h file on your arduino libraries (a problem in the long run for sure).
Added by rayven almost 2 years ago
So I've rewritten a little of the SendCommand function. I couldn't figure out where the Description field was so I used value99 as the variable and made some other changes to make it more usefull to me. Where is the appropriate place to discuss code, anyone?