MySensors is a great project for building IoT devices but it tries to do many things — define a general serial communications protocol (similar to ModBus, CAN), provide a software library for many hardware devices on top of the Arduino abstraction layer, firmware updates and many other things. I first tried it in 2018 when building wireless sensor nodes using the RFM69 radios.
The last stable release of the library was in late 2019 and the project appears to have been abandoned by the original maintainers as the pull requests are left unmerged and issues unresolved. Having worked on large open source projects I know that this can happen as the priorities change for the original contributors. It would be great if new contributors could be added to the project to keep it going.
Here are my notes on the state of things as I attempt to use the MySensors protocol for wired (!) nodes over the RS485 physical layer to create switches and sensor nodes for my home automation system:
- Some controllers don’t have support for many of the internal message types which are used for node registration
I_REGISTRATION_REQUEST, finding node parent IDs
I_FIND_PARENT, assigning node IDs
I_ID_REQUEST, etc. This prevents nodes that expect those features from working with gateways that don’t support these features. For example, here are the message types supported by the Node-RED integration or the supported messages types by the pymysensors library that is also used by the Home Assistant integration.
- The version 3 of Arduino core for ESP8266 isn’t compatible with how MySensors tries to inject itself into the
loop()calls, as reported here. There is a pull request to fix this.
RS485 Transport Layer Issues
- The RS485 transport layer doesn’t support using Arduino SoftwareSerial for communicating to the RS485 transceivers. Issue reported here and potentially fixed by my pull request here. This is probably because originally SoftwareSerial wasn’t part of the Arduino core and the project had to pull in optimised versions of similar libraries for Atmel microcontrollers.
- The node ID discovery/assignment is broken over the RS485 transport layer. There is a pull request to fix this.
Alternatives to MySensors
MySensors serial implementation is great because it allows nodes to talk to the network while most of the other protocols require that the communication is initiated by the controller which isn’t very suitable for scenarios such as switching lights and other real-time events.
Here are some alternative protocols for building “multi-master” bus networks using RS485:
- PJON ThroughSerial defines the communication but doesn’t define the message types for standard automation events so you need to define your own layer for this.
- UARTBus which is influenced by KNX but appears to be relatively new.
Do you know of any other protocols that would support this?