sendHeartbeat() ?

Lemme
Posts: 34
Joined: Sunday 31 January 2016 14:50
Target OS: Raspberry Pi
Domoticz version: Dev
Location: DK
Contact:

Re: sendHeartbeat() ?

Post by Lemme » Tuesday 16 February 2016 18:37

Yeps!

EDIT: (that was ment for sundberg84, before I saw that you answered him...)

sundberg84
Posts: 68
Joined: Sunday 17 May 2015 11:20
Target OS: Raspberry Pi
Domoticz version:
Location: Sweden
Contact:

Re: sendHeartbeat() ?

Post by sundberg84 » Wednesday 17 February 2016 10:00

Great, yea - I have already implemented it in my nodes - all i need is to update Domoticz :) Thanks and great work!
Controller: Domoticz (Raspberry PI)
Gateways: MySensors (Ethernet W5100), RFLink

niceandeasy
Posts: 147
Joined: Thursday 28 January 2016 23:25
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: NL
Contact:

Re: sendHeartbeat() ?

Post by niceandeasy » Tuesday 23 February 2016 19:58

gizmocuz wrote:Thanks for the feedback!!
Next update also supports blinds and RGB/RGBW
Will this apply to the dummy RGB/RGBW sensor, too? I'd love to be able to use the color picker and use the color value in LUA.

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

Re: sendHeartbeat() ?

Post by gizmocuz » Tuesday 23 February 2016 20:39

No this is for mysensors, and the above is already done
Quality outlives Quantity!

niceandeasy
Posts: 147
Joined: Thursday 28 January 2016 23:25
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: NL
Contact:

Re: sendHeartbeat() ?

Post by niceandeasy » Tuesday 23 February 2016 22:20

gizmocuz wrote:No this is for mysensors, and the above is already done
If this refers to the RGB Dummy sensor's colorpicker color-information being usable in LUA, then I could use some help on how to do that.

I have been checking what values are available from a dummy RGB sensor after every new beta release, by querying it by JSON. I couldn't find anything that resembles color info, so I assumed, it's not available in LUA, yet.

All clues are very much appreciated.
Thanks.

EDIT: I'm off-topic, here. I posted my findings here: viewtopic.php?f=6&t=10458. Please take a look. It's still not available.

franzelare
Posts: 148
Joined: Thursday 19 February 2015 22:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: sendHeartbeat() ?

Post by franzelare » Saturday 26 March 2016 14:56

anyone tried to use the hartbeat the other way around?

I see that I loose communication sometimes with LAN or WiFi gateways and have to restart the node to be able to connect again.
so i would like the node to reboot by itself when it doesn't get a ping from domoticz for x minutes

franzelare
Posts: 148
Joined: Thursday 19 February 2015 22:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: sendHeartbeat() ?

Post by franzelare » Saturday 26 March 2016 23:36

gizmocuz wrote:Domoticz already sends heartbeat messages to the controller to check if it is still alive
How can I detect the heartbeat send by domoticz in the mysensor node?
I like to see if the heartbeat is received and otherwise reboot the node

Jan80
Posts: 9
Joined: Monday 18 January 2016 0:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: sendHeartbeat() ?

Post by Jan80 » Tuesday 17 January 2017 1:18

I am using the sendHeartbeat() funtion with an ESP8266 node. The node has only actuators and no sensors. I need the heart beat to prevent Domoticz from resetting the connection due to data timeout. I have set the data timeout to 1 minute. This way Domoticz reconnects quickly when I restart the node. In this scenario Domoticz seems to ignore the heart beat. Is this because it is coming from a gatway node with node id 0? Domoticz version is 3.5837. The node's MySensors version is 2.1.0.

franzelare
Posts: 148
Joined: Thursday 19 February 2015 22:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: sendHeartbeat() ?

Post by franzelare » Tuesday 17 January 2017 10:23

I solved the issue bij adding a childID 100 to every node and use that to ping pong a heartbeat myself
I have a lua time script in domoticz that switches on the heartbeat and added the following to the mysensor node:

to prepare:

Code: Select all

//heartbeat timer
#include <SimpleTimer.h>
SimpleTimer timerheartbeat;
// define heartbeat variables
#define CHILD_ID_HEART 100
int heartbeatcount = 0;
MyMessage msgHeart(CHILD_ID_HEART,V_TRIPPED);
in the setup:

Code: Select all

// Present heartbeat signal  
  present(CHILD_ID_HEART, S_DOOR, "Heart Beat");
// setup measurement timer interval
  timerheartbeat.setInterval(360000, checkReboot);  // 6 minutes in miliseconds
in the loop

Code: Select all

  timerheartbeat.run();
and 2 voids

Code: Select all

void checkReboot() {
    if (heartbeatcount <= 4 ){
    send(msgHeart.set(0));
    ESP.restart();
  }
  else {
    heartbeatcount = 0;
    send(msgHeart.set(0));
  }
}

Code: Select all

void receive(const MyMessage &message) {
//check if the message is heartbeat
  if (message.type==V_LIGHT and message.sensor==CHILD_ID_HEART) {
     // Read message
        send(msgHeart.set(0));
        heartbeatcount = heartbeatcount+1;
     } 
}
only issue with the ESP unit is that the soft reboot is not always working
so I added a hard reset to pin 16 the setup
ESP8266 reboot.jpg
ESP8266 reboot.jpg (45.42 KiB) Viewed 2627 times

Jan80
Posts: 9
Joined: Monday 18 January 2016 0:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: sendHeartbeat() ?

Post by Jan80 » Tuesday 17 January 2017 11:07

Because I am writing a new firmware for a commercial device (Sonoff Touch) adding parts to the circuit is not an option. But at least you confirmed, that MySensors's sendHeartbeat() function does not work with an gateway device. I hope the devs will have a look at that. ;)

In the meantime I will try to use the sendBatteryLevel() function. This wont add additional devices.

franzelare
Posts: 148
Joined: Thursday 19 February 2015 22:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: sendHeartbeat() ?

Post by franzelare » Tuesday 17 January 2017 16:52

if you only want to have domoticz know that the unit is still alive you can also just run a simple timer that is sending an toggle switch every 25 seconds so you know you re-establish the connection when you miss 2 heartbeats

franzelare
Posts: 148
Joined: Thursday 19 February 2015 22:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: sendHeartbeat() ?

Post by franzelare » Wednesday 18 January 2017 12:41

if you are looking into the unit being alive... have a look at the ESP units you are using first!!!

I use ESP201 units from https://hackerstore.nl/ these loose the connection about 4 times a day, some units even worse :$ even with a separate accesspoint only 7 meters away (with 1 glass window and a single brick wall in between) on a quite chanel. adding a old antenna from an accesspoint only made this worse. I have 3 of these units runing but will take them down later this year and replace them with an other solution.

I use ESP12E units (from the same web store), these might loose the connection once a week or so, even with concreet walls with loads of metal wiring inside in between... i have 5 of these at home now (4 curtains and 1 IR remote) and they hardly give me any trouble.

I have ESP12 units from adafruite, here you might be lucky or your not... but don't assume you are using these for the project.
already had to return 2 of them because they died on me or were DOA

manutremo
Posts: 53
Joined: Saturday 19 November 2016 18:02
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: sendHeartbeat() ?

Post by manutremo » Sunday 19 February 2017 18:38

Many thanks for adding this functionality, I'm very interested on this feature. I've tried with both functions sendHeartbeat() and smartSleep() (which sends a heartbeat before putting the node to sleep), and I don't see the last seen timestamp being updated unless some sensor value is also sent previously. I can see the heartbeat being sent correctly in my com output window. I'm running last beta 3.6708. Any idea of why the last seen timestamp doesn't seem like it is being updated?

BluesBro
Posts: 82
Joined: Tuesday 13 August 2013 19:55
Target OS: -
Domoticz version:
Contact:

Re: sendHeartbeat() ?

Post by BluesBro » Wednesday 08 March 2017 9:32

Can this feature be extended to, lets say, ESPeasy? Like a JSON command?

yfands
Posts: 80
Joined: Monday 04 July 2016 10:16
Target OS: Raspberry Pi
Domoticz version: latest B
Location: Netherlands
Contact:

Re: sendHeartbeat() ?

Post by yfands » Friday 15 September 2017 13:17

Version: 3.8394
Build Hash: e9d01f6
Compile Date: 2017-09-13 08:54:08
Platform Raspberry Pi.

Hello,

Hereby I would very much like to address the heartbeat function from mysensors again.

As stated in the following link: https://github.com/domoticz/domoticz/issues/1396 according to gizmocuz its not that easy to implement the heartbeat option, some types are implemented. I checked the latest build files and there is no change in the number of handled types. Hereby I would like to plea for an implementation of the Mysensors V_Value option. In my latest project I used a lightning detector. Who will of course only transmit when there is lightning. In between I like to know if my device is still alive, and don't have to climb every day to the attic to monitor the battery live ;-), so I send a heartbeat with mysensors, unfortunately Domoticz doesn't handle V_Value heartbeats. :-(

Dear Domoticz team, can you please consider my request, I'm sure there are other builders who can appreciate the implementation.

Thanks for listening
Regards
Frank

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest