mysensors / MySensors

MySensors library and examples
https://www.mysensors.org
1.3k stars 891 forks source link

Add MultiMessage feature to combine and send multiple messages at once #1517

Closed virtual-maker closed 2 years ago

virtual-maker commented 2 years ago

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:

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.

mfalkvidd commented 2 years ago

Feature is merged. Closing.