To get it going,
1) Make a new macro, name 'AC Unit Control' or something and put the python script inside
2) Drag the RFXtrx event to the same macro (in your example the RFXtrx.Type: La Crosse TX3, TX4, TX17 id: 17920)
3) Make two other macros, one for "AC Unit ON" and one for "AC Unit OFF"
4) In each of them respectively, put the action that sends the ON and OFF commands to the AC Unit and drag/define the events generated from the script execution. See picture as example of a typical configuration.
First time the temperature goes below the low limit, the AC will be sent an OFF command and when it reaches just above the high level, an ON command will be sent.
Similar scripts and macros can be defined for fans, heaters etc.
Best regards, Walter
Code: Select all
#AC Unit Control
newEvent = str(eg.event.suffix)
newPayload = eg.event.payload
name = 'My AC Unit'
id = 17920
high_level = 25.0
low_level = 22.0
try:
status
except NameError:
status = None
if newEvent.split(':')[2].find(str(id)) > 0:
temp = newPayload.split(' ')[2]
if(
float(temp) > high_level
and (
status == 'OFF'
or
status == None
)
):
eg.TriggerEvent(
name
+"|"
+'High Temp Level reached'
+"|"
+str(id)
)
status = 'ON'
if(
float(temp) < low_level
and (
status == 'ON'
or
status == None
)
):
eg.TriggerEvent(
name
+"|"
+'Low Temp Level reached'
+"|"
+str(id)
)
status = 'OFF'