Page 1 of 2

sendHeartbeat() ?

Posted: Tuesday 05 January 2016 21:47
by sundberg84
Hi!

"sendHeartbeat() - Allows node to send heartbeat and controller to ping nodes." (From 1.6beta)
Does this work in Domoticz or is it something we can implement?

It would be great if this heartbeat updated the timestamp so the node doesnt go red.

I see there is something in the code:

Code: Select all

case I_HEARTBEAT:
			//Received a heartbeat
			while (1 == 0);
			break;
But in not that good so i can do anything about it...

Re: sendHeartbeat() ?

Posted: Wednesday 06 January 2016 5:36
by gizmocuz
Domoticz already sends heartbeat messages to the controller to check if it is still alive

Re: sendHeartbeat() ?

Posted: Wednesday 06 January 2016 11:05
by sundberg84
This is not controller heartbeat.
This is from the nodes sending a heartbeat to let the controller know its alive.
(and controller to Ping nodes)

As I said it would be great if this heartbeat could update "last seen timestamp" or something like that...

Re: sendHeartbeat() ?

Posted: Saturday 09 January 2016 8:19
by gizmocuz
that should be done between the gateway and the node
the last-seen is updated when a new value is send

Re: sendHeartbeat() ?

Posted: Saturday 09 January 2016 10:39
by sundberg84
Hi!

Yes, and this hearbeat is done between the node and gateway, but its not a new value... thats the thing.
Sometimes, some nodes doesnt update the value for along time and then the node goes red in Domoticz.
sendHeartbeat() is a ping to let the controller know its alive even if its not a new value.

Re: sendHeartbeat() ?

Posted: Sunday 10 January 2016 12:01
by sundberg84
I guess the question is: is it possible to update "last seen" without updating the value?

Re: sendHeartbeat() ?

Posted: Monday 18 January 2016 9:00
by malarcy
I'd like to add my request to this (I already have a feature request in tracker for the ability to update a switch even if the new value is the same as the old).

I want to do this to implement a heartbeat for a sensor that changes infrequently but my solution is less elegant that surfacing the sendHeartbeat() all the way to domoticz.

We have other "internal" transport and environment paramaters surfaced in domoticz for various hardware types (battery level and rf stength) - so enabling heartbeat seems to match this type of data,

I vote/+1/ask for sendHeartbeat to be reflected in the last seen status of a sensor - at the moment the implementation is last updated, not last seen -at least for mysensors.

Re: sendHeartbeat() ?

Posted: Saturday 13 February 2016 13:39
by Lemme
Hi
I must back this 100% up - vote/+1. This feature is especially important for security sensors.
In my use case I am going to mount security sensors at the windows. Some of these windows are rarely opend, only mabye 2-4 times per year. But if a thief would enter, I need theese sensors to work.

Having the node send a 'hartbeat' to the controller to update the "last seen" would make me confident that the security system works. Without having to go around the house to activate the sensors manually every few days. Having the possibility for the node to send a 'hartbeat' to Domoticz for example every 24 hours would work.

Hope this clarifies why this feature is important. It is not about the node sending a hartbeat the the gateway, it's about letting Domoticz aware that the node is still present, but have not yet transmittet anything.

Re: sendHeartbeat() ?

Posted: Sunday 14 February 2016 11:19
by gizmocuz
We are talking about a feature that is currently only in the development branch 1.6 (2.0)

I guess this is only for lights/switches (and those kinds of sensors) and not for temperature kind of sensors (as you just update these of course... and at least once an hour (~5 minutes recommended)

There is also a I_HEARTBEAT_RESPONSE message now, but there is not much documentation...

Re: sendHeartbeat() ?

Posted: Sunday 14 February 2016 12:08
by Lemme
Yes - this is currently only for the development branch 1.6. But this important feature will be released in production soon.
And you are quite right about the use. This is primarily for switches and like. Not temp.sensors or others that are intended to transmit regulary.
I do not know about the I_HEARTBEAT_RESPONSE part. Mabye someone else can elaborate a littele bit about that part?

Re: sendHeartbeat() ?

Posted: Sunday 14 February 2016 12:21
by gizmocuz
1.6 is in development for quite some time now, and it just got labelled 2.0
Not sure how fast this will be.

So to test this, i need to make a test sketch and just call the sendHeatbeat function ?
I wonder what I_HEARTBEAT_RESPONSE does, maybe the controller should send an acknowledgement back to the node ?

Re: sendHeartbeat() ?

Posted: Sunday 14 February 2016 13:57
by gizmocuz
Seems we need to work with I_HEARTBEAT_RESPONSE, as the sendHeartBeat sends a I_HEARTBEAT_RESPONSE to the controller

Re: sendHeartbeat() ?

Posted: Sunday 14 February 2016 14:32
by gizmocuz
Please try beta #4578, this should work now for normal lights/switches (not including at the moment RGB/RGBW and blind sensors)

Re: sendHeartbeat() ?

Posted: Sunday 14 February 2016 21:25
by Lemme
Wow - you are a fast mover!
I will make a new setup and try it out.

Re: sendHeartbeat() ?

Posted: Monday 15 February 2016 11:33
by Lemme
Hi again
I did a fresh v2 install of the MySensors library on the GW+Node, and the updated #4582 Domoticz.
And I can confirm that it works perfectely. This is great news!

Many thanks!

Re: sendHeartbeat() ?

Posted: Monday 15 February 2016 19:10
by gizmocuz
Thanks for the feedback!!
Next update also supports blinds and RGB/RGBW

Re: sendHeartbeat() ?

Posted: Monday 15 February 2016 19:37
by Derik
And what are the new options with this feature......

Re: sendHeartbeat() ?

Posted: Monday 15 February 2016 19:40
by gizmocuz
Derik wrote:And what are the new options with this feature......
Basically none.... but...

Imagine you have a security device made with mysensors (like a smoke detector)
you can use the heartbeat function in your sketch to send each 10 seconds a heartbeat
this will update the last seen date/time in domoticz, so you know that this smoke detector is still online and working !

it will not send a "Off" or "On" so your scripts wont be triggered, it only updates the last seen date/time

Re: sendHeartbeat() ?

Posted: Tuesday 16 February 2016 10:38
by sundberg84
Great news - all i have to do is to call sendHeartBeat() from the node and this will update the node?

Re: sendHeartbeat() ?

Posted: Tuesday 16 February 2016 17:36
by gizmocuz
sundberg84 wrote:Great news - all i have to do is to call sendHeartBeat() from the node and this will update the node?
it should update the last update status in domoticz
and you have to run the latest mysensors development branch code in the node and gateway