def setUp(self): indigo.__init__() self.host_device = IndigoDevice(id=111111, name="Host Device") self.host_shelly = Shelly_1(self.host_device) self.device = IndigoDevice(id=123456, name="New Device") self.shelly = Shelly_Addon_DHT22(self.device) indigo.activePlugin.shellyDevices[ self.host_shelly.device.id] = self.host_shelly indigo.activePlugin.shellyDevices[self.shelly.device.id] = self.shelly logging.getLogger('Plugin.ShellyMQTT').addHandler( logging.NullHandler()) self.host_device.pluginProps['address'] = "shellies/shelly-addon-test" self.device.pluginProps['host-id'] = "111111" self.device.pluginProps['probe-number'] = 0 self.device.pluginProps['temp-units'] = "C->F" self.device.pluginProps['temp-offset'] = "2" self.device.pluginProps['temp-decimals'] = "1" self.device.pluginProps['humidity-offset'] = "5" self.device.pluginProps['humidity-decimals'] = "2" self.device.states['temperature'] = 0 self.device.states['humidity'] = 0
def test_validateConfigUI(self): values = { "broker-id": "12345", "address": "some/address", "message-type": "a-type", "announce-message-type-same-as-message-type": True } isValid, valuesDict, errors = Shelly_1.validateConfigUI( values, None, None) self.assertTrue(isValid)
def setUp(self): indigo.__init__() self.device = IndigoDevice(id=123456, name="New Device") self.shelly = Shelly_1(self.device) logging.getLogger('Plugin.ShellyMQTT').addHandler( logging.NullHandler()) self.device.pluginProps['address'] = "shellies/shelly1-test" self.device.updateStateOnServer("sw-input", False) self.device.updateStateOnServer("longpush", False) self.device.updateStateOnServer("ip-address", None) self.device.updateStateOnServer("mac-address", None) self.device.updateStateOnServer("online", False) self.device.pluginProps['last-input-event-id'] = -1
def test_validateConfigUI_invalid(self): values = { "broker-id": "", "address": "", "message-type": "", "announce-message-type-same-as-message-type": False, "announce-message-type": "" } isValid, valuesDict, errors = Shelly_1.validateConfigUI( values, None, None) self.assertFalse(isValid) self.assertTrue("broker-id" in errors) self.assertTrue("address" in errors) self.assertTrue("message-type" in errors) self.assertTrue("announce-message-type" in errors)
def setUp(self): indigo.__init__() self.host_device = IndigoDevice(id=111111, name="Host Device") self.host_shelly = Shelly_1(self.host_device) self.device = IndigoDevice(id=123456, name="New Device") self.shelly = Shelly_Addon_Detached_Switch(self.device) indigo.activePlugin.shellyDevices[ self.host_shelly.device.id] = self.host_shelly indigo.activePlugin.shellyDevices[self.shelly.device.id] = self.shelly logging.getLogger('Plugin.ShellyMQTT').addHandler( logging.NullHandler()) self.host_device.pluginProps['address'] = "shellies/shelly-addon-test" self.device.pluginProps['host-id'] = "111111" self.device.pluginProps['invert'] = False self.device.states['onOffState'] = False
def setUp(self): indigo.__init__() self.host_device = IndigoDevice(id=111111, name="Host Device") self.host_shelly = Shelly_1(self.host_device) self.device = IndigoDevice(id=123456, name="New Device") self.shelly = Shelly_Addon(self.device) indigo.activePlugin.shellyDevices[ self.host_shelly.device.id] = self.host_shelly indigo.activePlugin.shellyDevices[self.shelly.device.id] = self.shelly logging.getLogger('Plugin.ShellyMQTT').addHandler( logging.NullHandler()) self.host_device.pluginProps['address'] = "shellies/shelly-addon-test" self.host_device.pluginProps['broker-id'] = "12345" self.host_device.states['ip-address'] = "192.168.1.80" self.host_device.pluginProps['message-type'] = "shellies" self.device.pluginProps['host-id'] = "111111"