S_COMBO to merge multiple sensors input
-
S_COMBO/V_COMBO new mode in order to merge multiple sensors value in a single message
The basic structure should be like this:When type is S_COMBO/V_COMBO, the payload is made with multiple (uint8 variable-type, uint8 data[]) tuple, up to 24 bytes.
For example, if you have a node that's temperature and humidity capable, it would send a message like this:MyMessage msg(CHILD_ID, V_COMBO); uint8 msgTemplate[] = { V_TEMP, 0, V_HUM, 0 }; [...] msgTemplate[1] = readCurTemp(); msgTemplate[3] = readCurHum(); gw.send(msg.set(msgTemplate));
This would require almost no modification to the current software.
The main advantage is saving power, only a single packet is sent (instead of multiple packets for each sensor, plus ACK).
This limits however each type payload to one byte.
Another improvement would be to reuse the existing parsing code by adding a MyMessage.set/get method like this:inline bool isCombo() const { return type == V_COMBO; } MyMessage & setCombo(uint8_t pos, uint8_t type, uint8_t value) { data[pos*2] = type; data[pos*2+1] = value; return *this; }
On the gateway, an additional case should be taken when serializing to/from Ethernet or Serial so it appears not like a combo.
-
Why not just send multiple packages, one for each sensor type?
-
@tbowmo Each packages would use a single message. Here, the idea is that a single message of 32 bytes does not take more power to send than a message of 12 bytes (what's power hungry is waking up the radio, transmitting a burst). For battery powered device, it makes a difference
-
Interesting idea,
Maybe you could let gateway unpack the COMBO message before handing it over to controller. This way no additional changes is needed on that side.
I would appreciate if you wanted to create a github pull request (on the development branch) with your verified changes.
Suggested Topics
-
Controlling Blinds.com RF Dooya Motors with Arduino and Vera
My Project • 24 Mar 2014, 13:27 • petewill 12 Aug 2023, 16:39 -
ESP32 with builtin Ethernet as Gateway - f.e. WT32-ETH01
Feature Requests • 15 Mar 2023, 15:01 • gryzli133 15 Mar 2023, 21:25 -
"ZHNetwork" a esp-now based mesh network for ESP8266/ESP32 hardware
Feature Requests • 17 Mar 2023, 07:25 • graffiti 17 Mar 2023, 07:25 -
ota-configuration
Feature Requests • 8 Mar 2023, 09:28 • pbw 8 Mar 2023, 09:28 -
is there a solution for a relay with button that also works offline?
Feature Requests • 31 Mar 2023, 16:04 • Branther 4 Apr 2023, 11:37 -
wireless gateway
Feature Requests • 8 Jun 2023, 14:05 • Thomaswortman 8 Jun 2023, 14:05