restructuring: split devdi device interface (devices) and smart device classes (smart_devices)
This commit is contained in:
parent
f87a2151c3
commit
a58ee9c0af
@ -4,12 +4,19 @@ import readline
|
||||
import sys
|
||||
import report
|
||||
import logging
|
||||
import devices
|
||||
import smart_devices
|
||||
import json
|
||||
|
||||
|
||||
report.app_logging_config()
|
||||
|
||||
|
||||
def callback(*args, **kwargs):
|
||||
print(args)
|
||||
print(kwargs)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
report.stdoutLoggingConfigure([[config.APP_NAME, logging.INFO], ], fmt=report.SHORT_FMT)
|
||||
mc = mqtt.mqtt_client(
|
||||
host=config.MQTT_SERVER,
|
||||
port=config.MQTT_PORT,
|
||||
@ -19,12 +26,11 @@ if __name__ == "__main__":
|
||||
)
|
||||
#
|
||||
devicedict = {}
|
||||
for device in [
|
||||
# devices.shelly_pro3(mc, "shellies/gfw/pro3"),
|
||||
# devices.brennenstuhl_heatingvalve(mc, "zigbee_raspi/heatvlv"),
|
||||
# devices.silvercrest_button(mc, "zigbee_raspi/button"),
|
||||
devices.hue_sw_br_ct(mc, "zigbee_ffe/kitchen/main_light_1"),
|
||||
]:
|
||||
device_list = []
|
||||
# define devices
|
||||
device_list.append(smart_devices.shelly.shelly_rpc(mc, "unknown/topic"))
|
||||
# create device_dict
|
||||
for device in device_list:
|
||||
devicedict[device.topic.replace("/", "_")] = device
|
||||
#
|
||||
COMMANDS = ['quit', 'help', 'action']
|
||||
|
@ -1,47 +1,23 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
"""
|
||||
devices (DEVICES)
|
||||
=================
|
||||
|
||||
**Author:**
|
||||
|
||||
* Dirk Alders <sudo-dirk@mount-mockery.de>
|
||||
|
||||
**Description:**
|
||||
|
||||
This Module supports smarthome devices
|
||||
|
||||
**Submodules:**
|
||||
|
||||
* :mod:`shelly`
|
||||
* :mod:`silvercrest_powerplug`
|
||||
|
||||
**Unittest:**
|
||||
|
||||
See also the :download:`unittest <devices/_testresults_/unittest.pdf>` documentation.
|
||||
|
||||
**Module Documentation:**
|
||||
|
||||
"""
|
||||
import logging
|
||||
|
||||
from devices.shelly import shelly as shelly_sw1
|
||||
from devices.shelly import shelly_rpc as shelly_pro3
|
||||
from devices.hue import hue_light as hue_sw_br_ct
|
||||
from devices.tradfri import tradfri_light as tradfri_sw
|
||||
from devices.tradfri import tradfri_light as tradfri_sw_br
|
||||
from devices.tradfri import tradfri_light as tradfri_sw_br_ct
|
||||
from devices.tradfri import tradfri_button as tradfri_button
|
||||
from devices.tradfri import tradfri_light as livarno_sw_br_ct
|
||||
from devices.brennenstuhl import brennenstuhl_heatingvalve
|
||||
from devices.silvercrest import silvercrest_button
|
||||
from devices.silvercrest import silvercrest_powerplug
|
||||
from devices.silvercrest import silvercrest_motion_sensor
|
||||
from devices.mydevices import powerplug as my_powerplug
|
||||
from devices.mydevices import audio_status
|
||||
from devices.mydevices import remote
|
||||
from smart_devices.shelly import shelly as shelly_sw1
|
||||
from smart_devices.shelly import shelly_rpc as shelly_pro3
|
||||
from smart_devices.hue import hue_light as hue_sw_br_ct
|
||||
from smart_devices.tradfri import tradfri_light as tradfri_sw
|
||||
from smart_devices.tradfri import tradfri_light as tradfri_sw_br
|
||||
from smart_devices.tradfri import tradfri_light as tradfri_sw_br_ct
|
||||
from smart_devices.tradfri import tradfri_button as tradfri_button
|
||||
from smart_devices.tradfri import tradfri_light as livarno_sw_br_ct
|
||||
from smart_devices.brennenstuhl import brennenstuhl_heatingvalve
|
||||
from smart_devices.silvercrest import silvercrest_button
|
||||
from smart_devices.silvercrest import silvercrest_powerplug
|
||||
from smart_devices.silvercrest import silvercrest_motion_sensor
|
||||
from smart_devices.mydevices import powerplug as my_powerplug
|
||||
from smart_devices.mydevices import audio_status
|
||||
from smart_devices.mydevices import remote
|
||||
|
||||
from function.videv import videv_switching as videv_sw
|
||||
from function.videv import videv_switch_brightness as videv_sw_br
|
||||
|
6
smart_devices/__init__.py
Normal file
6
smart_devices/__init__.py
Normal file
@ -0,0 +1,6 @@
|
||||
from . import brennenstuhl
|
||||
from . import hue
|
||||
from . import mydevices
|
||||
from . import shelly
|
||||
from . import silvercrest
|
||||
from . import tradfri
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
from devices.base import base
|
||||
from .base import base
|
||||
import task
|
||||
import time
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
from devices.base import base, base_output
|
||||
from .base import base, base_output
|
||||
import logging
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
from devices.base import base, base_output
|
||||
from .base import base, base_output
|
||||
import logging
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
from devices.base import base_output
|
||||
from devices.base import base_rpc
|
||||
from .base import base_output
|
||||
from .base import base_rpc
|
||||
import task
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
from devices.base import base, base_output
|
||||
from .base import base, base_output
|
||||
import logging
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
from devices.base import base, base_output
|
||||
from .base import base, base_output
|
||||
import logging
|
||||
|
||||
|
||||
@ -120,6 +120,7 @@ class tradfri_light(base_output):
|
||||
def set_color_temp(self, color_temp):
|
||||
"""color_temp: [0, ..., 10]"""
|
||||
self.send_command(self.KEY_COLOR_TEMP, color_temp)
|
||||
self.mqtt_client.send('/'.join([self.topic, self.TX_TOPIC]), '{"color_temp_startup": "previous"}')
|
||||
|
||||
def set_color_temp_mcb(self, device, key, data):
|
||||
self.set_color_temp(data)
|
Loading…
x
Reference in New Issue
Block a user