hello there,
Am trying to make a silly template which will announce via alexa how much time I slept the previous night.
I’ve create two variables, “sleeptime” and ”time_to_goal”.
What I want to achieve is to convert the “time_to_goal” to integer so Alexa won’t announce any decimal digits.
service: notify.alexa_media
data_template:
target: "{{ states.sensor.last_alexa.state }}"
data:
type: tts
message: >-
<speak>
{% set sleeptime = states('sensor.sleep_time_yesterday_for_makis') | float | round(1) %}
{% set time_to_goal = (((8 - states('sensor.sleep_time_yesterday_for_makis') | float) | round(1)) * 100) | int %}
{% if sleeptime | float > 8 %}
<amazon:emotion name="excited" intensity="high">
The pre-defined sleep time has been reached. You slept {{ sleeptime }} hours.
</amazon:emotion>
{% else %}
<amazon:emotion name="disappointed" intensity="high">
The pre-defined sleep time has not been reached.<break time="1s"/>
You slept {{ sleeptime }} hours which is {{ time_to_goal }} minutes less than the desired sleep time.
</amazon:emotion>
{% endif %}
</speak>
It seems correct to me but can you please confirm that the math inslide time_to_goal variable are correct ???