home_emulation/devices/__init__.py

24 line
868 B
Python

import devices.base
import devices.livarno
import devices.shelly
import devices.tradfri
class null(devices.base.base):
"""A dummy device for not yet existing devicetypes
Args:
mqtt_client (mqtt.mqtt_client): A MQTT Client instance
topic (str): the base topic for this device
"""
def __init__(self, mqtt_client, topic, **kwargs):
super().__init__(mqtt_client, topic, **kwargs)
self.mqtt_client.add_callback(self.topic, self.__rx__)
self.mqtt_client.add_callback(self.topic + '/#', self.__rx__)
def __rx__(self, client, userdata, message):
self.logger.warning("Got messaqge for device with missing implementation: topic=%s, payload=%s", message.topic, repr(message.payload))
def set_state(self, value):
self.logger.warning("Got set_state call for device with missing implementation.")