def update(self, circuit, name, stype): """Call the Ebusd API to update the data.""" import ebusdpy try: _LOGGER.debug("Opening socket to ebusd %s", name) """Check if this is a special case: raw commands to ebusd""" if circuit == DOMAIN: command_result = ebusdpy.raw(self._address, name) """Do not parse anything, even errors. Those could be of interest, e.g. while reading e-bus state to detect devices going offline""" self.value[name] = command_result else: command_result = ebusdpy.read(self._address, circuit, name, stype, self._cache_ttl) if command_result is not None: if "ERR:" in command_result: _LOGGER.warning(command_result) else: self.value[name] = command_result except RuntimeError as err: _LOGGER.error(err) raise RuntimeError(err) except ValueError as err: _LOGGER.error( str(err) + ": circuit " + circuit + " condition " + name)
def read(self, circuit, message_and_field, data_type, time_to_live_s): """Call the ebusdpy API to read a value from the eBUS device.""" with self._lock: if time_to_live_s is None: time_to_live_s = self._time_to_live_s; _LOGGER.debug("ebus read (hub %s, IP %s:%i): read -m %d -c %s %s", self._name, self._ipaddress, self._port, time_to_live_s, circuit, message_and_field) return ebusdpy.read((self._ipaddress, self._port), circuit, message_and_field, data_type, time_to_live_s)
def update(self, name, stype): """Call the Ebusd API to update the data.""" try: _LOGGER.debug("Opening socket to ebusd %s", name) command_result = ebusdpy.read(self._address, self._circuit, name, stype, CACHE_TTL) if command_result is not None: if "ERR:" in command_result: _LOGGER.warning(command_result) else: self.value[name] = command_result except RuntimeError as err: _LOGGER.error(err) raise RuntimeError(err)
def update(self, name, stype): """Call the Ebusd API to update the data.""" import ebusdpy try: _LOGGER.debug("Opening socket to ebusd %s", name) command_result = ebusdpy.read( self._address, self._circuit, name, stype, CACHE_TTL) if command_result is not None: if 'ERR:' in command_result: _LOGGER.warning(command_result) else: self.value[name] = command_result except RuntimeError as err: _LOGGER.error(err) raise RuntimeError(err)