@@ -23,15 +23,17 @@ def __init__(self, pluginId, pluginDisplayName, pluginVersion, pluginPrefs):
23
23
24
24
self .ratgdo_devices = []
25
25
self .mqttPlugin = indigo .server .getPlugin ("com.flyingdiver.indigoplugin.mqtt" )
26
- if not self .mqttPlugin .isEnabled ():
27
- self .logger .warning ("MQTT Connector plugin not enabled!" )
28
26
29
27
if old_version := self .pluginPrefs .get ("version" , "0.0.0" ) != self .pluginVersion :
30
28
self .logger .debug (f"Upgrading plugin from version { old_version } to { self .pluginVersion } " )
31
29
self .pluginPrefs ["version" ] = self .pluginVersion
32
30
33
31
def startup (self ):
34
32
self .logger .info ("Starting ratgdo" )
33
+
34
+ if not self .mqttPlugin .isEnabled ():
35
+ return "MQTT Connector plugin not enabled!"
36
+
35
37
indigo .server .subscribeToBroadcast ("com.flyingdiver.indigoplugin.mqtt" , "com.flyingdiver.indigoplugin.mqtt-message_queued" , "message_handler" )
36
38
37
39
def message_handler (self , notification ):
@@ -144,9 +146,15 @@ def actionControlDevice(self, action, device):
144
146
self .logger .debug (f"actionControlDevice: Lock { device .name } " )
145
147
self .publish_topic (device , f"ratgdo/{ device .address } /command/door" , "close" )
146
148
149
+ elif action .deviceAction == indigo .kUniversalAction .RequestStatus :
150
+ self .logger .debug (f"{ device .name } : actionControlUniversal: RequestStatus" )
151
+ # self.publish_topic(device, f"ratgdo/{device.address}/command", "query")
152
+ self .publish_topic (device , f"ratgdo/{ device .address } /command/query" , "" )
153
+
147
154
else :
148
155
self .logger .error (f"{ device .name } : actionControlDevice: Unsupported action requested: { action .deviceAction } " )
149
156
157
+
150
158
def publish_topic (self , device , topic , payload ):
151
159
152
160
mqttPlugin = indigo .server .getPlugin ("com.flyingdiver.indigoplugin.mqtt" )
0 commit comments