def get_data(self): data = [] for relay in range(len(self.relais)): topic = 'relay/relay_{}'.format(relay + 1).encode() data.append( Property(topic, self.onoff[self.relais[relay].value()], True)) return data
def get_properties(self): return (Property(b'door/$type', b'door', True), Property(b'door/$properties', b'open', True), Property(b'door/open/$settable', b'false', True), Property(b'door/open/$name', b'door', True), Property(b'door/open/$datatype', b'boolean', True), Property(b'door/open/$format', b'true,false', True))
def get_properties(self): return (Property(b'led/$type', b'led', True), Property(b'led/$properties', b'power', True), Property(b'led/power/$settable', b'true', True), Property(b'led/power/$name', b'LED', True), Property(b'led/power/$datatype', b'string', True), Property(b'led/power/$format', b'on,off', True))
def get_properties(self): relais = len(self.relais) properties_str = 'relay[1-{}]'.format(relais).encode() properties = [ Property(b'relay/$type', b'relay', True), Property(b'relay/$properties', properties_str, True), ] for relay in range(relais): name = 'Relay {}'.format(relay + 1).encode() prop = 'relay/relay_{}'.format(relay + 1).encode() attributes = [ Property(prop + b'/$settable', b'true', True), Property(prop + b'/$name', name, True), Property(prop + b'/$datatype', b'string', True), Property(prop + b'/$format', b'on,off', True) ] properties.extend(attributes) return properties
def get_data(self): return (Property(b'pm25/concentration', self.pm25, True), Property(b'pm10/concentration', self.pm10, True), Property(b'packet_status/valid', self.packet_status, True))
def get_properties(self): return (Property(b'pm25/$type', b'pm25', True), Property(b'pm25/$properties', b'concentration', True), Property(b'pm25/concentration/$settable', b'false', True), Property(b'pm25/concentration/$unit', b'mg/m3', True), Property(b'pm25/concentration/$datatype', b'float', True), Property(b'pm25/concentration/$format', b'20.0:60', True), Property(b'pm10/$type', b'pm10', True), Property(b'pm10/$properties', b'concentration', True), Property(b'pm10/concentration/$settable', b'false', True), Property(b'pm10/concentration/$unit', b'mg/m3', True), Property(b'pm10/concentration/$datatype', b'float', True), Property(b'pm10/concentration/$format', b'20.0:60', True), Property(b'packet_status/$type', b'pm10', True), Property(b'packet_status/$properties', b'valid', True), Property(b'packet_status/valid/$settable', b'false', True), Property(b'packet_status/valid/$unit', b'Boolean', True), Property(b'packet_status/valid/$datatype', b'boolean', True), Property(b'packet_status/valid/$format', b'20.0:60', True))
def get_data(self): return ( Property(b'http/response', self.response.text, True), )
def get_properties(self): return ( Property(b'http/$properties', b'response', True), )
def get_data(self): return (Property(b'temperature/degrees', self.temperature, True), Property(b'humidity/percentage', self.humidity, True))
def get_properties(self): return ( # temperature Property(b'temperature/$type', b'temperature', True), Property(b'temperature/$properties', b'degrees', True), Property(b'temperature/degrees/$settable', b'false', True), Property(b'temperature/degrees/$unit', b'°C', True), Property(b'temperature/degrees/$datatype', b'float', True), Property(b'temperature/degrees/$format', b'20.0:60', True), # humidity Property(b'humidity/$type', b'humidity', True), Property(b'humidity/$properties', b'percentage', True), Property(b'humidity/percentage/$settable', b'false', True), Property(b'humidity/percentage/$unit', b'%', True), Property(b'humidity/percentage/$datatype', b'float', True), Property(b'humidity/percentage/$format', b'0:100', True), )
def get_properties(self): return (Property(b'pir/$type', b'pir', True), Property(b'pir/$properties', b'motion', True), Property(b'pir/motion/$settable', b'false', True), Property(b'pir/motion/$datatype', b'boolean', True), Property(b'pir/motion/$format', b'true,false', True))
def get_properties(self): """no special properties""" return ( Property(self.type + b'/$type', self.type, True), Property(self.type + b'/$properties', self.property, True), )
def get_data(self): """returns the data value""" return [ Property(b'/'.join([self.type, self.property]), self.value, True) ]
def get_data(self): return (Property(b'led/power', ONOFF[self.led.value()], True), )
def get_data(self): return (Property(b'door/open', self.is_open(), True), )
def get_data(self): payload = 'true' if self.last_pir_state == 1 else 'false' return (Property(b'pir/motion', payload, True), )
def get_data(self): return (Property(b'$stats/signal', self.rssi, True), )