Skip to content

Commit

Permalink
Enhancing Output helper plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
enesbcs committed Oct 13, 2020
1 parent 8074e03 commit 263c8f0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
10 changes: 10 additions & 0 deletions _C002_DomoMQTT.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ def on_message(self, msg):
tval[0] = str(svalue)
else:
tval[0] = str(nvalue)
try:
if ("Dimmer" in list['switchType']):
if str(list['nvalue'])=="0":
tval[0] = 0
if ("RGB" in list['stype']):
tval[1] = str(list['Color']['r'])
tval[2] = str(list['Color']['g'])
tval[3] = str(list['Color']['b'])
except:
pass
if decodeerr:
misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,"JSON decode error: "+msg2)
else:
Expand Down
1 change: 1 addition & 0 deletions _P014_SI7021.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def plugin_init(self,enableplugin=None):
plugin.PluginProto.plugin_init(self,enableplugin)
self.uservar[0] = 0
self.uservar[1] = 0
self.readinprogress = 0
if self.enabled:
i2cport = -1
try:
Expand Down
14 changes: 9 additions & 5 deletions _P029_DomoOutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
#############################################################################
#
# Only receiver! Communication is implemented through plugin_receivedata()
# Primarily for Domoticz, but can be used any MQTT based controller
# which do not need feedback.
# Primarily for Domoticz, but can be used any MQTT based controllers.
#
# Copyright (C) 2018-2019 by Alexander Nagy - https://bitekmindenhol.blog.hu/
# Copyright (C) 2018-2020 by Alexander Nagy - https://bitekmindenhol.blog.hu/
#
import plugin
import webserver
Expand All @@ -20,7 +19,7 @@

class Plugin(plugin.PluginProto):
PLUGIN_ID = 29
PLUGIN_NAME = "Output - Domoticz Output Helper (No feedback)"
PLUGIN_NAME = "Output - Output Helper"
PLUGIN_VALUENAME1 = "State"

def __init__(self,taskindex): # general init
Expand All @@ -41,13 +40,18 @@ def plugin_init(self,enableplugin=None):
def webform_load(self):
webserver.addFormNote("Please make sure to select <a href='pinout'>pin configured for Output!</a>")
webserver.addFormCheckBox("Preserve state at startup","p029_preserve",self.taskdevicepluginconfig[0])
webserver.addFormCheckBox("Response to remote commands for non-Domoticz controllers","p029_report",self.taskdevicepluginconfig[1])
return True

def webform_save(self,params):
if (webserver.arg("p029_preserve",params)=="on"):
self.taskdevicepluginconfig[0] = True
else:
self.taskdevicepluginconfig[0] = False
if (webserver.arg("p029_report",params)=="on"):
self.taskdevicepluginconfig[1] = True
else:
self.taskdevicepluginconfig[1] = False
self.sync()
return True

Expand Down Expand Up @@ -99,7 +103,7 @@ def plugin_receivedata(self,data): # set value based on m
val = 1
else:
val = 0
self.set_value(1,val,False)
self.set_value(1,val,self.taskdevicepluginconfig[1])
# print("Data received:",data) # DEBUG

def plugin_write(self,cmd):
Expand Down
3 changes: 2 additions & 1 deletion rpieGlobals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Copyright (C) 2018-2020 by Alexander Nagy - https://bitekmindenhol.blog.hu/
#
PROGNAME = "RPIEasy"
BUILD = 20283
BUILD = 20287
PROGVER = str(BUILD)[:1]+"."+str(BUILD)[1:2]+"."+str(BUILD)[2:]

gpMenu = []
Expand Down Expand Up @@ -100,6 +100,7 @@
SENSOR_TYPE_TEMP_EMPTY_BARO = 8
SENSOR_TYPE_SWITCH = 10
SENSOR_TYPE_DIMMER = 11
SENSOR_TYPE_RGB = 12
SENSOR_TYPE_LONG = 20
SENSOR_TYPE_WIND = 21
SENSOR_TYPE_TEXT = 101
Expand Down

0 comments on commit 263c8f0

Please sign in to comment.