Update a number helper by asking Alexa

I’m trying to get Alexa to change the value of an input_number helper by saying something like

“Alexa, the value of input_number.name is…”

I’ve created a script:

alias: Set Car Battery Charge Level
sequence:
  - service: input_number.set_value
    target:
      entity_id: input_number.car_battery_charge_level
    data:
      value: "{{ value }}"
mode: single
icon: mdi:battery

and created a routine in Alexa

How do I pass the value I want it set to from Alexa? Is that even possible?

Home Assistant scripts become scenes in Alexa. When I select the scene under “ALEXA WILL” all I get is the option to turn the scene on or off ie run the script.

I don’t think it is. An Alexa routine recognises exact phrases, so you’d have to have a different routine for each possible charge level, and a different script.

Some Alexa skills do include parameters - I can say “Set the thermostat to 21 degrees”, for example. You might try building a custom skill?

I’m always willing to have a go at something that’s outside my comfort level.

This, however, might be outside my skill level.

I’ll give it a go and see how I get on.

Failing that,

It’s only c95 scripts and routines, unless I round to the nearest 5 :thinking:

Thanks.

It’s kind of hacky, but you could use a template light… then use the brightness attribute to set the input number.

2 Likes

Okay, so ask Alexa to set a lamp’s brightness to a given value, then, what, use that state or attribute change to update the number helper?

The actions are set up in the Template Light configuration. In this case it would be the set_level key where you would place the input_number.set_value service call. While they are optional, you should probably add actions for turn_on and turn_off as well, just so you can use those voice commands as well.

1 Like