MySensors battery updates

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.
Post Reply
SweetPants
Posts: 1751
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8823
Location: The Netherlands
Contact:

MySensors battery updates

Post by SweetPants » Sunday 30 July 2017 9:34

Hi, My MySensors Door/Window sensors (http://www.domoticz.com/forum/viewtopic ... 42&t=18484) send battery status once a day, but this is not reflected in Domoticz. I see the message arrive at the MySensors gateway,

Jul 30 08:50:28 RPiGW mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=0,pt=1,l=1,sg=0:99

But it 'only get's updated in Domoticz when a door/window is opened and closed. Especially for window sensors this can become problematic. Because I use LiPo cells, i want to know the battery status before they are discharged to low.

Is it possible to implement this?

regards, Harry
Ubuntu 16.04.3 LTS on Intel NUC, MySensors 2.2.0, Pro Mini 3.3 8M with RFM69, ESP8266 (SDK2.1.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed

SweetPants
Posts: 1751
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8823
Location: The Netherlands
Contact:

Re: MySensors battery updates

Post by SweetPants » Sunday 30 July 2017 11:31

Hmm, thought as a workaround to send the door/window state also to force a battery update

Jul 30 11:23:15 RPiGW mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=0,pt=1,l=1,sg=0:99
Jul 30 11:23:15 RPiGW mysgw: TSF:MSG:READ,1-1-0,s=0,c=1,t=16,pt=2,l=2,sg=0:0

But if the door/window switch value is the same as the previous, it won't update the door/window switch status and battery status either.
Ubuntu 16.04.3 LTS on Intel NUC, MySensors 2.2.0, Pro Mini 3.3 8M with RFM69, ESP8266 (SDK2.1.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed

User avatar
gizmocuz
Posts: 8527
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors battery updates

Post by gizmocuz » Sunday 30 July 2017 12:08

How do you send a single battery level update via mysensors ?
Quality outlives Quantity!

SweetPants
Posts: 1751
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8823
Location: The Netherlands
Contact:

Re: MySensors battery updates

Post by SweetPants » Sunday 30 July 2017 13:28

gizmocuz wrote:How do you send a single battery level update via mysensors ?
2.2.0-beta (because run on RPI + RFM69)

float p = vcc.Read_Perc(VccMin, VccMax);
sendBatteryLevel((uint8_t)p);
Ubuntu 16.04.3 LTS on Intel NUC, MySensors 2.2.0, Pro Mini 3.3 8M with RFM69, ESP8266 (SDK2.1.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed

User avatar
gizmocuz
Posts: 8527
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors battery updates

Post by gizmocuz » Sunday 30 July 2017 13:34

Looking in the code, we update the nodes battery level, and it will be updated when we receive a new sensor value.
For switches it is indeed when there is a change switch (but forced for V_TRIPPED and V_SCENE (on/off)

MySensorsBase::UpdateSwitch

Here it is where it's checked.. maybe this peace of code should be removed for mysensors ?
But be carefull when you have a script on an 'On' command.. because this WILL be triggered...

Maybe you can test with it ? Also interested to know opinions from other users
Quality outlives Quantity!

SweetPants
Posts: 1751
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8823
Location: The Netherlands
Contact:

Re: MySensors battery updates

Post by SweetPants » Sunday 30 July 2017 16:26

gizmocuz wrote:Maybe you can test with it ? Also interested to know opinions from other users
I will give it a try in my test setup, but I'm not that experienced with C++
Have to wait a while for some new hardware to make a test node, all others are in production
Ubuntu 16.04.3 LTS on Intel NUC, MySensors 2.2.0, Pro Mini 3.3 8M with RFM69, ESP8266 (SDK2.1.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed

SweetPants
Posts: 1751
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8823
Location: The Netherlands
Contact:

Re: MySensors battery updates

Post by SweetPants » Tuesday 01 August 2017 10:38

Should MySensorsBase::UpdateNodeBatteryLevel not be used for battery updates? If I send single battery updates using sendBatteryLevel((uint8_t)p); i can see them come in here? There is a peace of code there that is commented out ( //Uncomment the below to for a sensor update ). but if I comment it out nothing happens.
Ubuntu 16.04.3 LTS on Intel NUC, MySensors 2.2.0, Pro Mini 3.3 8M with RFM69, ESP8266 (SDK2.1.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed

SweetPants
Posts: 1751
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8823
Location: The Netherlands
Contact:

Re: MySensors battery updates

Post by SweetPants » Tuesday 01 August 2017 20:25

gizmocuz wrote:For switches it is indeed when there is a change switch (but forced for V_TRIPPED and V_SCENE (on/off)
MySensor uses V_TRIPPED MyMessage msgContact(CONTACT_CHILD_ID, V_TRIPPED); , but there is no forced update.
Ubuntu 16.04.3 LTS on Intel NUC, MySensors 2.2.0, Pro Mini 3.3 8M with RFM69, ESP8266 (SDK2.1.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests