Skip to content

Commit 13f84f2

Browse files
committed
about page and HA post
1 parent 132ef99 commit 13f84f2

File tree

3 files changed

+108
-39
lines changed

3 files changed

+108
-39
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
layout: post
3+
title: "Get Homepod temperature in Home-Assistant"
4+
date: 2025-07-11 22:05:14 +0800
5+
categories: Home-Assistant
6+
---
7+
It is getting hot in here. And my AC does not support any smart home things. To save the energy for it to run for nothing, I planned to have a notification when room temperature is above 30℃.
8+
9+
I have only one temperature sensor, that is Homepod2. Hence I have two options. One, get notification from HomeKit. Two, get notification from Home-Assistant.
10+
11+
For option one, since HomeKit actually runs in the hub, which is Homepod, therefore its automation functions are limited, so is its Shortcut. And funny enough, HomeKit does not consider iPhone as a device, it cannot do anything with it. So to sum up, I cannot directly get a notification on iPhone, when temperature goes above 30℃.
12+
13+
But I noticed that Homepod Shortcut can do some web actions. This is where [Pushdeer](https://github.com/easychen/pushdeer) comes to rescue. Install the app on iPhone, register, get a key. Setup HomeKit automation, at event of temperature goes above 30℃, run Shortcut of `GET` content of `https://${PUSHDEER_API}?pushkey=${THE_KEY}&text=It%20iss%20too%20hot`.
14+
15+
This is enough for the requirement, but it may be better if there is a statics history, and not depending on external service of good will. Further more, if it could be easily extended.
16+
17+
Therefore I also setup option two, in case when I needed the hard way.
18+
19+
First of all, Homepod does not support exposing its sensors to Home-Assistant. So this solution actually is exposing a persudo switch from Home-Assistant to HomeKit. And in Home-Assistant automation, it frequently turns on and off the switch. Then HomeKit senses the change (since it knows the switch), runs a corresponding automation, which `POST` the values of sensors to another persudo sensor in Home-Assistant via webhook.
20+
21+
After this setup, we can do whatever we can do in Home-Assistant about a sensor, triggering actions, record history data, etc.
22+
23+
Now let's see the detail steps.
24+
25+
1. Install the "File editor" add-on.
26+
27+
Steps here but one can be done via WebUI. The one cannot be done at all. And since Home-Assistant may store those configurations from WebUI in different formation in different places, to make things easier and clearer, all will be IaC.
28+
29+
2. Edit configuration.yaml.
30+
31+
Although system infor says that configuration.yaml is under /config, and File editor locks its workdir in /homeassistant, actually it is the same file.
32+
33+
3. Create persudo switch. Add following code as a new section (no pre-indent).
34+
35+
```yaml
36+
input_boolean:
37+
collection_of_homekit_sensors:
38+
name: "Collector of HomeKit Sensors"
39+
```
40+
41+
4. Reload.
42+
43+
In WebUI, click the username at bottom-left to open profile page. Scroll down, seeking "Advanced mode" and turn it on.
44+
45+
Item "Developer tools" appears in navigator. Click it, there is a red "RESTART" link. Click it. If there is not a green string "Configuration will not prevent Home Assistant from starting!" showing, check the change in configuration.yaml. If it appears, click "Quick reload" in the popup.
46+
47+
5. Install the [HomeKit Bridge](https://www.home-assistant.io/integrations/homekit/) integration.
48+
49+
After the installation, there would be a QR code showing at the top-left of WebUI. Use HomeKit Add Device to scan it, following its prompt, adding other devices from Home-Assistant to HomeKit, AND the switch above.
50+
51+
6. Create automation.
52+
53+
Every 5 mins, turn on the switch, wait 5 secs, turn off the switch.
54+
55+
```yaml
56+
automation homepod:
57+
- alias: HomePod - Sensor Collection
58+
triggers:
59+
- trigger: time_pattern
60+
minutes: /5
61+
actions:
62+
- action: input_boolean.turn_on
63+
target:
64+
entity_id: input_boolean.collection_of_homekit_sensors
65+
- delay:
66+
hours: 0
67+
minutes: 0
68+
seconds: 5
69+
milliseconds: 0
70+
- action: input_boolean.turn_off
71+
target:
72+
entity_id: input_boolean.collection_of_homekit_sensors
73+
mode: single
74+
```
75+
76+
7. Create sensor.
77+
78+
```yaml
79+
template:
80+
- triggers:
81+
- trigger: webhook
82+
webhook_id: homepod-sensors
83+
allowed_methods:
84+
- POST
85+
local_only: false
86+
sensor:
87+
- name: "HomePod Temperature"
88+
state: "{{ trigger.json.temperature }}"
89+
state_class: "measurement"
90+
device_class: TEMPERATURE
91+
```
92+
93+
8. Reload.
94+
95+
9. Create HomeKit automation.
96+
97+
When "Collector of HomeKit Sensors" is on, run Shortcut.
98+
99+
In the Shortcut, first step is getting current value of temperature sensor.
100+
101+
Second step is getting number from current value. The "current value" ends with "℃", which would be treated as string in Home-Assistant, hence statics would not work and errors would be reported. And another fun thing is that, although it returns in "℃", every time I ask Homepod what is the room temperature, it says it in "℉".
102+
103+
Third step is `POST` to `http://${HOME_ASSISTANT_ADDRESS}/api/webhook/homepod-sensors`, with `JSON` body, which contains field key `temperature` and the number of former step as value.
104+
105+
Now everything is done. Give it 5 mins to update. Then in default Dashboard, the temperature would appear as the sensor value. And further more, click the value, a chart would appear.

_posts/2025-07-11-welcome-to-jekyll.markdown

Lines changed: 0 additions & 29 deletions
This file was deleted.

about.markdown

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,8 @@ title: About
44
permalink: /about/
55
---
66

7-
This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](https://jekyllrb.com/)
7+
I am a not so smart Rust programmer, a Devops engineer without large scale experience, a Linux system engineer never worked with LVS.
88

9-
You can find the source code for Minima at GitHub:
10-
[jekyll][jekyll-organization] /
11-
[minima](https://github.com/jekyll/minima)
9+
I currently have 30 cats, used to have more. But things happens, sometimes it is my fault, sometimes it is fate.
1210

13-
You can find the source code for Jekyll at GitHub:
14-
[jekyll][jekyll-organization] /
15-
[jekyll](https://github.com/jekyll/jekyll)
16-
17-
18-
[jekyll-organization]: https://github.com/jekyll
11+
I am unemployeed right now, so trying to work some Yolo thing to help identifying the ingesting situation of cats.

0 commit comments

Comments
 (0)