Same as you @ChrisM1983:
In order for me to get the data and graphs to show up I had to modify the request a bit - in the body the state remained the value, however I had to add a nested “dictionary” with three values in it to get the entry to show up as an actual temperature monitor and graph the data - so my POST data looked like this:
“state” :
“attributes”:
inside this dictionary :
“unit_of_measurement” : “°C”
“device_class” : “temperature”
“state_class” : “measurement”
This worked to get the entity to show up properly (see screencaps).
Now the new problem I am having is that the automation wont run automatically based on the input boolean …
Yep, thats how I did it as well. The right classes set is important for HA to know what’s going on.
@martinblq are you sure that your state is set as a number, not as a text? The screenshot you’ve sent is not what I mean. Add a new line to your body and there you can select the type, this should be number.
See this video: iCloud Photos - Apple iCloud
Of course, don’t forget to remove the old state. And in this video, I’ve set up device class and state class also in the main body (so under state), that isn’t necessary , just in the attributes dictionary should be enough.
@th3resource you need help with the automation? You see the sensor going on and off in HomeKit, every 2 minutes or so (depending on your ha automation)?
Wow, thank you @ChrisM1983 and @th3resource!
It seems to be working now.
The temperature is displayed in the right format. However, I seem to have an issue with the humidity sensor showing 0. What’s strange is that if I manually trigger the automation on the Apple Home app, the data updates correctly on the Home Assistant side. On the other hand, if it’s triggered from the Home Assistant automation, it doesn’t work.
Do you have any idea where this could be coming from?
alias: Homekit - Sensor Collection
description: Processes temperature and humidity data from HomeKit Sensors
trigger:
- platform: time_pattern
minutes: /5
id: time
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.homekit_sensors_update
data: {}
- delay: "00:00:05"
- service: input_boolean.turn_off
target:
entity_id: input_boolean.homekit_sensors_update
data: {}
mode: single
Thank you again for your valuable help.
Thanks @ChrisM1983 - Yes I see the boolean ticking on and then off and I see the corresponding affect in apple home. The problem is for some reason it does not trigger the shortcut code - if I manually test the automation in homekit it then runs and updates. I even changed the trigger to be something else and threw in a light toggle into the shortcut to debug and came to the conclusion that the shortcut is not running at all . Any pointers would be appreciated!
Here is the Screencap of the boolean flipping in HA:
Just making sure… your HomeKit automation looks something like this, right?
And when you turn on the switch in HA (manually), do you also see it turn on in your home? It’s a switch, you should be able to see it somewhere in your Home app.
For you as well, can you send a screenshot of the first screen of the automation? Where you’ve set up the trigger?
yup! the boolean triggers in homekit accordingly - this is the screencap of the automation:
- I have done some additional stuff to the shortcut to get the data the way I want it but its just math evaluation to convert the temperature so I can’t imagine that would cause a problem with running. Like I said it works perfect if I press “test this automation” but for some reason I cant for the life of me figure out why it wont trigger in homekit
You could try creating a new one, and see if it’s in the trigger: so same trigger, but the action to do is just turn on a light or something simple.
@ChrisM1983 gave this a go - still nothing, I changed the trigger to a switch in the home and it trigger the switch but nothing happens with the automation still scratching my head.
Try it the other way around:
Create a new automation in your Home
Trigger: the HA boolean Closer collection of HomeKit sensors turn on
Action: Turn on a light
Does it turn on the light?
Interesting! I create a whole new automation with the HA boolean to trigger the turning on of another switch and the action does in fact work - I hear the switch turning on every 2 minutes. But if I change the action back to the shortcut - no dice, doesn’t trigger - i added the switch toggle to the end of the shortcut and it never turns on. That means there must be something about the script that is causing it to fail when running …
Maybe I am missing something - The automation runs if I do it manually from either my phone or macbook - however it can’t seem to run on its own through automation- My home hub is an apple TV 4k… are there perhaps shortcut actions that the hub cant run that device can? I am doing more than the read and post as I do a little math to convert temperature reading from C to F all inside the shortcut.
OK! made some progress - it was indeed the math I was doing on the data before writing it to HA all in the homekit automation! I removed everything to back to the barebones pull data in Celcius and it worked perfect! I will just go ahead and do the math inside HA to get it where I want Thanks for all the tips and help @ChrisM1983 !!
I’m encountering the same problem (excepts it returns me 1 and not 0 for the relative humidity). Have you managed to solve this ?
Do you have some screenshots?
Show the sensor info in the developer tools.
Sometimes, the HomePod Mini resets the shortcut script. I don’t understand why, but if the returned value for temperature and humidity is null (zero), it’s due to the shortcut defined in the HomePod Mini. Be careful to verify the returned value of the temperature and humidity.
I can confirm this. Also, the HomePod’s temperature and humidity values are completely unusable if you want to use them for controlling your heating. The values are almost never correct and always influenced by the HomePod’s own heat that it produces even if it is idle. Apple itself says, that the values are more or less informal only and influenced from the heat that the unit produces. I don’t understand that a company like Apple produces such a fine BS.
This never happened to me. Only once my HomePod mini didn’t give new sensor readings… and after trying everything, I noticed my wife pulled out the plug.
I also disagree… my HomePod minis actually give pretty similar temperature readings compared to other sensors in the same room. You could always add an offset to the homekit automation, so if you know the temperature is always 1 degree too high, just decrease the temperature that you send to HA with 1 degree.
For me, it’s fine.
I do notice that the humidity sensor doesn’t change as quickly as other humidity sensors, though, I’ll give you that. especially when showering, I see my other sensors noticing the increase in humidity much quicker, and also more extreme.