I did create the last_called sensor and also added 0.5 delay before the update_last_called and before the notify.alexa_media_last_called which did seem to help and yes they are the older echoes without the cloth so maybe that was why.
action:
- delay:
seconds: 0.5
- service: alexa_media.update_last_called
- delay:
seconds: 0.5
- service: notify.alexa_media_last_called
data:
message: >-
{% if (state_attr('light.dialog', 'brightness') | int / 255 * 100 ) | int == 10 %}
The battery is currently at {{ states('sensor.solar_battery_soc') }} percent
{% elif (state_attr('light.dialog', 'brightness') | int / 255 * 100 ) | int == 20 %}
The EV battery is currently at {{ states('sensor.charging_level_hv') }} percent
{% elif (state_attr('light.dialog', 'brightness') | int / 255 * 100 ) | int == 30 %}
The electric range is {{ states('sensor.remaining_range_electric') }} kilometers
{% else %}
There is no routine set up for that value.
{% endif %}
data:
type: tts
- service: light.turn_off
entity_id: light.dialog
I have also added two more routines but for some reason this one doesnāt work {% elif (state_attr('light.dialog', 'brightness') | int / 255 * 100 ) | int == 30 %} keeps going down to the there is no routine set up bit and I have no idea why, the brightness is set to 30 in the routine itself.
Can anyone spot anything incorrect (the value of that sensor is 0 at this moment)
The code looks fine, but check the arithmetic that comes out of your template if you paste it into the template editor in Developer Tools.
Just paste {{ (state_attr('light.dialog', 'brightness') | int / 255 * 100) | int }} into the template editor, trigger Alexa to run the range routine, and make sure the output from the template is actually returning 30. Sometimes you can get weird rounding errorsā¦ 30% of 255 is 76.5 rounded up it works, rounded down it fails:
{{ ((76.5)|int / 255 * 100) | int }} returns 29
If thatās what you see in the template editor, your options are to just change whatās after ā==ā to 29, or to modify your templates to compensate by rounding:
I donāt know if this is the right way / done thing, but Iām a fairly new HA adopter, loving it, but looking for some help. Iām pretty much wanting to do exactly the same as you attempted in this thread. But Templates and Media Player are very very much on the fringe of my skills. Iāve made solid headway into implementing the solution here but am stuck at what i feel is the final hurdle (and am prob only about 70% understanding how this actually works!)
Would it be possible to get some advice / assistance? Iād really appreciate it!