Did you end up trying this? How is it working?
I’ve just configured it, but always appreciate some advice!
I did end up not doing this. Since the update with “Sleep” for iphone and apple watch it now works to have Wake up alarm trigger a shortcut. So I’m turning off a boolean for “sleep mode” that I exposed in homekit from that. Works great as long as the shortcut automation actually runs (which it sometimes fails to do, I don’t know why).
Thanks!
I don’t think this works if you’re not using alarm, or does it? (For those few days I don’t use an alarm haha.)
If you still use “Sleep” there is also an option to trigger when “Waking up”. That doesn’t need an alarm, but can of course maybe be a bit delayed maybe?
Using the shortcuts some time now, been working like a champ. No need for extra apps or monthly subscriptions.
I am new to HA (migrating from openhab) and would appreciate if you could share the call to HA.
Questions:
- is this triggering a script or REST call (name in Shortcuts App?
- how does the URL look like then?
Thanks in advance.
Sorry for the Dutch
Basically it calls an input select in HA and you can use that to trigger other stuff. Hope this helps a bit.
Thank you Erik!
Dutch is quite understandable
I will try it tomorrow morning.
Much appreciated.
I am sorry, but I don’t get it.
My use case is pretty simple: When I deactivate the alarmclock of my iphone / watch, I would like to switch on my espresso machine.
Therefore I have created a switch called WakeUpCall
(ID: input_boolean.wakeupcall)
I have created a personal automation which supposed to be activated if I switch off my alarm.
(I am not the snooze-guy
I read a lot about the Dictionary, but don’t get it’s meaning.
Actually I would assume that this action (alarmclock off) would trigger something directly in the Home Assistant App.
Especially because I can select the server (local host name Homer
) and can select the service from it (e.g. switch.turn_on
.
So there seems to be a connection already.
I have posted my screen below and hope that someone can help me.
Some questions though:
- I don’t need Homekit on HA for this to work, right?
- The Dictionary stuff below just identifies the entity I want to address, right?
- What’s the “option” stuff? The state I would like to set?
- What am I doing wrong?
Don’t use a physical alarm clock for a very long time now. My biological clock wakes me up, but I do sleep with the phone next to me. Will try the iOS setup. Just need to think of what I want trigger
- You don’t need homekit for this
- correct
- Exactly too
- The “aufruf” shoudl not be switch, it should be
input_select.select_option
Been some time, but basicly your telling home assistant to call that input_select.select_option to use the ‘dictionary’ that is described above. So the input fo the call to home assistant is the entity_id and what state it should be in.
Hope that helps a bit more
“Dank ye well” for your patience, Erik.
It still does not work (running manually by the “play” button).
I changed it according to your comments (see below).
I tried switching the entity WakeUpCall (input_boolean.wakeupcall)
and Kaffeemaschine (switch.kaffeemaschine)
The Shortcut App says it was executed successfully, but nothing was received by Home Assistant.
I also tried:
on vs ON
In the Dictionary both entries need to be text, right?
The entity_id is the name if the input field. This is something you configure in your configuration yaml. In that configuration you set for example something like this:
input_select:
wake_up_status_erik:
name: Erik Slaap Status
options:
- Snooze
- Awoken
- Sleeping
- Unknown
initial: Unknown
icon: mdi:human-male
Once you reload the input type or restart HA you should see this input type, there should be a dropdown names input_select.wake_up_status_erik
now in the shortcut you say that you have an event that once you snooze you want a trigger.
The action you want to do is do a call to HA as in your latest screenshot. The entity_id is that input_select.xxx name and the option must be one of the options of that list you created.
Try it with something like this first, if that works you know your almost there if you want something different, just have to find out the last part.
Thank you so much!
It works!
I have used your yaml config and can see the new entity input_select.wake_up_status_erik
Accordingly I have changed the entity_id
in the dictionary to input_select.wake_up_status_erik
and the option to Sleeping
The only thing to mention is that input_select.wake_up_status_erik
cannot be selected in the shortcut.
I assume because the services are selectable, not the entities (!?)
Again, thanks for your great support!
The next part is getting the alarm time via shortcut (the next one) this is possible partially but since I use sleep cycles and no standard alarms it won’t pick that up. So if you want to do an action 15 minutes before you wake up you have to use snooze
Now you can either buy a wemos and build your bed sensor since phone charging and after 23:00 and bed occupied = sleeping. Or throw some money at it
Thanks.
I am fine with the regular alarm clock. After the shower my espresso machine is ready to go.
And I have a night mode anyway:
No motion, TV is off and it’s late evening.
Everything will be switched off and the Alarm clock state (which I use for the iPhone shortcut) to sleeping.
Mission accomplished
Thanks for these instructions!
I’m struggeling with getting this to work. I want to use sleep cycle to trigger a virtual light on/off so that I can trigger additional automations from there.
I have a Philips Hue bridge in my network that I use. And if im correct I need emulated_hue to configure a virtual light.
With the instructions I added the below yaml file to the configuration.yaml however I can’t get it to work so that I can see the virtual ‘light’ in either, sleep cycle, phillips hue or iconnecthue.
#Hue Emulator
emulated_hue:
host_ip: 192.168.178.26
listen_port: 80
expose_by_default: true
exposed_domains:
- light
entities:
light.william_sleep_lights:
name: "William sensor slaap"
light:
- platform: template
lights:
william_sleep_lights:
friendly_name: "William sensor slaap"
turn_on:
- service: input_select.select_option
data_template:
entity_id: input_select.william_status_dropdown
option: "Just Awake"
turn_off:
- service: input_select.select_option
data_template:
entity_id: input_select.william_status_dropdown
option: "Sleeping"
I tried these two to check if the emulated_hue is working properly and got these responses:
http://:80/api/v2/lights
{“2”:{“state”:{“on”:false,“reachable”:true,“mode”:“homeautomation”,“bri”:1,“hue”:0,“sat”:0,“ct”:153,“effect”:“none”,“colormode”:“ct”},“name”:“Desk L”,“uniqueid”:“00:65:54:dc:0d:41:fd:60-5c”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”},“3”:{“state”:{“on”:false,“reachable”:true,“mode”:“homeautomation”,“bri”:1,“hue”:0,“sat”:0,“ct”:153,“effect”:“none”,“colormode”:“ct”},“name”:“Couch”,“uniqueid”:“00:bf:7d:48:91:9a:fc:4d-f7”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”},“4”:{“state”:{“on”:false,“reachable”:true,“mode”:“homeautomation”,“bri”:1,“hue”:0,“sat”:0,“ct”:153,“effect”:“none”,“colormode”:“ct”},“name”:“Ceiling”,“uniqueid”:“00:26:a7:41:92:e0:b8:91-96”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”},“5”:{“state”:{“on”:false,“reachable”:true,“mode”:“homeautomation”,“bri”:1,“hue”:0,“sat”:0,“ct”:153,“effect”:“none”,“colormode”:“ct”},“name”:“Hue color pendant up 1”,“uniqueid”:“00:a0:66:90:b5:2d:4f:c9-0d”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”},“6”:{“state”:{“on”:false,“reachable”:true,“mode”:“homeautomation”,“bri”:1,“hue”:0,“sat”:0,“ct”:153,“effect”:“none”,“colormode”:“ct”},“name”:“Desk R”,“uniqueid”:“00:e1:f5:a3:da:6b:73:9e-b9”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”},“7”:{“state”:{“on”:false,“reachable”:true,“mode”:“homeautomation”,“bri”:1,“hue”:0,“sat”:0,“ct”:153,“effect”:“none”,“colormode”:“ct”},“name”:“Light strip PC”,“uniqueid”:“00:ee:05:d9:98:62:4d:67-b6”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”},“8”:{“state”:{“on”:false,“reachable”:true,“mode”:“homeautomation”,“bri”:1,“hue”:0,“sat”:0,“ct”:153,“effect”:“none”,“colormode”:“ct”},“name”:“Closet”,“uniqueid”:“00:6e:06:2a:13:8e:22:cc-90”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”},“9”:{“state”:{“on”:true,“reachable”:true,“mode”:“homeautomation”,“bri”:254,“hue”:4880,“sat”:88,“ct”:250,“effect”:“none”,“colormode”:“hs”},“name”:“Hue color pendant down 1”,“uniqueid”:“00:46:63:ef:f3:85:d3:20-6f”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”},“10”:{“state”:{“on”:false,“reachable”:true,“mode”:“homeautomation”,“bri”:1,“hue”:0,“sat”:0,“ct”:153,“effect”:“none”,“colormode”:“ct”},“name”:“Light strip TV”,“uniqueid”:“00:53:50:61:3c:a1:2c:c9-c4”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”},“11”:{“state”:{“on”:true,“reachable”:true,“mode”:“homeautomation”,“bri”:52,“hue”:7914,“sat”:68,“ct”:153,“effect”:“none”,“colormode”:“hs”},“name”:“Living room”,“uniqueid”:“00:f3:07:51:ec:68:2f:71-b0”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”},“12”:{“state”:{“on”:false,“reachable”:true,“mode”:“homeautomation”,“bri”:1,“hue”:0,“sat”:0,“ct”:153,“effect”:“none”,“colormode”:“ct”},“name”:“Office”,“uniqueid”:“00:8b:e4:da:7c:d8:5c:64-05”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”},“13”:{“state”:{“on”:false,“reachable”:true,“mode”:“homeautomation”,“bri”:1,“hue”:0,“sat”:0,“ct”:153,“effect”:“none”,“colormode”:“ct”},“name”:“Bedroom”,“uniqueid”:“00:e3:0b:dc:82:c3:17:de-17”,“manufacturername”:“Home Assistant”,“swversion”:“123”,“type”:“Extended color light”,“modelid”:“HASS231”}}
http://192.168.178.26/description.xml
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<URLBase>http://192.168.178.26:80/</URLBase>
<device>
<deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType>
<friendlyName>Home Assistant Bridge (192.168.178.26)</friendlyName>
<manufacturer>Royal Philips Electronics</manufacturer>
<manufacturerURL>http://www.philips.com</manufacturerURL>
<modelDescription>Philips hue Personal Wireless Lighting</modelDescription>
<modelName>Philips hue bridge 2015</modelName>
<modelNumber>BSB002</modelNumber>
<modelURL>http://www.meethue.com</modelURL>
<serialNumber>001788FFFE23BFC2</serialNumber>
<UDN>uuid:2f402f80-da50-11e1-9b23-001788255acc</UDN>
</device>
</root>
Can anyone spot my error(s)?
I’ve stepped away and went for the “shortcuts” easier to implement, less items in between and no need for the Hue. You need a payed account on sleepcycle for this to work too. (at least last time i checked)
If you also install shortcuts on your wife’s phone for example you can see who woke up and when. Depedending on what you need it for.
Hmm okay…
I was already using sleep cycle with payed account before starting with home assistant. So I’d actually prefer to use it.
Is there a way to get it working?
As an update, after I (somehow) failed to see the hue emulated lights in Sleep Cycle, I realized SC is now homekit capable.
I was able to create a Homekit bridge on my HA, log into it with my iphone, and then, create an automation on the iphone, which would turn the template light on (and another to off). Then selected these scenes in SC as what to trigger when going to sleep or waking up.