Siot modbus support

Making progress on the modbus RTU support in Simple IoT. A handful of improvements/fixes have gone into the siot base modbus package as well. Also added a on/off switch UI widget:

Supporting both client and server modes is turning out to be quite a bit of work, but the implementation has gone nicely – I enjoy working in this code base, and it still feels like the tree/node/point architecture is the right data model. I have lots of ideas for improving it.

In case anyone is not familiar with modbus, it is still a very popular standard for instrumentation. Many advanced sensors offer modbus interfaces, and it is still the universal/easy way to get digital data out of sensors (it is nice to avoid 4-20mA/analog when possible). With a modbus interface, you can often query dozens of parameters which often gives you advanced diagnostic information, configuration settings, etc. Additionally, the modbus overhead is small, so is easy to implement in sensors without needing a huge communication stack. There is a whole range of modbus IO expansion modules available, from fairly expensive Adam IO modules, to cheaper equivalents from China, and loads of sensors.

Someone is using SIOT modbus code on a MCU with TinyGo and submitted a nice PR:

I’m continuing to improve the modbus implementation to make it more performant, improve error handling, and improve the UI.

v0.0.16 has much improved modbus support. Everything is event driven now as all writes of modbus related data are going over NATS.

[0.0.16] - 2021-02-08

  • UI
    • expand child nodes and add default description when adding a new node
  • modbus improvements
    • send all writes to DB over NATS – this allows system to be more responsive,
      as well as simplifies code
    • lots of cleanup and error handling