changeset 1703:80b01d548b9c

add new devs, factor out to devs.py
author drewp@bigasterisk.com
date Sat, 23 Oct 2021 13:14:45 -0700
parents ac1ae0c21bb0
children 6c8139a30025
files service/rdf_to_mqtt/devs.py service/rdf_to_mqtt/rdf_to_mqtt.py
diffstat 2 files changed, 26 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/service/rdf_to_mqtt/devs.py	Sat Oct 23 13:14:45 2021 -0700
@@ -0,0 +1,25 @@
+from rdflib import Namespace
+
+ROOM = Namespace('http://projects.bigasterisk.com/room/')
+
+devs = {
+    ROOM['kitchenLight']:          {'root': 'h801_skylight', 'hasWhite': True, },
+    ROOM['kitchenCounterLight']:   {'root': 'h801_counter', 'hasWhite': True, },
+    ROOM['livingLampShelf']:       {'root': 'sonoff_0/switch/sonoff_basic_relay/command', 'values': 'binary', },
+    ROOM['livingLampMantleEntry']: {'root': 'sonoff_1/switch/sonoff_basic_relay/command', 'values': 'binary', },
+    ROOM['livingLampMantleChair']: {'root': 'sonoff_2/switch/sonoff_basic_relay/command', 'values': 'binary', },
+    ROOM['livingLampToyShelf']:    {'root': 'sonoff_3/switch/sonoff_basic_relay/command', 'values': 'binary', },
+    ROOM['livingLampPiano']:       {'root': 'sonoff_4/switch/sonoff_basic_relay/command', 'values': 'binary', },
+    ROOM['theater']:               {'root': 'theater_blaster/ir_out', 'values': 'theaterOutputs', },
+    ROOM['bedHeadboard']:  {'root': 'bed/light/headboard/command', 'hasWhite': True, },
+    # https://github.com/Koenkk/zigbee2mqtt.io/blob/new_api/docs/information/mqtt_topics_and_message_structure.md#general
+    ROOM['asherBedBar']:   {'root': 'bed_bar_asher/light/rgb/command',        'hasBrightness': True, 'defaults': {}},
+    ROOM['asherCeiling']:  {'root': 'zigbee-frontbed/0xf0d1b80000022c86/set', 'hasBrightness': True, 'defaults': { 'transition': 0, } },
+    ROOM['asherDoor']:     {'root': 'zigbee-frontbed/0xd0cf5efffe28abcf/set', 'hasBrightness': True, 'defaults': { 'transition': 0, } },
+    ROOM['frontCeiling1']: {'root': 'zigbee-frontbed/0xf0d1b800000210fc/set', 'hasBrightness': True, 'defaults': { 'transition': 0, } },
+    ROOM['frontCeiling2']: {'root': 'zigbee-frontbed/0xf0d1b8000001ffc6/set', 'hasBrightness': True, 'defaults': { 'transition': 0, } },
+    ROOM['frontHanging']:  {'root': 'zigbee-frontbed/0xf0d1b80000023583/set', 'hasBrightness': True, 'defaults': { 'transition': 0, } },
+    ROOM['livingCouch']:   {'root': 'zigbee-frontbed/0x000b57fffec9645f/set', 'hasBrightness': True, 'defaults': { 'transition': 0, } },
+    ROOM['livingToys']:    {'root': 'zigbee-frontbed/0x90fd9ffffee70277/set', 'hasBrightness': True, 'defaults': { 'transition': 0, } },
+    ROOM['stairTop']:      {'root': 'zigbee-frontbed/0xf0d1b8000001c925/set', 'hasBrightness': True, 'defaults': { 'transition': 0, } },
+}
--- a/service/rdf_to_mqtt/rdf_to_mqtt.py	Sat Oct 23 13:14:07 2021 -0700
+++ b/service/rdf_to_mqtt/rdf_to_mqtt.py	Sat Oct 23 13:14:45 2021 -0700
@@ -15,7 +15,7 @@
 from rdflib import Namespace
 from standardservice.logsetup import log, verboseLogging
 from twisted.internet import reactor
-
+from devs import devs
 import rdf_over_http
 
 ROOM = Namespace('http://projects.bigasterisk.com/room/')
@@ -27,40 +27,6 @@
     scales.PmfStat('mqttPublish'),
 )
 
-devs = {
-    ROOM['kitchenLight']: {
-        'root': 'h801_skylight',
-        'hasWhite': True,
-    },
-    ROOM['kitchenCounterLight']: {
-        'root': 'h801_counter',
-        'hasWhite': True,
-    },
-    ROOM['livingLampShelf']:       { 'root': 'sonoff_0/switch/sonoff_basic_relay/command', 'values': 'binary', },
-    ROOM['livingLampMantleEntry']: { 'root': 'sonoff_1/switch/sonoff_basic_relay/command', 'values': 'binary', },
-    ROOM['livingLampMantleChair']: { 'root': 'sonoff_2/switch/sonoff_basic_relay/command', 'values': 'binary', },
-    ROOM['livingLampToyShelf']:    { 'root': 'sonoff_3/switch/sonoff_basic_relay/command', 'values': 'binary', },
-    ROOM['livingLampPiano']:       { 'root': 'sonoff_4/switch/sonoff_basic_relay/command', 'values': 'binary', },
-    ROOM['theater']: {
-        'root': 'theater_blaster/ir_out',
-        'values': 'theaterOutputs',
-    },
-    ROOM['bedHeadboard']: {
-        'root': 'bed/light/headboard/command',
-        'hasWhite': True,
-    },
-    # https://github.com/Koenkk/zigbee2mqtt.io/blob/new_api/docs/information/mqtt_topics_and_message_structure.md#general
-    ROOM['frontRoom1']:   { 'root': 'zigbee-dash/frontRoom1/set',             'hasBrightness': True, 'defaults': { 'transition': 0, } },
-    ROOM['frontRoom2']:   { 'root': 'zigbee-dash/frontRoom2/set',             'hasBrightness': True, 'defaults': { 'transition': 0, } },
-    ROOM['asherCeiling']: { 'root': 'zigbee-frontbed/0xf0d1b80000022c86/set', 'hasBrightness': True, 'defaults': { 'transition': 0, } },
-    ROOM['asherBedBar']:  { 'root': 'bed_bar_asher/light/rgb/command',        'hasBrightness': True, 'defaults': {}},
-    ROOM['stairTop']:     { 'root': 'zigbee-dash/stairTop/set',               'hasBrightness': True, 'defaults': { 'transition': 0, } },
-    ROOM['noname1']:      { 'root': 'zigbee-bang/0xf0d1b8000001ffc6/set',     'hasBrightness': True, 'defaults': { 'transition': 0, } },
-    ROOM['noname2']:      { 'root': 'zigbee-bang/0xf0d1b80000023583/set',     'hasBrightness': True, 'defaults': { 'transition': 0, } },
-    ROOM['noname3']:      { 'root': 'zigbee-bang/0xf0d1b80000023708/set',     'hasBrightness': True, 'defaults': { 'transition': 0, } },
-    ROOM['noname4']:      { 'root': 'zigbee-bang/0xf0d1b80000022adc/set',     'hasBrightness': True, 'defaults': { 'transition': 0, } },
-}
-
 
 class OutputPage(PrettyErrorHandler, cyclone.web.RequestHandler):