I’ve read through the documentation on there Jason page and some of the example configurations on github, but I can’t figure out how to make an automation/script for a fan.
I wanted to make a timer for an exhaust fan I have when soldering in my workshop. I want to be able to input a timer on a slider that will turn on a fan does said time. I can understand creating the sliders, but how do you pass the intended timer time and switch back to ha?
Could someone please look over this configuration for me? I am getting an error on bootup of HA for the automatoin I am trying to create:
16-06-27 17:03:15 homeassistant.bootstrap: Invalid config for [script]: expected int for dictionary value @ data[‘script’][‘mancavefantimer_off’][‘sequence’][0][‘delay’][‘minutes’]
And this is what my configuration looks like (all are in their own .yaml file).
automation.yaml
- alias: 'Man Cave Fan Timer'
trigger:
platform: state
entity_id: input_boolean.fantimer
state: 'on'
action:
service: script.mancavefantimer_on
As far as I’m aware it’s not possible to anything other than a number.
This is also reflected by your error. 16-06-27 17:03:15 homeassistant.bootstrap: Invalid config for [script]: expected int for dictionary value @ data['script']['mancavefantimer_off']['sequence'][0]['delay']['minutes']
That is correct. I tried to do the same thing with a fan timer and found that it did not work. For now you just have to add the numbers of minutes as an integer.
I have not tested it recently, this may be a rather dumb question but are you using the input_slider condition? If so, make sure it’s set to on (I have mine off by default).
I’ll give it a check tonight to see if it’s working still.
Hi Rich, sorry I forgot to get back to you. Yes it is working for me, I haven’t modified the code above in any way so not sure why it’s not working now for you.
Hi Kip, but your current code posted above: “minutes: 120 #{{states.input_slider.fanautooffslider.state}}”
equates to:
{
“minutes”: 120
}
It is not using the commented out code after the ‘#’.
That it is correct, I’m still not using the commented out code. I haven’t kept up with the change logs recently to see if the ability to use sliders has been added yet.
Apparently it should work, the https://home-assistant.io/getting-started/scripts/ wiki has the example:
//Waits however many minutes input_slider.minute_delay is set to
//Valid formats include HH:MM and HH:MM:SS
delay: ‘00:{{ input_slider.minute_delay | int }}:00’
Yes that should work. But I think you may be limited to 59 minutes maximum as the template effectively emulates the time code HH:MM:SS with MM being the variable we are changing by the slider. I’m not that deep enough into the code to look into this in more detail but I can see you there may be other ways to implement this.
Rich
I kind of forgot about this timer and never really got it working the way I wanted it to. I’ve been trying over the holiday break, and while I get no script errors I do not get the desired result I want. I have a slider and button set up to allow input of minutes and to turn on a fan, but it does not turn off after the delay(set by the slider) is up. Would you please take a look at my config and let me know where I am going wrong please?
input_boolean.yaml
fantimer:
name: Fan Timer
initial: off
icon: mdi:fan
I actually haven’t been able to get mine working either. It’s been fall/winter here though I so haven’t had need for the script and thus haven’t spent any time trying to figure it out.
Not sure if this is it but you may need to change your script to add the data line: