mysensors / MySensors

MySensors library and examples

Home Page:https://www.mysensors.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add MultiMessage feature to combine and send multiple messages at once

virtual-maker opened this issue · comments

Currently a MySensors message can hold only one single sensor data.

The MyMultiMessage feature provides a simple way to combine multiple sensor data sets in one message. 24 bytes free space in the MySensors message are more than enough for common use cases like sending temperature, humidity and battery state. The MultiMessage feature uses internal a special sensor type (V_MULTI_MESSAGE). The gateway will recognise this special type and reconstruct the containing messages from this MultiMessage object and send them as single messages to the controller one by one as usual. Same behaviour also happens when sending a MultiMessage from one node to another node (N2N).

Link to forum thread: https://forum.mysensors.org/topic/11893/multiple-sensor-data-in-one-message

Advantages of MultiMessage are:

  • Shorter transmission time compared to sending multiple messages one by one,
  • Shorter uptime of battery operated nodes – longer battery life time,
  • Less traffic and less probability for collisions when multiple nodes sending same time.

FAQ

Q: I personally use the Home Assistant controller. Do I have to make any changes to the controller itself to recognize MultiMessages?

A: Here should be no need for anything in the controller. The gateway will reconstruct different single messages from the MultiMessage and send them one by one to the controller (as if they were passed individually), assuming the registration is done as in the "no multi message" case. But one should be careful about how many messages fit in one block, the MyMultiMessage.set() will return false if the desired message will not fit in the available space and in this case one should do a send() and then "reset()" the MultiMessage to re-using it instead of constructing a new one.

Feature is merged. Closing.