Could you have the app read the alarms on your phone and add them as a sensor so you can have a scene trigger on/before your alarm?
Iāve seen both of those solutions, but if Iāve already installed one app to integrate with HA, Iād prefer not to have to install others to accomplish what this one could fairly trivially.
I understand, I use Tasker for a lot of other things as well, so for me itās not an additional app to install.
Thereās already an open issue for this on github.
I can recommend tasker for this too.
Besides the alarm clock I use it for sms or call notification, so for me it isnāt an additional app either.
Didnāt see the other thread, so this one can be closed, but I donāt intend for any of HA to be exposed to the internet, so having to install another app on my phone and open HA to the internet is a hell of a lot extra vs having the app Iāve already installed do this.
I actually submitted a PR for this today just need to wait for it to be reviewed and merged. If you really want to test this feature now you can grab the debug APK from the github actions.
Seems to work like a charm. Now Iāve gotta figure out how to integrate it haha
Yes indeed - it works great and I can see the sensor value in HA - but I canāt figure how to utilise that sensor value as a trigger for an automation
But the sensor is included in the official app now, so Broadcast2MQTT isnāt needed anymore right?
Does anyone knows how to integrate the next alarm sensor in an automation? I tried this but it doesnāt trigger.
- id: "Sync-Smartphone-Alarm"
alias: Sync-Smartphone-Alarm
trigger:
- platform: state
entity_id: sensor.col_l29_next_alarm
condition:
- condition: template
value_template: '{{ now().strftime("%Y-%m-%d %H:%M") == as_timestamp(states("sensor.col_l29_next_alarm")) | timestamp_custom("%Y-%m-%d %H:%M") }}'
action:
- service: light.turn_on
data:
entity_id: light.bett_right_led
brightness: 100
transition: 3600
rgb_color: [255, 0, 0]
Your condition should be the trigger.
Thanks, i tried it but same result
trigger:
- platform: template
value_template: '{{ as_timestamp(states("sensor.col_l29_next_alarm")) | timestamp_custom("%Y-%m-%d %H:%M") }}'
# both don't work
- platform: template
value_template: '{{ now().strftime("%Y-%m-%d %H:%M") == as_timestamp(states("sensor.col_l29_next_alarm")) | timestamp_custom("%Y-%m-%d %H:%M") }}'
You need a time sensor for Home Assistant. Your current attempts do not work,because there is no entity that changes the state (your alarm clock sensor only changes when you set a new alarm), so the automation is never triggered. The time sensor updates every minute, so the template will then be evaulated every minute. Another approach is to trigger with a time patter (e.g. every 5 seconds) and check in the condition if the alarm clock time is equal to now.