Hi guys! I want to get an automation that wakes me up gently when my alarm is set. I got this working with the tons of examples available on the web, but I want a slightly different approach. I want to set the alarm time on my phone and not on the web interface.
I can currently send my set alarm clock time through tasker (with the AutoAlarm and the MQTT client plugins) in any format. Currently it just sends “HH:MM” (so 07:40, or the likes). How do I convert this incoming packet to an input time?
For my sensor I currently have the following (in sensors.yaml), which is displayed on the dashboard.
# Wake up light
- alias: "Wake me up with bedroom light transition for weekdays"
trigger:
platform: template
value_template: "{{ states('sensor.time') == (states.input_datetime.wakeup_time.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
So my question is: how to get the incoming MQTT message in my code?
ps. I am still planning on using the on/off boolean to disable the alarm if the MQTT sends “no_alarm” when there will be no alarm the following day.
I am currently not at home, but will test it when I get back. This looks like the easiest solution I have ever seen. Thanks for your input. Do the values stay stored when hassio reboots? I heard someone say you must use input_datetime to keep your values after a restart, do you know how that works?
And how do you store the stored HH and MM values so it can be used in the automation? The trigger I posted would not work anymore, since it is not in input_datetime format.
A lot of people asked me for this, it’s rather complicated “construction” so I really have to dive in the package docs and create a package that I can share. I will increase the urgency level on my todo-list
For people stumbling upon this topic, I believe an easier solution (than using tasker and mqtt on my phone) is to use an app which creates a sensor for your next alarm time:
An example for automations can be found on the github