def _SendHeartbeat(self, target="*", test="", schema="hbeat.app"): """ Send heartbeat message in broadcast on the network, on the bus port (3865) This make the application able to be discovered by the hub This method is not called by childs, so no need to protect it. """ self._lock_status.acquire() self.p.log.debug("send hbeat") mesg = XplMessage() mesg.set_type("xpl-stat") mesg.set_hop_count(1) mesg.set_source(self._source) mesg.set_target(target) mesg.set_schema(schema) mesg.add_single_data("interval", "5") mesg.add_single_data("port", self.port) mesg.add_single_data("remote-ip", self._ip) if schema != "hbeat.end": if self._status == 0: msg = ( "HUB discovery > looking for the hub. I hope there is one hub, Domogik won't work without the hub!" ) self.p.log.info(msg) print(msg) elif self._status == 1: msg = "HUB discovery > hub found, configuration in progress" self.p.log.info(msg) print(msg) elif self._status == 2: pass else: msg = ( "Oops! Wrong status for the hbeat message : %s. Please create a bug report for this!" % self._status ) self.p.log.warning(msg) print(msg) mesg.add_single_data("status", self._status) if self is not None: self.send(mesg) self._lock_status.release()
def _SendHeartbeat(self, target='*', test="", schema="hbeat.app"): """ Send heartbeat message in broadcast on the network, on the bus port (3865) This make the application able to be discovered by the hub This method is not called by childs, so no need to protect it. """ self._lock_status.acquire() self.p.log.debug("send hbeat") mesg = XplMessage() mesg.set_type("xpl-stat") mesg.set_hop_count(1) mesg.set_source(self._source) mesg.set_target(target) mesg.set_schema(schema) mesg.add_single_data("interval", "5") mesg.add_single_data("port", self.port) mesg.add_single_data("remote-ip", self._ip) if schema != 'hbeat.end': if self._status == 0: msg = "HUB discovery > looking for the hub. I hope there is one hub, Domogik won't work without the hub!" self.p.log.info(msg) print(msg) elif self._status == 1: msg = "HUB discovery > hub found, configuration in progress" self.p.log.info(msg) print(msg) elif self._status == 2: pass else: msg = "Oops! Wrong status for the hbeat message : %s. Please create a bug report for this!" % self._status self.p.log.warning(msg) print(msg) mesg.add_single_data("status", self._status) if self is not None: self.send(mesg) self._lock_status.release()