HomeAssistant#
Table of Contents
Resources#
Install procedure#
Boot the HP thin client from an Ubuntu Desktop 24.04 usb, and then follow this procedure
to install the HA-OS to the built-in SSD.
Then simply remove the USB and reboot.
You get a HomeAssistant prompt on console 1, and a root prompt on console 6 (just press enter)
The web console is available at http://192.168.2.8:8123
, first create a user.
Customization#
DSMR#
Add DSMR integration
and plug a P1 usb meter in the HP thin client. Also you can enable some initially disabled entities, like voltages and current. You can entities from this integration to the energy dashboard.
Imperial DabMan#
Add the Frontier Silicon integration, that should allow operating the Imperial DABMan internet radio.Mobile App#
Install the Mobile App integration (or was it already present after vanilla install?), anyway, you should be able to add your phone, but using the HomeAssistant app on your phone.SolarEdge#
Install the SolarEdge integration. Also add this in the energy dashboard. You do need an API key, I got that straight away as a reply on a mail to mail solar installer SolarHVT. Zie ook deze instructies
Miscellaneous#
Create an empty dashboard ("Rommel"), here you can add stuff (you cannot add stuff to the default set of dashboards)Internet access to HA#
- arrange firewalling via the raspberry pi by:
- adding one POSTROUTING rule:
iptables -t nat -A POSTROUTING -p tcp -d 192.168.2.8 --dport 8123 -j SNAT --to-source 192.168.2.19
- adding another forward rule:
iptables -A FORWARD -p tcp -d 192.168.2.8 --dport 8123 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT - add an extra nat rule to the knockd config:
- adding one POSTROUTING rule:
[options] UseSyslog [openALL] sequence = 4381, 3090, 9672 seq_timeout = 5 command = /sbin/iptables -I INPUT -s %IP% -p tcp -j ACCEPT;/sbin/iptables -t nat -A PREROUTING -p tcp --dport 8123 --source %IP% -j DNAT --to-destination 192.168.2.8:8123 tcpflags = syn [closeALL] sequence = 9672, 3090, 4381 seq_timeout = 5 command = /sbin/iptables -D INPUT -s %IP% -p tcp -j ACCEPT;/sbin/iptables -t nat -D PREROUTING -p tcp --dport 8123 --source %IP% -j DNAT --to-destination 192.168.2.8:8123 tcpflags = syn
HACS#
Install HACS
(Home Assistant Community Store
SSH access to HA host#
Enable ssh root access to the ha host
:
- basically copying your ssh public key to /root/.ssh/authorized_keys. The root console is on serial console 6, just enter root, not password is asked. Then I used the ha webterminal to copy/paste my public key to a file called "aap", did a find / -name aap, and found out which actual from the host file system it was, then simply copy the contents: cat aap >/root/.ssh/authorized_keys.
- Then the DropBear ssh daemon needs to be enabled/started: systemctl start dropbear && systemctl enable dropbear
- You can then ssh from your workstation to ha with ssh root@192.168.2.8, and ther you are :-)
BOSH EasyControl Thermostat#
This github
seems outdated, and has dead links.BOSCH SHC
, I think you need a smart home controller for that, which I don't have.But this home-assistant-bosch-custom-component
works. Follow the installation steps, which require you to enter the serial number, access-code/token, and the password, the first 2 can be found on the back of the thermostat, the last is what you configure when installing the thermostat.I did run into issue 484
, stating that the latest (05.04.00) thermostat firmware wasn't supported, but I installed the custom github repo
(mentioned in that issue).
Telegram#
See instructions
.
Got to Telegram BotFather, create a new bot and note/save the bot token and name. Configure those in the below yaml.
Add this one to configuration.yaml (using the File Editor):
# Telegram Bot
telegram_bot:
- platform: polling
api_key: "<redacted>"
allowed_chat_ids:
- <redacted>
- <redacted>
# Notifier
notify:
- platform: telegram
name: "harry"
chat_id: <redacted>
- platform: telegram
name: "group"
chat_id: <redacted>
Restart HA, and go to HA Developer Tools actions, and send the following action:
action: notify.group data: message: Yay! A message from Home Assistant.That should give you a message in Telegram.
Backup#
HA provides it's own backup system, you can configure it with the UI (settings, system, backup). I set it to twice a week with 5 versions, only local backup.
Then I arranged a poor man's remote backup by scheduling scp from my raspberry pi using crontab. I first arranged an ssh keypair and added the public key to ha's root authorized_keys file. crontab:
15 1 * * 1,3 ubuntu scp -i /home/ubuntu/.ssh/ha_rsa -P 22222 root@192.168.2.8:/mnt/data/supervisor/backup/* /home/ubuntu/ha-backups 2>/tmp/ha-backup.err 1>/tmp/ha-backup.out
15 2 * * 1,3 ubuntu find /home/ubuntu/ha-backups -type f -mtime +7 -exec rm {} \; 2>/tmp/ha-backup-clean.err 1>/tmp/ha-backup-clean.out
klikaan klikuit (ics2000)#
The lights in my house are operated with klik-aan klik-uit, using an ics2000 controller.There is this ics2000-hass custom integration
.Copy the suggested yaml configuration with MAC, mail and password.
Then you can add a "light" card to your dashboard.
zaptec charger#
I have a zaptec go charger. There is a nice integration available via HACS, you can just add it, provide your login/password, and you get a ton of entities.Tibber#
There is also a good Tibber integration, simply add it, fill in your token from https://developer.tibber.com/settings/access-token
, and again you get a ton (27) entities.
GotSmart #
gotsmart
is a golang binary that reads the usb port (where the p1 meter is connected) and exposes a prometheus exporter.Since I could stick this P1 usb cable only in one port, I moved it from my raspberry pi to the home assistant box, so it could be read by the DSMR integration.
To continue to have that data also in prometheus on my pi, I am now running gotsmart manually on the home assistant host.
If the machine gets rebooted, you have manually start it:
ssh -p 22222 root@192.168.2.8 # brings you to a root shell on home assistant nohup /run/gotsmart -listen-address :8082 -device /dev/ttyUSB0 2>&1 >/run/gotsmart.log & # starts gotsmart
Prometheus exporter#
Since my raspberry pi can now no longer use my P1 meter because it is allocated by home assistant, I decided to check the prometheus exporter to see if we can get P1 meter stats from ha to prometheus (running on my Pi).See the Prometheus integration
for details, and this one for some more documentation
I use the following yaml part in configuration.yml:
# Prometheus exporter config:
prometheus:
requires_auth: false
filter:
# include_domains:
# - sensor
include_entity_globs:
- sensor.electricity_meter_*
# exclude_entities:
# - light.kitchen_light
This still gives too many metrics:
# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation="0"} 113811.0
python_gc_objects_collected_total{generation="1"} 36147.0
python_gc_objects_collected_total{generation="2"} 2809.0
# HELP python_gc_objects_uncollectable_total Uncollectable objects found during GC
# TYPE python_gc_objects_uncollectable_total counter
python_gc_objects_uncollectable_total{generation="0"} 0.0
python_gc_objects_uncollectable_total{generation="1"} 0.0
python_gc_objects_uncollectable_total{generation="2"} 0.0
# HELP python_gc_collections_total Number of times this generation was collected
# TYPE python_gc_collections_total counter
python_gc_collections_total{generation="0"} 498.0
python_gc_collections_total{generation="1"} 45.0
python_gc_collections_total{generation="2"} 3.0
# HELP python_info Python platform information
# TYPE python_info gauge
python_info{implementation="CPython",major="3",minor="13",patchlevel="3",version="3.13.3"} 1.0
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1.006399488e+09
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 4.39803904e+08
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.75535133028e+09
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 53.76
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 69.0
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 2048.0
# HELP homeassistant_state_change_total The number of state changes
# TYPE homeassistant_state_change_total counter
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l3",friendly_name="Spanning fase L3"} 6.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l1",friendly_name="Spanning fase L1"} 7.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l2",friendly_name="Spanning fase L2"} 4.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l2",friendly_name="Stroom fase L2"} 3.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l1",friendly_name="Stroom fase L1"} 2.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l3",friendly_name="Stroom fase L3"} 2.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_energieverbruik",friendly_name="Electricity Meter Energieverbruik"} 17.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_actief_tarief",friendly_name="Electricity Meter Actief tarief"} 1.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_energieproductie",friendly_name="Electricity Meter Energieproductie"} 1.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_energieproductie_tarief_2",friendly_name="Electricity Meter Energieproductie (tarief 2)"} 1.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_energieproductie_tarief_1",friendly_name="Electricity Meter Energieproductie (tarief 1)"} 1.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_energieverbruik_tarief_2",friendly_name="Electricity Meter Energieverbruik (tarief 2)"} 1.0
homeassistant_state_change_total{domain="sensor",entity="sensor.electricity_meter_energieverbruik_tarief_1",friendly_name="Electricity Meter Energieverbruik (tarief 1)"} 17.0
# HELP homeassistant_state_change_created The number of state changes
# TYPE homeassistant_state_change_created gauge
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l3",friendly_name="Spanning fase L3"} 1.7553513569336195e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l1",friendly_name="Spanning fase L1"} 1.7553513569368577e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l2",friendly_name="Spanning fase L2"} 1.7553513569402122e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l2",friendly_name="Stroom fase L2"} 1.755351356944691e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l1",friendly_name="Stroom fase L1"} 1.7553513569461575e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l3",friendly_name="Stroom fase L3"} 1.75535135694732e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_energieverbruik",friendly_name="Electricity Meter Energieverbruik"} 1.7553513729477792e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_actief_tarief",friendly_name="Electricity Meter Actief tarief"} 1.7553513729493575e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_energieproductie",friendly_name="Electricity Meter Energieproductie"} 1.755351372957473e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_energieproductie_tarief_2",friendly_name="Electricity Meter Energieproductie (tarief 2)"} 1.7553513729585187e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_energieproductie_tarief_1",friendly_name="Electricity Meter Energieproductie (tarief 1)"} 1.7553513729605792e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_energieverbruik_tarief_2",friendly_name="Electricity Meter Energieverbruik (tarief 2)"} 1.755351372968809e+09
homeassistant_state_change_created{domain="sensor",entity="sensor.electricity_meter_energieverbruik_tarief_1",friendly_name="Electricity Meter Energieverbruik (tarief 1)"} 1.7553513729697797e+09
# HELP homeassistant_entity_available Entity is available (not in the unavailable or unknown state)
# TYPE homeassistant_entity_available gauge
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l3",friendly_name="Spanning fase L3"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l1",friendly_name="Spanning fase L1"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l2",friendly_name="Spanning fase L2"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l2",friendly_name="Stroom fase L2"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l1",friendly_name="Stroom fase L1"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l3",friendly_name="Stroom fase L3"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_energieverbruik",friendly_name="Electricity Meter Energieverbruik"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_actief_tarief",friendly_name="Electricity Meter Actief tarief"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_energieproductie",friendly_name="Electricity Meter Energieproductie"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_energieproductie_tarief_2",friendly_name="Electricity Meter Energieproductie (tarief 2)"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_energieproductie_tarief_1",friendly_name="Electricity Meter Energieproductie (tarief 1)"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_energieverbruik_tarief_2",friendly_name="Electricity Meter Energieverbruik (tarief 2)"} 1.0
homeassistant_entity_available{domain="sensor",entity="sensor.electricity_meter_energieverbruik_tarief_1",friendly_name="Electricity Meter Energieverbruik (tarief 1)"} 1.0
# HELP homeassistant_last_updated_time_seconds The last_updated timestamp
# TYPE homeassistant_last_updated_time_seconds gauge
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l3",friendly_name="Spanning fase L3"} 1.755351868937635e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l1",friendly_name="Spanning fase L1"} 1.755351837938846e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l2",friendly_name="Spanning fase L2"} 1.755351682938496e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l2",friendly_name="Stroom fase L2"} 1.755351713939222e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l1",friendly_name="Stroom fase L1"} 1.755351372973028e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l3",friendly_name="Stroom fase L3"} 1.755351372975487e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_energieverbruik",friendly_name="Electricity Meter Energieverbruik"} 1.755351868935859e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_actief_tarief",friendly_name="Electricity Meter Actief tarief"} 1.755351372945005e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_energieproductie",friendly_name="Electricity Meter Energieproductie"} 1.75535137294407e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_energieproductie_tarief_2",friendly_name="Electricity Meter Energieproductie (tarief 2)"} 1.755351372954461e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_energieproductie_tarief_1",friendly_name="Electricity Meter Energieproductie (tarief 1)"} 1.755351372953387e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_energieverbruik_tarief_2",friendly_name="Electricity Meter Energieverbruik (tarief 2)"} 1.755351372951988e+09
homeassistant_last_updated_time_seconds{domain="sensor",entity="sensor.electricity_meter_energieverbruik_tarief_1",friendly_name="Electricity Meter Energieverbruik (tarief 1)"} 1.755351868936663e+09
# HELP homeassistant_sensor_power_kw Sensor data measured in kw
# TYPE homeassistant_sensor_power_kw gauge
homeassistant_sensor_power_kw{domain="sensor",entity="sensor.electricity_meter_energieverbruik",friendly_name="Electricity Meter Energieverbruik"} 4.468
homeassistant_sensor_power_kw{domain="sensor",entity="sensor.electricity_meter_energieproductie",friendly_name="Electricity Meter Energieproductie"} 0.0
# HELP homeassistant_sensor_energy_kwh Sensor data measured in kwh
# TYPE homeassistant_sensor_energy_kwh gauge
homeassistant_sensor_energy_kwh{domain="sensor",entity="sensor.electricity_meter_energieproductie_tarief_2",friendly_name="Electricity Meter Energieproductie (tarief 2)"} 6984.759
homeassistant_sensor_energy_kwh{domain="sensor",entity="sensor.electricity_meter_energieproductie_tarief_1",friendly_name="Electricity Meter Energieproductie (tarief 1)"} 2754.947
homeassistant_sensor_energy_kwh{domain="sensor",entity="sensor.electricity_meter_energieverbruik_tarief_2",friendly_name="Electricity Meter Energieverbruik (tarief 2)"} 4519.862
homeassistant_sensor_energy_kwh{domain="sensor",entity="sensor.electricity_meter_energieverbruik_tarief_1",friendly_name="Electricity Meter Energieverbruik (tarief 1)"} 7336.473
# HELP homeassistant_sensor_voltage_v Sensor data measured in v
# TYPE homeassistant_sensor_voltage_v gauge
homeassistant_sensor_voltage_v{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l1",friendly_name="Spanning fase L1"} 233.0
homeassistant_sensor_voltage_v{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l2",friendly_name="Spanning fase L2"} 234.0
homeassistant_sensor_voltage_v{domain="sensor",entity="sensor.electricity_meter_spanning_fase_l3",friendly_name="Spanning fase L3"} 233.0
# HELP homeassistant_sensor_current_a Sensor data measured in a
# TYPE homeassistant_sensor_current_a gauge
homeassistant_sensor_current_a{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l2",friendly_name="Stroom fase L2"} 3.0
homeassistant_sensor_current_a{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l1",friendly_name="Stroom fase L1"} 8.0
homeassistant_sensor_current_a{domain="sensor",entity="sensor.electricity_meter_stroom_fase_l3",friendly_name="Stroom fase L3"} 8.0
We don't want the python_*, state_change_total, state_change_created, entity_available and last_updated_time_seconds metrics, only the real value. To achieve will use prometheus relabel config.
- job_name: home_assistant
scrape_interval: 60s
metrics_path: /api/prometheus
static_configs:
- targets: ['192.168.2.8:8123']
metric_relabel_configs:
- source_labels: [__name__]
regex: 'homeassistant_last_updated_time_seconds|homeassistant_entity_available|homeassistant_state_change_created|homeassistant_state_change_total|python_.*'
action: drop
TODO#
- maybe some SSH automation, to manage my raspberry pi?
