mqtt topic restructured and messy logging reduced
Tento commit je obsažen v:
rodič
fff16fd7d3
revize
66f560ee3a
@ -642,7 +642,6 @@ class nodered_gui_heatvalve(base):
|
||||
self.pack(self.KEY_FEEDBACK, data)
|
||||
|
||||
|
||||
|
||||
class nodered_gui_button(base):
|
||||
KEY_STATE = "state"
|
||||
#
|
||||
@ -668,7 +667,7 @@ class nodered_gui_switch(nodered_gui_button):
|
||||
self.pack(self.KEY_STATE, data)
|
||||
|
||||
def set_state_mcb(self, device, key, data):
|
||||
logger.log(logging.INFO if data != self.get(self.KEY_STATE) else logging.DEBUG, "%s: Changing data to %s", self.topic, str(data))
|
||||
logger.debug("%s: Sending %s with content %s", self.topic, key, str(data))
|
||||
self.set_state(data)
|
||||
|
||||
|
||||
@ -707,7 +706,7 @@ class nodered_gui_brightness_color_temp(base):
|
||||
self.pack(self.KEY_ENABLE, data)
|
||||
|
||||
def set_enable_mcb(self, device, key, data):
|
||||
logger.log(logging.INFO if data != self.get(self.KEY_ENABLE) else logging.DEBUG, "%s: Changing enable to %s", self.topic, str(data))
|
||||
logger.debug("%s: Sending %s with content %s", self.topic, key, str(data))
|
||||
self.set_enable(data)
|
||||
|
||||
def set_brightness(self, data):
|
||||
@ -715,7 +714,7 @@ class nodered_gui_brightness_color_temp(base):
|
||||
self.pack(self.KEY_BRIGHTNESS, data)
|
||||
|
||||
def set_brightness_mcb(self, device, key, data):
|
||||
logger.log(logging.INFO if data != self.get(self.KEY_BRIGHTNESS) else logging.DEBUG, "%s: Changing brightness to %s", self.topic, str(data))
|
||||
logger.debug("%s: Sending %s with content %s", self.topic, key, str(data))
|
||||
self.set_brightness(data)
|
||||
|
||||
def set_color_temp(self, data):
|
||||
@ -723,8 +722,7 @@ class nodered_gui_brightness_color_temp(base):
|
||||
self.pack(self.KEY_COLOR_TEMP, data)
|
||||
|
||||
def set_color_temp_mcb(self, device, key, data):
|
||||
logger.log(logging.INFO if data != self.get(self.KEY_COLOR_TEMP) else logging.DEBUG,
|
||||
"%s: Changing color temperature to %s", self.topic, str(data))
|
||||
logger.debug("%s: Sending %s with content %s", self.topic, key, str(data))
|
||||
self.set_color_temp(data)
|
||||
|
||||
|
||||
@ -746,7 +744,7 @@ class nodered_gui_leds(base):
|
||||
|
||||
def set_led(self, key, data):
|
||||
"""data: [True, False]"""
|
||||
logger.log(logging.INFO if data != self.get(key) else logging.DEBUG, "%s: Changing led state for %s to %s", self.topic, key, str(data))
|
||||
logger.debug("%s: Sending %s with content %s", self.topic, key, str(data))
|
||||
self.pack(key, data)
|
||||
|
||||
|
||||
|
@ -15,10 +15,12 @@ except ImportError:
|
||||
ROOT_LOGGER_NAME = 'root'
|
||||
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
||||
|
||||
# TODO: change topics for all zigbee devices to <type|[shellies, zigbee_*, gui, ...]>/<area|gfw, ffw, ffe>/<room>/<target|[main_light, floorlamp, ...]>/<function>
|
||||
# TODO: usage of implementation strategy from gfw_dirk for ffe_sleep
|
||||
# TODO: implement improved devices.nodered_gui_heatvalve incl. setpoint, boost, ... and functions from funtion.module
|
||||
# implement nodered_gui_timer for circulation pump
|
||||
# TODO: implement devices.nodered_gui_timer (for circulation pump)
|
||||
# implement devices.nodered_gui_heatvalve incl. setpoint, boost, ... and functions from funtion.module
|
||||
# improve devices.brennenstuhl_heatvalve
|
||||
# improve the implementation in common if highly reduced, just move it to function.__init__.py
|
||||
#
|
||||
# TODO: implement garland (incl. day events like sunset, sunrise, ...)
|
||||
# TODO: implement warning message
|
||||
|
||||
|
@ -19,7 +19,7 @@ logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
||||
class common_circulation_pump(room_shelly):
|
||||
def __init__(self, mqtt_client):
|
||||
# http://shelly1-E89F6D85A466
|
||||
super().__init__(mqtt_client, "shellies/circulation_pump", "gui/none/common/circulation_pump/switch")
|
||||
super().__init__(mqtt_client, "shellies/ffe/kitchen/circulation_pump", "gui/none/common/circulation_pump/switch")
|
||||
#
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.circ_pump_actions)
|
||||
#
|
||||
@ -53,7 +53,7 @@ class common_circulation_pump(room_shelly):
|
||||
class common_heating(object):
|
||||
def __init__(self, mqtt_client):
|
||||
self.ffe_heating_sleep_madi = heating_function_brennenstuhl(
|
||||
mqtt_client, "zigbee_og_e/radiator/sleep_madi", 20, "gui/ffe_bo_sleep_madi", "gui/ffe_ts_sleep_madi", "gui/ffe_bl_sleep_madi")
|
||||
mqtt_client, "zigbee/ffe/sleep/radiator_valve", 20, "gui/ffe_bo_sleep_madi", "gui/ffe_ts_sleep_madi", "gui/ffe_bl_sleep_madi")
|
||||
|
||||
def all_off(self):
|
||||
pass # dummy method for compatibility reasons
|
||||
|
@ -18,22 +18,22 @@ logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
||||
class first_floor_east_floor(room_shelly):
|
||||
def __init__(self, mqtt_client):
|
||||
# http://shelly1l-3C6105E4E629
|
||||
super().__init__(mqtt_client, "shellies/floor_madi", "gui/ffe/floor/main_light/switch")
|
||||
super().__init__(mqtt_client, "shellies/ffe/floor/main_light", "gui/ffe/floor/main_light/switch")
|
||||
|
||||
|
||||
class first_floor_east_kitchen(room_shelly):
|
||||
def __init__(self, mqtt_client):
|
||||
# http://shelly1l-8CAAB5616C01
|
||||
super().__init__(mqtt_client, "shellies/kitchen", "gui/ffe/kitchen/main_light/switch")
|
||||
super().__init__(mqtt_client, "shellies/ffe/kitchen/main_light", "gui/ffe/kitchen/main_light/switch")
|
||||
|
||||
|
||||
class first_floor_east_dining(room_shelly):
|
||||
def __init__(self, mqtt_client):
|
||||
# http://shelly1l-84CCA8ADD055
|
||||
super().__init__(mqtt_client, "shellies/diningroom", "gui/ffe/diningroom/main_light/switch")
|
||||
self.floorlamp_powerplug = devices.silvercrest_powerplug(mqtt_client, "zigbee_og_e/powerplug/dining_floorlamp")
|
||||
super().__init__(mqtt_client, "shellies/ffe/diningroom/main_light", "gui/ffe/diningroom/main_light/switch")
|
||||
self.floorlamp_powerplug = devices.silvercrest_powerplug(mqtt_client, "zigbee/ffe/dinigroom/powerplug_floorlamp")
|
||||
if config.CHRISTMAS:
|
||||
self.garland_powerplug = devices.silvercrest_powerplug(mqtt_client, topic="zigbee_og_e/powerplug/aux")
|
||||
self.garland_powerplug = devices.silvercrest_powerplug(mqtt_client, topic="zigbee/ffe/dinigroom/garland")
|
||||
#
|
||||
self.gui_switch_floorlamp = devices.nodered_gui_switch(mqtt_client, topic="gui/ffe/diningroom/floorlamp/switch")
|
||||
#
|
||||
@ -53,16 +53,16 @@ class first_floor_east_dining(room_shelly):
|
||||
class first_floor_east_sleep(room_shelly_tradfri_light):
|
||||
def __init__(self, mqtt_client):
|
||||
# http://shelly1l-E8DB84A254C7
|
||||
super().__init__(mqtt_client, "shellies/sleep_madi", "gui/ffe/sleep/main_light/switch",
|
||||
"zigbee_og_e/light/sleep_madi", "gui/ffe/sleep/main_light/br_ct")
|
||||
super().__init__(mqtt_client, "shellies/ffe/sleep/main_light", "gui/ffe/sleep/main_light/switch",
|
||||
"zigbee/ffe/sleep/main_light", "gui/ffe/sleep/main_light/br_ct")
|
||||
#
|
||||
self.bed_light_di_tradfri = devices.tradfri_light(mqtt_client, topic="zigbee_og_e/light/sleep_bed_di")
|
||||
self.bed_light_di_tradfri = devices.tradfri_light(mqtt_client, "zigbee/ffe/sleep/bed_light_di")
|
||||
#
|
||||
self.gui_switch_bed_light_di = devices.nodered_gui_switch(mqtt_client, "gui/ffe/sleep/bed_light_di/switch")
|
||||
self.gui_br_ct_bed_light_di = devices.nodered_gui_brightness_color_temp(mqtt_client, "gui/ffe/sleep/bed_light_di/br_ct")
|
||||
self.gui_led_active_device = devices.nodered_gui_leds(mqtt_client, "gui/ffe/sleep/active_device_state/led")
|
||||
#
|
||||
self.button_tradfri = devices.tradfri_button(mqtt_client, topic="zigbee_og_e/input_device/og_east")
|
||||
self.button_tradfri = devices.tradfri_button(mqtt_client, "zigbee/ffe/sleep/input_device")
|
||||
#
|
||||
# Callback initialisation
|
||||
#
|
||||
@ -129,16 +129,16 @@ class first_floor_east_sleep(room_shelly_tradfri_light):
|
||||
class first_floor_east_living(room_shelly_tradfri_light):
|
||||
def __init__(self, mqtt_client):
|
||||
# http://shelly1l-3C6105E3F910
|
||||
super().__init__(mqtt_client, "shellies/livingroom", "gui/ffe/livingroom/main_light/switch",
|
||||
"zigbee_og_e/light/livingroom", "gui/ffe/livingroom/main_light/br_ct")
|
||||
super().__init__(mqtt_client, "shellies/ffe/livingroom/main_light", "gui/ffe/livingroom/main_light/switch",
|
||||
"zigbee/ffe/livingroom/main_light", "gui/ffe/livingroom/main_light/br_ct")
|
||||
for i in range(1, 7):
|
||||
setattr(self, 'floorlamp_tradfri_%d' % i, devices.tradfri_light(mqtt_client, topic="zigbee_og_e/light/living_floorlamp_%d" % i))
|
||||
setattr(self, 'floorlamp_tradfri_%d' % i, devices.tradfri_light(mqtt_client, "zigbee/ffe/livingroom/floorlamp_%d" % i))
|
||||
#
|
||||
if config.CHRISTMAS:
|
||||
self.powerplug_xmas_tree = devices.silvercrest_powerplug(mqtt_client, "zigbee_og_e/powerplug/xmas-tree")
|
||||
self.powerplug_xmas_star = devices.silvercrest_powerplug(mqtt_client, "zigbee_og_e/powerplug/xmas-star")
|
||||
self.powerplug_xmas_tree = devices.silvercrest_powerplug(mqtt_client, "zigbee/ffe/livingroom/powerplug_xmas-tree")
|
||||
self.powerplug_xmas_star = devices.silvercrest_powerplug(mqtt_client, "zigbee/ffe/livingroom/powerplug_xmas-star")
|
||||
#
|
||||
self.gui_switch_floorlamp = devices.nodered_gui_switch(mqtt_client, topic="gui/ffe/livingroom/floorlamp/switch")
|
||||
self.gui_switch_floorlamp = devices.nodered_gui_switch(mqtt_client, "gui/ffe/livingroom/floorlamp/switch")
|
||||
self.gui_br_ct_floorlamp = devices.nodered_gui_brightness_color_temp(mqtt_client, "gui/ffe/livingroom/floorlamp/br_ct")
|
||||
#
|
||||
if config.CHRISTMAS:
|
||||
|
@ -15,10 +15,11 @@ logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
||||
class first_floor_west_julian(room_shelly_tradfri_light):
|
||||
# http://shelly1l-3C6105E43452
|
||||
def __init__(self, mqtt_client):
|
||||
super().__init__(mqtt_client, "shellies/julian", "gui/ffw/julian/main_light/switch", "zigbee_og_e/light/julian", "gui/ffw/julian/main_light/br_ct")
|
||||
super().__init__(mqtt_client, "shellies/ffw/julian/main_light", "gui/ffw/julian/main_light/switch",
|
||||
"zigbee/ffe/julian/main_light", "gui/ffw/julian/main_light/br_ct")
|
||||
|
||||
|
||||
class first_floor_west_living(room_shelly):
|
||||
# http://shelly1l-84CCA8ACE6A1
|
||||
def __init__(self, mqtt_client):
|
||||
super().__init__(mqtt_client, "shellies/living_mika", "gui/ffw/living/main_light/swicht")
|
||||
super().__init__(mqtt_client, "shellies/ffw/livingroom/main_light", "gui/ffw/livingroom/main_light/switch")
|
||||
|
@ -16,13 +16,14 @@ logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
||||
|
||||
|
||||
class ground_floor_west_floor(room_shelly_silvercrest_light):
|
||||
# https://shelly1l-84CCA8AD1148
|
||||
# http://shelly1l-84CCA8AD1148
|
||||
def __init__(self, mqtt_client):
|
||||
super().__init__(mqtt_client, "shellies/floor_eg_w", "gui/gfw/floor/main_light/switch", "zigbee_eg_w/light/floor_eg_w/a", "gui/gfw/floor/main_light/br_ct")
|
||||
super().__init__(mqtt_client, "shellies/gfw/floor/main_light", "gui/gfw/floor/main_light/switch",
|
||||
"zigbee/gfw/floor/main_light/a", "gui/gfw/floor/main_light/br_ct")
|
||||
#
|
||||
# Callback initialisation
|
||||
#
|
||||
self.main_light_tradfri_2 = devices.tradfri_light(mqtt_client, "zigbee_eg_w/light/floor_eg_w/b")
|
||||
self.main_light_tradfri_2 = devices.tradfri_light(mqtt_client, "zigbee/gfw/floor/main_light/b")
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.main_light_tradfri_2.set_brightness_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.main_light_tradfri_2.set_color_temp_mcb)
|
||||
|
||||
@ -32,9 +33,9 @@ class ground_floor_west_floor(room_shelly_silvercrest_light):
|
||||
|
||||
|
||||
class ground_floor_west_marion(room_shelly):
|
||||
# https://shelly1l-E8DB84A1E067
|
||||
# http://shelly1l-E8DB84A1E067
|
||||
def __init__(self, mqtt_client):
|
||||
super().__init__(mqtt_client, "shellies/marion", "gui/gfw/marion/main_light/switch")
|
||||
super().__init__(mqtt_client, "shellies/gfw/marion/main_light", "gui/gfw/marion/main_light/switch")
|
||||
|
||||
|
||||
class ground_floor_west_dirk(room_shelly_tradfri_light):
|
||||
@ -56,13 +57,13 @@ class ground_floor_west_dirk(room_shelly_tradfri_light):
|
||||
AUDIO_SOURCE_CD = 1
|
||||
AUDIO_SOURCE_RASPI = 2
|
||||
|
||||
# https://shelly1l-3C6105E44F27
|
||||
# http://shelly1l-3C6105E44F27
|
||||
def __init__(self, mqtt_client):
|
||||
super().__init__(mqtt_client, "shellies/dirk", "gui/gfw/dirk/main_light/switch", "zigbee_eg_w/light/dirk", "gui/gfw/dirk/main_light/br_ct")
|
||||
super().__init__(mqtt_client, "shellies/gfw/dirk/main_light", "gui/gfw/dirk/main_light/switch", "zigbee/gfw/dirk/main_light", "gui/gfw/dirk/main_light/br_ct")
|
||||
#
|
||||
self.powerplug_common = devices.my_powerplug(mqtt_client, "powerplug/dirk")
|
||||
self.desk_light_tradfri = devices.tradfri_light(mqtt_client, "zigbee_eg_w/light/dirk_desk")
|
||||
self.button_tradfri = devices.tradfri_button(mqtt_client, "zigbee_eg_w/input_device/dirk")
|
||||
self.powerplug_common = devices.my_powerplug(mqtt_client, "my_apps/gfw/dirk/powerplug")
|
||||
self.desk_light_tradfri = devices.tradfri_light(mqtt_client, "zigbee/gfw/dirk/desk_light")
|
||||
self.button_tradfri = devices.tradfri_button(mqtt_client, "zigbee/gfw/dirk/input_device")
|
||||
#
|
||||
self.gui_switch_desk_light = devices.nodered_gui_switch(mqtt_client, "gui/gfw/dirk/desk_light/switch")
|
||||
self.gui_br_cr_desk_light = devices.nodered_gui_brightness_color_temp(mqtt_client, "gui/gfw/dirk/desk_light/br_ct")
|
||||
@ -71,11 +72,11 @@ class ground_floor_west_dirk(room_shelly_tradfri_light):
|
||||
self.gui_switch_cd_player = devices.nodered_gui_switch(mqtt_client, "gui/gfw/dirk/cd_player/switch")
|
||||
self.gui_switch_pc_dock = devices.nodered_gui_switch(mqtt_client, "gui/gfw/dirk/pc_dock/switch")
|
||||
#
|
||||
self.remote_amplifier = devices.remote(mqtt_client, "hifi/remote/RAS5")
|
||||
self.remote_amplifier = devices.remote(mqtt_client, "my_apps/gfw/dirk/remote/RAS5")
|
||||
self.gui_led_active_device = devices.nodered_gui_leds(mqtt_client, "gui/gfw/dirk/active_device_state/led")
|
||||
#
|
||||
self.spotify_state = devices.audio_status(mqtt_client, "hifi/spotify")
|
||||
self.mpd_state = devices.audio_status(mqtt_client, "hifi/mpd")
|
||||
self.spotify_state = devices.audio_status(mqtt_client, "my_apps/gfw/dirk/hifi/spotify")
|
||||
self.mpd_state = devices.audio_status(mqtt_client, "my_apps/gfw/dirk/hifi/mpd")
|
||||
#
|
||||
self.delayed_task = task.delayed(1.0, self.send_audio_source)
|
||||
#
|
||||
|
@ -59,7 +59,7 @@ class room_shelly(room):
|
||||
class room_shelly_tradfri_light(room_shelly):
|
||||
def __init__(self, mqtt_client, topic_shelly, topic_gui_switch, topic_tradfri_light, topic_gui_br_ct):
|
||||
super().__init__(mqtt_client, topic_shelly, topic_gui_switch)
|
||||
self.main_light_tradfri = devices.tradfri_light(mqtt_client, topic=topic_tradfri_light)
|
||||
self.main_light_tradfri = devices.tradfri_light(mqtt_client, topic_tradfri_light)
|
||||
#
|
||||
self.gui_br_ct_main_light = devices.nodered_gui_brightness_color_temp(mqtt_client, topic_gui_br_ct)
|
||||
#
|
||||
|
Načítá se…
x
Odkázat v novém úkolu
Zablokovat Uživatele