Coming from another platform and HA is overwhelming with the possibilities of writing rules for now. I have a ventilation system which speed is controlled with a MySensors MQTT node and 3 connected relays to digital inputs.
Off - Relay1=On
Low - Relay2=On
Med - All relays=Off
High - Relay3=On
As it is a digital input you can not have 2 relays on at the same time. Furthermore i want to be able to control the ventilation from other rules (let’s say calling low speed at night). So what is the best practise to go in this configuration? Writing automation: scenes: or scripts:?
I used scenes when I first started with HA, but rarely use them now. I typically use scripts for things that I think of as functions - code that I’d like to execute from multiple places. Automations are a necessity - they define the rules that trigger something happening. That “something” might just be turning a light on, or it might be calling a script, etc.
Thanks for the tip. So after reading the documentation (which ia actually not that much for a newbie) trying to set up a first script
Is this the correct way to go?
script:
vent_off:
sequence:
- service: mqtt.publish
data:
#Set the low relay to 0
topic: "mygateway1-in/55/1/1/0/2"
payload: '0'
#Set the high relay to 0
- service: mqtt.publish
data:
topic: "mygateway1-in/55/3/1/0/"
payload: '0'
#Set the off relay to 1
- service: mqtt.publish
data:
topic: "mygateway1-in/55/2/1/0/2"
payload: '1'
vent_low:
sequence: e.t.c like above
For those who have an iphone, with the last ios and the “new widgets” on ios, all scene are directly available in a widget, and also available on apple watch.
Another avantage of the scene, is that we can make it in the gui, without tiping any code, … for exemple, you nee to power on your tv in netflix, and and light in red, … you just need to select netflix and red in your scene, … no need to make some code, it’s like a simple config.