Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new branch, to be used with 433MHz-driven heaters #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
http://www.antor.fr/apps/smart-virtual-thermostat-eng-2/?lang=en
https://github.com/AntorFr/SmartVT
Version: 0.4.10 (November 25, 2020) - see history.txt for versions history

Branch to be used with 433MHz-driven heaters:
- Inverts the ON/OFF order (Simple 433MHz switch on pilot wire gives inverted order)
- Sends the switching orders even if the state of the switch hasn't changed. This is to prevent locking situations when one order was missed (heater remains stuck ON or OFF)
"""
"""
<plugin key="SVT" name="Smart Virtual Thermostat" author="logread" version="0.4.10" wikilink="https://www.domoticz.com/wiki/Plugins/Smart_Virtual_Thermostat.html" externallink="https://github.com/999LV/SmartVirtualThermostat.git">
Expand Down Expand Up @@ -430,7 +434,7 @@ def switchHeat(self, switch):
idx = int(device["idx"])
if idx in self.Heaters: # this switch is one of our heaters
if "Status" in device:
switches[idx] = True if device["Status"] == "On" else False
switches[idx] = True if device["Status"] == "Off" else False # Order inverted !
Domoticz.Debug("Heater switch {} currently is '{}'".format(idx, device["Status"]))
else:
Domoticz.Error("Device with idx={} does not seem to be a switch !".format(idx))
Expand All @@ -442,10 +446,10 @@ def switchHeat(self, switch):

# flip on / off as needed
self.heat = switch
command = "On" if switch else "Off"
command = "On" if not(switch) else "Off" # Order inverted !
Domoticz.Debug("Heating '{}'".format(command))
for idx in self.Heaters:
if switches[idx] != switch: # check if action needed
if True: # Always send order to the heater. This is to prevent lockup with non-acknowledged systems
DomoticzAPI("type=command&param=switchlight&idx={}&switchcmd={}".format(idx, command))
if switch:
Domoticz.Debug("End Heat time = " + str(self.endheat))
Expand Down