topic and parameters moved to config
This commit is contained in:
parent
7223a32c4b
commit
4f289c98c1
@ -17,24 +17,25 @@ logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
|||||||
class first_floor_east_floor(room_shelly_motion_sensor):
|
class first_floor_east_floor(room_shelly_motion_sensor):
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
# http://shelly1l-3C6105E4E629
|
# http://shelly1l-3C6105E4E629
|
||||||
super().__init__(mqtt_client, "shellies/ffe/floor/main_light", "gui/ffe/floor/main_light/switch", "zigbee/ffe/floor/motion_sensor")
|
super().__init__(mqtt_client, config.TOPIC_FFE_FLOOR_MAIN_LIGHT_SHELLY,
|
||||||
|
config.TOPIC_FFE_FLOOR_MAIN_LIGHT_GUI_SWITCH, config.TOPIC_FFE_FLOOR_MAIN_LIGHT_MOTION_SENSOR)
|
||||||
|
|
||||||
|
|
||||||
class first_floor_east_kitchen(room_shelly):
|
class first_floor_east_kitchen(room_shelly):
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
# http://shelly1l-8CAAB5616C01
|
# http://shelly1l-8CAAB5616C01
|
||||||
super().__init__(mqtt_client, "shellies/ffe/kitchen/main_light", "gui/ffe/kitchen/main_light/switch")
|
super().__init__(mqtt_client, config.TOPIC_FFE_KITCHEN_MAIN_LIGHT_SHELLY, config.TOPIC_FFE_KITCHEN_MAIN_LIGHT_GUI_SWITCH)
|
||||||
|
|
||||||
|
|
||||||
class first_floor_east_dining(room_shelly):
|
class first_floor_east_dining(room_shelly):
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
# http://shelly1l-84CCA8ADD055
|
# http://shelly1l-84CCA8ADD055
|
||||||
super().__init__(mqtt_client, "shellies/ffe/diningroom/main_light", "gui/ffe/diningroom/main_light/switch")
|
super().__init__(mqtt_client, config.TOPIC_FFE_DININGROOM_MAIN_LIGHT_SHELLY, config.TOPIC_FFE_DININGROOM_MAIN_LIGHT_GUI_SWITCH)
|
||||||
self.floorlamp_powerplug = devices.silvercrest_powerplug(mqtt_client, "zigbee/ffe/dinigroom/powerplug_floorlamp")
|
self.floorlamp_powerplug = devices.silvercrest_powerplug(mqtt_client, config.TOPIC_FFE_DININGROOM_FLOOR_LAMP_POWERPLUG)
|
||||||
if config.CHRISTMAS:
|
if config.CHRISTMAS:
|
||||||
self.garland_powerplug = devices.silvercrest_powerplug(mqtt_client, topic="zigbee/ffe/dinigroom/garland")
|
self.garland_powerplug = devices.silvercrest_powerplug(mqtt_client, config.TOPIC_FFE_DININGROOM_GARLAND_POWERPLUG)
|
||||||
#
|
#
|
||||||
self.gui_switch_floorlamp = devices.nodered_gui_switch(mqtt_client, topic="gui/ffe/diningroom/floorlamp/switch")
|
self.gui_switch_floorlamp = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_DININGROOM_FLOOR_LAMP_GUI_SWITCH)
|
||||||
#
|
#
|
||||||
# Callback initialisation
|
# Callback initialisation
|
||||||
#
|
#
|
||||||
@ -52,17 +53,17 @@ class first_floor_east_dining(room_shelly):
|
|||||||
class first_floor_east_sleep(room_shelly_tradfri_light):
|
class first_floor_east_sleep(room_shelly_tradfri_light):
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
# http://shelly1l-E8DB84A254C7
|
# http://shelly1l-E8DB84A254C7
|
||||||
super().__init__(mqtt_client, "shellies/ffe/sleep/main_light", "gui/ffe/sleep/main_light/switch",
|
super().__init__(mqtt_client, config.TOPIC_FFE_SLEEP_MAIN_LIGHT_SHELLY, config.TOPIC_FFE_SLEEP_MAIN_LIGHT_GUI_SWITCH,
|
||||||
"zigbee/ffe/sleep/main_light", "gui/ffe/sleep/main_light/br_ct")
|
config.TOPIC_FFE_SLEEP_MAIN_LIGHT_ZIGBEE, config.TOPIC_FFE_SLEEP_MAIN_LIGHT_GUI_BR_CT)
|
||||||
#
|
#
|
||||||
self.bed_light_di_tradfri = devices.tradfri_light(mqtt_client, "zigbee/ffe/sleep/bed_light_di")
|
self.bed_light_di_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_DI_ZIGBEE)
|
||||||
#
|
#
|
||||||
self.gui_switch_bed_light_di = devices.nodered_gui_switch(mqtt_client, "gui/ffe/sleep/bed_light_di/switch")
|
self.gui_switch_bed_light_di = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_DI_GUI_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_br_ct_bed_light_di = devices.nodered_gui_brightness_color_temp(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_DI_GUI_BR_CT)
|
||||||
#
|
#
|
||||||
self.button_tradfri = devices.tradfri_button(mqtt_client, "zigbee/ffe/sleep/input_device")
|
self.button_tradfri = devices.tradfri_button(mqtt_client, config.TOPIC_FFE_SLEEP_INPUT_DEVICE)
|
||||||
#
|
#
|
||||||
self.brightness_functions = brightness_choose_n_action(mqtt_client, self.button_tradfri, "gui/ffe/sleep/active_device_state/led")
|
self.brightness_functions = brightness_choose_n_action(mqtt_client, self.button_tradfri, config.TOPIC_FFE_SLEEP_DEVICE_CHOOSER_LED)
|
||||||
self.brightness_functions.add(self.main_light_tradfri, self.main_light_shelly.add_on_off_callback_0)
|
self.brightness_functions.add(self.main_light_tradfri, self.main_light_shelly.add_on_off_callback_0)
|
||||||
self.brightness_functions.add(self.bed_light_di_tradfri, self.bed_light_di_tradfri.add_on_off_callback_0)
|
self.brightness_functions.add(self.bed_light_di_tradfri, self.bed_light_di_tradfri.add_on_off_callback_0)
|
||||||
#
|
#
|
||||||
@ -93,20 +94,20 @@ class first_floor_east_sleep(room_shelly_tradfri_light):
|
|||||||
class first_floor_east_living(room_shelly_tradfri_light):
|
class first_floor_east_living(room_shelly_tradfri_light):
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
# http://shelly1l-3C6105E3F910
|
# http://shelly1l-3C6105E3F910
|
||||||
super().__init__(mqtt_client, "shellies/ffe/livingroom/main_light", "gui/ffe/livingroom/main_light/switch",
|
super().__init__(mqtt_client, config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_SHELLY, config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_GUI_SWITCH,
|
||||||
"zigbee/ffe/livingroom/main_light", "gui/ffe/livingroom/main_light/br_ct")
|
config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_ZIGBEE, config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_GUI_BR_CT)
|
||||||
for i in range(1, 7):
|
for i in range(1, 7):
|
||||||
setattr(self, 'floorlamp_tradfri_%d' % i, devices.tradfri_light(mqtt_client, "zigbee/ffe/livingroom/floorlamp_%d" % i))
|
setattr(self, 'floorlamp_tradfri_%d' % i, devices.tradfri_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_FLOOR_LAMP_ZIGBEE % i))
|
||||||
#
|
#
|
||||||
if config.CHRISTMAS:
|
if config.CHRISTMAS:
|
||||||
self.powerplug_xmas_tree = devices.silvercrest_powerplug(mqtt_client, "zigbee/ffe/livingroom/powerplug_xmas-tree")
|
self.powerplug_xmas_tree = devices.silvercrest_powerplug(mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_TREE_POWERPLUG)
|
||||||
self.powerplug_xmas_star = devices.silvercrest_powerplug(mqtt_client, "zigbee/ffe/livingroom/powerplug_xmas-star")
|
self.powerplug_xmas_star = devices.silvercrest_powerplug(mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_STAR_POWERPLUG)
|
||||||
#
|
#
|
||||||
self.gui_switch_floorlamp = devices.nodered_gui_switch(mqtt_client, "gui/ffe/livingroom/floorlamp/switch")
|
self.gui_switch_floorlamp = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_LIVINGROOM_FLOOR_LAMP_GUI_SWITCH)
|
||||||
self.gui_br_ct_floorlamp = devices.nodered_gui_brightness_color_temp(mqtt_client, "gui/ffe/livingroom/floorlamp/br_ct")
|
self.gui_br_ct_floorlamp = devices.nodered_gui_brightness_color_temp(mqtt_client, config.TOPIC_FFE_LIVINGROOM_FLOOR_LAMP_GUI_BR_CT)
|
||||||
#
|
#
|
||||||
if config.CHRISTMAS:
|
if config.CHRISTMAS:
|
||||||
self.gui_switch_xmas_tree = devices.nodered_gui_switch(mqtt_client, "gui/ffe/livingroom/xmas_tree/switch")
|
self.gui_switch_xmas_tree = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_TREE_GUI_SWITCH)
|
||||||
#
|
#
|
||||||
# Callback initialisation
|
# Callback initialisation
|
||||||
#
|
#
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import config
|
||||||
import logging
|
import logging
|
||||||
from function.rooms import room_shelly, room_shelly_tradfri_light
|
from function.rooms import room_shelly, room_shelly_tradfri_light
|
||||||
|
|
||||||
@ -15,11 +16,11 @@ logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
|||||||
class first_floor_west_julian(room_shelly_tradfri_light):
|
class first_floor_west_julian(room_shelly_tradfri_light):
|
||||||
# http://shelly1l-3C6105E43452
|
# http://shelly1l-3C6105E43452
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
super().__init__(mqtt_client, "shellies/ffw/julian/main_light", "gui/ffw/julian/main_light/switch",
|
super().__init__(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_SHELLY, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_GUI_SWITCH,
|
||||||
"zigbee/ffe/julian/main_light", "gui/ffw/julian/main_light/br_ct")
|
config.TOPIC_FFW_JULIAN_MAIN_LIGHT_ZIGBEE, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_GUI_BR_CT)
|
||||||
|
|
||||||
|
|
||||||
class first_floor_west_living(room_shelly):
|
class first_floor_west_living(room_shelly):
|
||||||
# http://shelly1l-84CCA8ACE6A1
|
# http://shelly1l-84CCA8ACE6A1
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
super().__init__(mqtt_client, "shellies/ffw/livingroom/main_light", "gui/ffw/livingroom/main_light/switch")
|
super().__init__(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_SHELLY, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_GUI_SWITCH)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import config
|
||||||
import devices
|
import devices
|
||||||
from function.modules import brightness_choose_n_action
|
from function.modules import brightness_choose_n_action
|
||||||
import logging
|
import logging
|
||||||
@ -18,12 +19,12 @@ logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
|||||||
class ground_floor_west_floor(room_shelly_silvercrest_light):
|
class ground_floor_west_floor(room_shelly_silvercrest_light):
|
||||||
# http://shelly1l-84CCA8AD1148
|
# http://shelly1l-84CCA8AD1148
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
super().__init__(mqtt_client, "shellies/gfw/floor/main_light", "gui/gfw/floor/main_light/switch",
|
super().__init__(mqtt_client, config.TOPIC_GFW_FLOOR_MAIN_LIGHT_SHELLY, config.TOPIC_GFW_FLOOR_MAIN_LIGHT_GUI_SWITCH,
|
||||||
"zigbee/gfw/floor/main_light/a", "gui/gfw/floor/main_light/br_ct")
|
config.TOPIC_GFW_FLOOR_MAIN_LIGHT_A_ZIGBEE, config.TOPIC_GFW_FLOOR_MAIN_LIGHT_GUI_BR_CT)
|
||||||
#
|
#
|
||||||
# Callback initialisation
|
# Callback initialisation
|
||||||
#
|
#
|
||||||
self.main_light_tradfri_2 = devices.tradfri_light(mqtt_client, "zigbee/gfw/floor/main_light/b")
|
self.main_light_tradfri_2 = devices.tradfri_light(mqtt_client, config.TOPIC_GFW_FLOOR_MAIN_LIGHT_B_ZIGBEE)
|
||||||
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_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)
|
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.main_light_tradfri_2.set_color_temp_mcb)
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ class ground_floor_west_floor(room_shelly_silvercrest_light):
|
|||||||
class ground_floor_west_marion(room_shelly):
|
class ground_floor_west_marion(room_shelly):
|
||||||
# http://shelly1l-E8DB84A1E067
|
# http://shelly1l-E8DB84A1E067
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
super().__init__(mqtt_client, "shellies/gfw/marion/main_light", "gui/gfw/marion/main_light/switch")
|
super().__init__(mqtt_client, config.TOPIC_GFW_MARION_MAIN_LIGHT_SHELLY, config.TOPIC_GFW_MARION_MAIN_LIGHT_GUI_SWITCH)
|
||||||
|
|
||||||
|
|
||||||
class ground_floor_west_dirk(room_shelly_tradfri_light):
|
class ground_floor_west_dirk(room_shelly_tradfri_light):
|
||||||
@ -59,28 +60,29 @@ class ground_floor_west_dirk(room_shelly_tradfri_light):
|
|||||||
|
|
||||||
# http://shelly1l-3C6105E44F27
|
# http://shelly1l-3C6105E44F27
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
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")
|
super().__init__(mqtt_client, config.TOPIC_GFW_DIRK_MAIN_LIGHT_SHELLY, config.TOPIC_GFW_DIRK_MAIN_LIGHT_GUI_SWITCH,
|
||||||
|
config.TOPIC_GFW_DIRK_MAIN_LIGHT_ZIGBEE, config.TOPIC_GFW_DIRK_MAIN_LIGHT_GUI_BR_CT)
|
||||||
#
|
#
|
||||||
self.powerplug_common = devices.my_powerplug(mqtt_client, "my_apps/gfw/dirk/powerplug")
|
self.powerplug_common = devices.my_powerplug(mqtt_client, config.TOPIC_GFW_DIRK_POWERPLUG)
|
||||||
self.desk_light_tradfri = devices.tradfri_light(mqtt_client, "zigbee/gfw/dirk/desk_light")
|
self.desk_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_GFW_DIRK_DESK_LIGHT_ZIGBEE)
|
||||||
self.button_tradfri = devices.tradfri_button(mqtt_client, "zigbee/gfw/dirk/input_device")
|
self.button_tradfri = devices.tradfri_button(mqtt_client, config.TOPIC_GFW_DIRK_INPUT_DEVICE)
|
||||||
#
|
#
|
||||||
self.gui_switch_desk_light = devices.nodered_gui_switch(mqtt_client, "gui/gfw/dirk/desk_light/switch")
|
self.gui_switch_desk_light = devices.nodered_gui_switch(mqtt_client, config.TOPIC_GFW_DIRK_DESK_LIGHT_GUI_SWITCH)
|
||||||
self.gui_br_cr_desk_light = devices.nodered_gui_brightness_color_temp(mqtt_client, "gui/gfw/dirk/desk_light/br_ct")
|
self.gui_br_cr_desk_light = devices.nodered_gui_brightness_color_temp(mqtt_client, config.TOPIC_GFW_DIRK_DESK_LIGHT_GUI_BR_CT)
|
||||||
#
|
#
|
||||||
self.gui_switch_amplifier = devices.nodered_gui_switch(mqtt_client, "gui/gfw/dirk/amplifier/switch")
|
self.gui_switch_amplifier = devices.nodered_gui_switch(mqtt_client, config.TOPIC_GFW_DIRK_AMPLIFIER_GUI_SWITCH)
|
||||||
self.gui_switch_cd_player = devices.nodered_gui_switch(mqtt_client, "gui/gfw/dirk/cd_player/switch")
|
self.gui_switch_cd_player = devices.nodered_gui_switch(mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_GUI_SWITCH)
|
||||||
self.gui_switch_pc_dock = devices.nodered_gui_switch(mqtt_client, "gui/gfw/dirk/pc_dock/switch")
|
self.gui_switch_pc_dock = devices.nodered_gui_switch(mqtt_client, config.TOPIC_GFW_DIRK_PC_DOCK_GUI_SWITCH)
|
||||||
#
|
#
|
||||||
self.remote_amplifier = devices.remote(mqtt_client, "my_apps/gfw/dirk/remote/RAS5")
|
self.remote_amplifier = devices.remote(mqtt_client, config.TOPIC_GFW_DIRK_AMPLIFIER_REMOTE)
|
||||||
#
|
#
|
||||||
self.brightness_functions = brightness_choose_n_action(mqtt_client, self.button_tradfri, "gui/gfw/dirk/active_device_state/led")
|
self.brightness_functions = brightness_choose_n_action(mqtt_client, self.button_tradfri, config.TOPIC_GFW_DIRK_DEVICE_CHOOSER_LED)
|
||||||
self.brightness_functions.add(self.main_light_tradfri, self.main_light_shelly.add_on_off_callback_0)
|
self.brightness_functions.add(self.main_light_tradfri, self.main_light_shelly.add_on_off_callback_0)
|
||||||
self.brightness_functions.add(self.desk_light_tradfri, self.powerplug_common.add_on_off_callback_1)
|
self.brightness_functions.add(self.desk_light_tradfri, self.powerplug_common.add_on_off_callback_1)
|
||||||
self.brightness_functions.add(self.remote_amplifier, self.powerplug_common.add_on_off_callback_0)
|
self.brightness_functions.add(self.remote_amplifier, self.powerplug_common.add_on_off_callback_0)
|
||||||
#
|
#
|
||||||
self.spotify_state = devices.audio_status(mqtt_client, "my_apps/gfw/dirk/hifi/spotify")
|
self.spotify_state = devices.audio_status(mqtt_client, config.TOPIC_GFW_DIRK_SPOTIFY)
|
||||||
self.mpd_state = devices.audio_status(mqtt_client, "my_apps/gfw/dirk/hifi/mpd")
|
self.mpd_state = devices.audio_status(mqtt_client, config.TOPIC_GFW_DIRK_MPD)
|
||||||
#
|
#
|
||||||
self.delayed_task = task.delayed(1.0, self.send_audio_source)
|
self.delayed_task = task.delayed(1.0, self.send_audio_source)
|
||||||
#
|
#
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import config
|
||||||
import devices
|
import devices
|
||||||
from function.helpers import now, sunset_time, sunrise_time
|
from function.helpers import now, sunset_time, sunrise_time
|
||||||
import logging
|
import logging
|
||||||
@ -58,7 +59,7 @@ class room_shelly(room):
|
|||||||
|
|
||||||
|
|
||||||
class room_shelly_motion_sensor(room_shelly):
|
class room_shelly_motion_sensor(room_shelly):
|
||||||
def __init__(self, mqtt_client, topic_shelly, topic_gui_switch, topic_motion_sensor_1, topic_motion_sensor_2=None, timer_value=30):
|
def __init__(self, mqtt_client, topic_shelly, topic_gui_switch, topic_motion_sensor_1, topic_motion_sensor_2=None, timer_value=config.DEFAULT_ON_TIME_LIGHT):
|
||||||
super().__init__(mqtt_client, topic_shelly, topic_gui_switch)
|
super().__init__(mqtt_client, topic_shelly, topic_gui_switch)
|
||||||
self.timer_value = timer_value
|
self.timer_value = timer_value
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user