- Posts: 60
- Thank you received: 2
Fan automation based on light status?
- graydon@gdsamps.com
- Topic Author
- Offline
- User
-
Less
More
2 years 4 months ago - 2 years 4 months ago #1766
by graydon@gdsamps.com
Fan automation based on light status? was created by graydon@gdsamps.com
I have a radon mitigation fan running 24/7 but it is annoying when I am in my basement shop. I decided to build a simple automation to turn it off any time my shop light is on.
The shop light is lighting_38
The shop light status can be read on lighting_38_status
The fan is on a Shellyplug which is lighting_302
I have verified that both the light and the fan can be operated by a lighting command in the command line of Myserver6 and if I look up the status variable I can see it changes when the light status changes. Also, in my lighting floorplan, the shop goes gray (indicating a light is on) whenever that light is on so I know that Myserver knows how to respond to the status of that light.
I'd add a screenshot of the automation but this forum software is the pits, but that's a different topic.
Under "Automation Rule Conditions" I wrote:
WHEN:
{{Lighting_38_status}}=on
Under "Automation Rule" Actions I wrote:
Macro|
Lighting|302~off!
WebCmd|all~Toast|warning~Radon Fan Notification~The Shop light is {{lighting_38_status}}~10000!
Any ideas what is wrong with my syntax? BTW, I also wrote a second automation to turn the fan back on whenever that light is turned off. I'm sure it could all be done in one automation but I'm not a programmer. One thing at a time while I'm learning.
Thanks,
The shop light is lighting_38
The shop light status can be read on lighting_38_status
The fan is on a Shellyplug which is lighting_302
I have verified that both the light and the fan can be operated by a lighting command in the command line of Myserver6 and if I look up the status variable I can see it changes when the light status changes. Also, in my lighting floorplan, the shop goes gray (indicating a light is on) whenever that light is on so I know that Myserver knows how to respond to the status of that light.
I'd add a screenshot of the automation but this forum software is the pits, but that's a different topic.
Under "Automation Rule Conditions" I wrote:
WHEN:
{{Lighting_38_status}}=on
Under "Automation Rule" Actions I wrote:
Macro|
Lighting|302~off!
WebCmd|all~Toast|warning~Radon Fan Notification~The Shop light is {{lighting_38_status}}~10000!
Any ideas what is wrong with my syntax? BTW, I also wrote a second automation to turn the fan back on whenever that light is turned off. I'm sure it could all be done in one automation but I'm not a programmer. One thing at a time while I'm learning.

Thanks,
Last edit: 2 years 4 months ago by graydon@gdsamps.com.
Please Log in to join the conversation.
- David Li
- Offline
- Admin
-
Less
More
- Posts: 1019
- Thank you received: 99
2 years 4 months ago #1767
by David Li
Replied by David Li on topic Fan automation based on light status?
See this example...the DelVariable gets rid of the "old" message after it has displayed (a reset)
Macro|
WebCmd|all~Toast|warning~SmartRemote8~SmartRemote8 is on charge. {{smartremote_battery_smartremote8}}%~5000!
DelVariable|message_1
Is the automation event firing? What's in the log? What's it getting done once fired vs, not getting done? Do you see the Toast message?
Macro|
WebCmd|all~Toast|warning~SmartRemote8~SmartRemote8 is on charge. {{smartremote_battery_smartremote8}}%~5000!
DelVariable|message_1
Is the automation event firing? What's in the log? What's it getting done once fired vs, not getting done? Do you see the Toast message?
Please Log in to join the conversation.
- graydon@gdsamps.com
- Topic Author
- Offline
- User
-
Less
More
- Posts: 60
- Thank you received: 2
2 years 4 months ago #1772
by graydon@gdsamps.com
Replied by graydon@gdsamps.com on topic Fan automation based on light status?
Nothing happens at all.
I just checked the log. I see there is an error.
"ERROR · Automations.LoadRules - Cannot parse [AND:{{Lighting_38_status}}=on] in rule radon off "
This is what is in the Automation Rule Conditions:
WHEN:
{{Lighting_38_status}}=on
I just checked the log. I see there is an error.
"ERROR · Automations.LoadRules - Cannot parse [AND:{{Lighting_38_status}}=on] in rule radon off "
This is what is in the Automation Rule Conditions:
WHEN:
{{Lighting_38_status}}=on
Please Log in to join the conversation.
- David Li
- Offline
- Admin
-
Less
More
- Posts: 1019
- Thank you received: 99
2 years 4 months ago #1795
by David Li
Replied by David Li on topic Fan automation based on light status?
did you copy / paste that variable name? ie: is L or l?Nothing happens at all.
I just checked the log. I see there is an error.
"ERROR · Automations.LoadRules - Cannot parse [AND:{{Lighting_38_status}}=on] in rule radon off "
This is what is in the Automation Rule Conditions:
WHEN:
{{Lighting_38_status}}=on
Please Log in to join the conversation.
- graydon@gdsamps.com
- Topic Author
- Offline
- User
-
Less
More
- Posts: 60
- Thank you received: 2
2 years 4 months ago #1798
by graydon@gdsamps.com
Replied by graydon@gdsamps.com on topic Fan automation based on light status?
Good catch. The correct spelling for that variable is with a lower case "l" as in "lighting_38_status"
I still get the same error though so that was not the only problem.
I deleted the colon after "WHEN" and that eliminated the error message but it still doesn't work.
I still get the same error though so that was not the only problem.
I deleted the colon after "WHEN" and that eliminated the error message but it still doesn't work.
Please Log in to join the conversation.
- davep
- Offline
- Admin
-
Less
More
- Posts: 367
- Thank you received: 96
2 years 4 months ago #1799
by davep
Replied by davep on topic Fan automation based on light status?
The parser is a bit picky. It needs white space around the operators
change
WHEN:
{{Lighting_38_status}}=on
to
WHEN:
{{lighting_38_status}} = on
change
WHEN:
{{Lighting_38_status}}=on
to
WHEN:
{{lighting_38_status}} = on
Please Log in to join the conversation.
Time to create page: 0.206 seconds