Fan automation based on light status?

graydon@gdsamps.com's Avatar Topic Author

Fan automation based on light status?

2 years 6 months ago - 2 years 6 months ago
#1766
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,
 
Last edit: 2 years 6 months ago by graydon@gdsamps.com.

Please Log in or Create an account to join the conversation.

David Li's Avatar
Admin Admin
  • Posts: 1027
  • Thanks: 99

Re: Fan automation based on light status?

2 years 6 months ago
#1767
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?

Please Log in or Create an account to join the conversation.

graydon@gdsamps.com's Avatar Topic Author

Re: Fan automation based on light status?

2 years 6 months ago
#1772
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 or Create an account to join the conversation.

David Li's Avatar
Admin Admin
  • Posts: 1027
  • Thanks: 99

Re: Fan automation based on light status?

2 years 6 months ago
#1795
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
did you copy / paste that variable name?  ie: is L or l?
 

Please Log in or Create an account to join the conversation.

graydon@gdsamps.com's Avatar Topic Author

Re: Fan automation based on light status?

2 years 6 months ago
#1798
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.

 

Please Log in or Create an account to join the conversation.

davep's Avatar
Admin Admin
  • Posts: 371
  • Thanks: 98

Re: Fan automation based on light status?

2 years 6 months ago
#1799
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

Please Log in or Create an account to join the conversation.

Time to create page: 0.281 seconds