Setting input_number from shell command output, at startup

Hey guys,

I would love some help to finish my lounge volume limiter. This is to avoid the odd very loud film/episode, and the resulting wrath of my partner. :slight_smile: I like the idea of capping the odd party too, seeing as we have teenage girls living with us.

To achieve this, I have a simple bash script, controlled by an input_number slider, acting to set the audio trigger level on an Android IP Webcam ( This is done simply like:

curl http://username:[email protected]:8080/settings/adet_limit?set=$limit

If the volume measured by the IP WebCam goes over the level set in this way, then Tasker (also on the android) takes this detection event and uses MQTT to trigger an automation on Home Assistant to turn our stereo down.

So far, so good.

But when the Home Assistant starts, I just want to set the input_number slider to the right ‘audio limit’ value, otherwise it’s just misleading. My wee bash script can also happily spit out the latest setting - but can I collect the bash script output, and use it to set the input_number value?

Or is there a better way to do it?

Many thanks!

not sure if this is what you are looking for, but why don’t you simply use initial :

1 Like

I guess with an automation that uses this, and then calls the curl command as a command_line sensor:

    platform: homeassistant
    event: start
1 Like

How complex can we get with that, though? I am not sure I can even use a template with that (which could leverage a sensor), to get the correct value Maybe I could reset the android App at each startup, using a static value… hmm

Yeah I suppose I could use a sensor that is only updated at HASS startup… have that and the setting of the slider within a Home Assistant ‘script’…

you can do anything you like with that input_number, setting initial to a value only ensures that each time you startup Ha, it is set to that ‘default’ value. Which is what you asked for isn’t it?

Wat you can also do is leave initial out, add the input_number to recorder.yaml include: and it remembers the setting you had last set it to, which is really kind of cool and just that bit more dynamic than setting it fixed.

1 Like

Ahh that was what I was after! perfect! A default would have worked, but this is better, I had no idea about this recorder thing.

1 Like