Files
homelab/home-assistant.md
2024-05-22 08:48:51 -04:00

84 lines
2.2 KiB
Markdown

# Home Assistant
- [Home Assistant](#home-assistant)
- [Setup and Configuration](#setup-and-configuration)
- [Cert](#cert)
- [Door Lock](#door-lock)
- [Philips Hue Lights](#philips-hue-lights)
- [Shelly](#shelly)
- [Trackers](#trackers)
- [Looping Over Entities with Labels](#looping-over-entities-with-labels)
- [Get All Entity Attributes](#get-all-entity-attributes)
## Setup and Configuration
### Cert
```bash
openssl req -sha256 -addext "subjectAltName = DNS:homeassistant.reeselink.com" -newkey rsa:4096 -nodes -keyout secrets/ha-privkey.pem -x509 -days 3650 -out secrets/ha-fullchain.pem
scp secrets/ha-* root@homeassistant.reeselink.com:~/ssl/
```
configuration.yaml
```yaml
http:
ssl_certificate: "/ssl/ha-fullchain.pem"
ssl_key: "/ssl/ha-privkey.pem"
use_x_forwarded_for: true
trusted_proxies:
- 10.1.0.0/16
```
### Door Lock
1. Install Z-wave
2. Install z-wave JS module
3. Add device -> How do you want to add your device -> Legacy Secure
4. Enter programming pin on lock -> 0
### Philips Hue Lights
1. I configure all philips hue lights through zigbee directly connected to HA
hue lights support color_temp in mireds, here are some mired-kelvin conversions:
| Kelvin | Mired |
| ------ | ----- |
| 6000 | 167 |
| 4000 | 250 |
| 2600 | 385 |
### Shelly
1. Outbound Websocket `wss://homeassistant.reeseapps.com/api/shelly/ws`
Shelly devices can act as "passive" or "active" bluetooth scanners. Both of these configurations
allow home assistant to proxy bluetooth connections through shelly devices, significantly extending
the range of your home assistant's bluetooth capabilities. Active scanning uses more power but
is quicker to pick up and transmit device information. Note that "gateway mode" is not required,
just enable bluetooth and rpc or select "active" from the configuration menu for the shelly
device.
### Trackers
See `hass_trackers/`
### Looping Over Entities with Labels
<https://www.home-assistant.io/docs/configuration/templating/#labels>
```yaml
{% for item in label_entities("Battery Level") -%}
- {{ item }}
{% endfor %}
```
### Get All Entity Attributes
```yaml
{% for item in label_entities("Battery Level") -%}
- {{ states[item].attributes }}
{% endfor %}
```