Home-assistant: Difference between revisions
mNo edit summary |
|||
(43 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
= Links = | = Links = | ||
*[https://www.home-assistant.io Homepage] | *[https://www.home-assistant.io Homepage] | ||
*[https://www.home-assistant.io/docs/glossary/ Home Assistant Glossary] | |||
*[https://www.home-assistant.io/docs/installation/virtualenv/ Installing in python virtual environment] (remember to pip install --upgrade pip first) | *[https://www.home-assistant.io/docs/installation/virtualenv/ Installing in python virtual environment] (remember to pip install --upgrade pip first) | ||
*[https://github.com/geekofweek/homeassistant/ a lot of examples] | *[https://github.com/geekofweek/homeassistant/ a lot of examples] | ||
Line 14: | Line 15: | ||
*[https://analytics.home-assistant.io/ Usage analytics] | *[https://analytics.home-assistant.io/ Usage analytics] | ||
*[https://data.home-assistant.io/docs/data How data is stored] | |||
*[https://www.influxdata.com/blog/getting-started-home-assistant-node-red-tutorial-influxdb/ Getting Started With Home Assistant and Node-RED ] | |||
== Home assistant and MQTT == | == Home assistant and MQTT == | ||
*[https://www.home-assistant.io/integrations/mqtt/ https://www.home-assistant.io/integrations/mqtt/] | *[https://www.home-assistant.io/integrations/mqtt/ https://www.home-assistant.io/integrations/mqtt/] | ||
*[https://data.home-assistant.io/ Home Assistant Data Science Portal] | |||
==Automations == | ==Automations == | ||
== Triggers == | == Triggers == | ||
https://www.home-assistant.io/docs/automation/trigger | |||
[https://www.home-assistant.io/docs/automation/trigger Trigger] | |||
On multiple triggers logical OR applies | On multiple triggers logical OR applies | ||
=Internal structure= | |||
==The data== | |||
https://data.home-assistant.io/docs/data/ | |||
==.homeassistant== | |||
Default location for configuration files and logs | |||
===.storage=== | |||
Cache and stuff | |||
====core.device_registry==== | |||
The devices | |||
====core.entity_registry==== | |||
The entities | |||
====trace.saved_traces==== | |||
? | |||
= Cards = | = Cards = | ||
Line 33: | Line 54: | ||
*[https://github.com/RomRider/apexcharts-card Apexcharts-card] | *[https://github.com/RomRider/apexcharts-card Apexcharts-card] | ||
=Frontends= | |||
*[https://voorkant.org/ Voorkant] | |||
= HOWTOs = | = HOWTOs = | ||
==Conbee== | |||
===Degug conbee=== | |||
+==deCONZ: Remove orphaned entries=== | |||
Orphaned how? | |||
Developer tools->Events->Listen to events: zha_event | |||
===Identify devices on conbee=== | |||
In Phoscon interface: Help->API Information: uniqueid | |||
On home-assistant: .storage/core.device_registry and .storage/core.entity_registry: look for the ID under 'deconz' | |||
==Logging== | |||
See [https://www.home-assistant.io/integrations/logger/ logger] | |||
== Add rfxtrx device == | == Add rfxtrx device == | ||
Line 63: | Line 101: | ||
name: myswitch1 | name: myswitch1 | ||
==Splitting configuration== | |||
== Including files in configuration.yaml == | https://www.home-assistant.io/docs/configuration/splitting_configuration | ||
=== Including files in configuration.yaml === | |||
group: !include groups.yaml | group: !include groups.yaml | ||
Line 88: | Line 127: | ||
template: !include templates.yaml | template: !include templates.yaml | ||
TODO CHECK THIS | |||
In templates.yaml: | In templates.yaml: | ||
Line 98: | Line 138: | ||
== Migration to mysql == | == Migration to mysql == | ||
*[https://www.srm.im/2017/06/11/home-assistant-migration-from-sqlite3-to-mariadb-mysql/ https://www.srm.im/2017/06/11/home-assistant-migration-from-sqlite3-to-mariadb-mysql/] | *[https://www.srm.im/2017/06/11/home-assistant-migration-from-sqlite3-to-mariadb-mysql/ https://www.srm.im/2017/06/11/home-assistant-migration-from-sqlite3-to-mariadb-mysql/] | ||
==Update letsencrypt cert== | |||
certbot certonly --standalone | |||
/etc/letsencrypt/live/hass.example.com/* ~hass/.homeassistant/certs/ | |||
==Conditions== | |||
===Multiple conditions=== | |||
AND by default | |||
===Sunset/sunrise=== | |||
*[https://www.home-assistant.io/docs/scripts/conditions/#sun-condition Sun condition] | |||
== Running home assistant in other python version== | |||
Install [https://github.com/pyenv/pyenv pyenv], remember to | |||
. ~/.bashrc | |||
after adding the lines as per instructions. | |||
Install dependencies, in my case | |||
apt install libbz2-dev libncurses-dev libreadline-dev libsqlite3-dev liblzma-dev libffi-dev | |||
and then | |||
pyenv install 3.12.4 | |||
global is probably better idea but for now local: | |||
pyenv local 3.12.14 | |||
# remember to make sure bin/python3 points to the right one | |||
cd homeassistant | |||
python3 -m venv . | |||
source bin/activate | |||
pip3 install --upgrade homeassistant | |||
for some reason i also needed | |||
pip3 install mysqlclient zeroconf configparser async-upnp-client | |||
== Upgrading home-assissant core== | |||
For this is, as user hass: | |||
| | ||
cd homeassistant | |||
python3 -m venv . | |||
source bin/activate | |||
#no --user in venv | |||
pip3 install --upgrade homeassistant | |||
===FAQ=== | |||
====ModuleNotFoundError: No module named 'pip'==== | |||
Check homeassistant/bin/pip | |||
= FAQ = | = FAQ = | ||
Line 115: | Line 200: | ||
Means disabled, just click on edit icon and enable it | Means disabled, just click on edit icon and enable it | ||
==Bad status line "Invalid method encountered:\n\n b'\\x16\\x03\\x01\\x02'\n== | |||
Maybe someone is trying to access the frontend via https | |||
==This entity does not have a unique ID== | ==This entity does not have a unique ID== | ||
probably means adding "entity_id: | probably means adding "entity_id: some-unique-string" | ||
Before searching more try clearing browser cache. | |||
== Error during logbook entry retrieval == | == Error during logbook entry retrieval == | ||
Line 124: | Line 212: | ||
refresh browser | refresh browser | ||
==Offset== | |||
-1:15:00 | |||
== Binary sensors == | == Binary sensors == | ||
Line 156: | Line 245: | ||
| | ||
== Find new zigbee device via conbee/deconz == | == Find new zigbee device via conbee/deconz == | ||
Assuming phoscon already found it: | Assuming phoscon already found it: Go to Developer Tools->Services and enter | ||
deconz.device_refresh | deconz.device_refresh | ||
Line 187: | Line 264: | ||
That's done by the "restart server", make sure to run "check configuration" first | That's done by the "restart server", make sure to run "check configuration" first | ||
===Where did "check configuration" go?=== | |||
Developer Tools->Services | |||
=== reload configuration from commandline === | === reload configuration from commandline === | ||
Line 222: | Line 301: | ||
| | ||
== Frontend == | == Frontend == | ||
=== Show badge only when condition met === | === Show badge only when condition met === | ||
https://community.home-assistant.io/t/conditional-badge-at-all-possible/133313/5 | |||
style: | | style: | | ||
Line 231: | Line 312: | ||
display: {% if states('sensor.motion_living_battery') | float > 90 %} none; {% endif %} | display: {% if states('sensor.motion_living_battery') | float > 90 %} none; {% endif %} | ||
} | } | ||
==Devices== | |||
===Zigbee=== | |||
====Aqacube fired event '7000'==== | |||
= Terms and meanings (or my guesses at it) = | = Terms and meanings (or my guesses at it) = | ||
Line 261: | Line 347: | ||
I found simply restarting home-assistant made this go away again | I found simply restarting home-assistant made this go away again | ||
==ZHA== | |||
[https://www.home-assistant.io/integrations/zha/ Zigbee Home Automation] | |||
Probably the best way to use zigbee now | |||
= Customizing home-assistant = | = Customizing home-assistant = | ||
Line 266: | Line 357: | ||
== Module card-mod == | == Module card-mod == | ||
[[Category:Domotics]] | |||
[[Category:Home Assistant]] |
Latest revision as of 19:27, 12 December 2024
Home assistant
Links
- Homepage
- Home Assistant Glossary
- Installing in python virtual environment (remember to pip install --upgrade pip first)
- a lot of examples
- Cookbook, more examples
- Awesome Home Assistant
Home assistant and MQTT
Automations
Triggers
On multiple triggers logical OR applies
Internal structure
The data
https://data.home-assistant.io/docs/data/
.homeassistant
Default location for configuration files and logs
.storage
Cache and stuff
core.device_registry
The devices
core.entity_registry
The entities
trace.saved_traces
?
Cards
Frontends
HOWTOs
Conbee
Degug conbee
+==deCONZ: Remove orphaned entries=== Orphaned how?
Developer tools->Events->Listen to events: zha_event
Identify devices on conbee
In Phoscon interface: Help->API Information: uniqueid On home-assistant: .storage/core.device_registry and .storage/core.entity_registry: look for the ID under 'deconz'
Logging
See logger
Add rfxtrx device
but when you don't see new switch. enable debugging in configuration.yaml:
logger: default: info logs: homeassistant.components.rfxtrx: debug
rfxtrx: device: /dev/ttyUSB0-RFX433XL debug: true
and look for
homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 1ed0732_3 Class: LightingDevice Sub: 0, Pkt_id: 0b10000101ed071303010f60)
and use the Pkt_id in your configuration:
switch: platform: rfxtrx devices: 0b10000101ed071303010f60: name: myswitch1
Splitting configuration
https://www.home-assistant.io/docs/configuration/splitting_configuration
Including files in configuration.yaml
group: !include groups.yaml
In groups.yaml:
samplegroup: name: my.samplegroup entities: - binary_sensor.one - binary_sensor.two
Automations
Using this line your automations get saved here
automation: !include automations.yaml
script: !include scripts.yaml
templates
template: !include templates.yaml
TODO CHECK THIS In templates.yaml:
- binary_sensor: name: "Is closed" state: >- {{ is_state('binary_sensor.openclose_30','on') or is_state('binary_sensor.openclose_31','on') }}
Migration to mysql
Update letsencrypt cert
certbot certonly --standalone /etc/letsencrypt/live/hass.example.com/* ~hass/.homeassistant/certs/
Conditions
Multiple conditions
AND by default
Sunset/sunrise
Running home assistant in other python version
Install pyenv, remember to
. ~/.bashrc
after adding the lines as per instructions.
Install dependencies, in my case
apt install libbz2-dev libncurses-dev libreadline-dev libsqlite3-dev liblzma-dev libffi-dev
and then
pyenv install 3.12.4
global is probably better idea but for now local:
pyenv local 3.12.14
# remember to make sure bin/python3 points to the right one cd homeassistant python3 -m venv . source bin/activate
pip3 install --upgrade homeassistant
for some reason i also needed
pip3 install mysqlclient zeroconf configparser async-upnp-client
Upgrading home-assissant core
For this is, as user hass:
cd homeassistant python3 -m venv . source bin/activate #no --user in venv pip3 install --upgrade homeassistant
FAQ
ModuleNotFoundError: No module named 'pip'
Check homeassistant/bin/pip
FAQ
The device is disabled by Config entry.
Means disabled, just click on edit icon and enable it
Bad status line "Invalid method encountered:\n\n b'\\x16\\x03\\x01\\x02'\n
Maybe someone is trying to access the frontend via https
This entity does not have a unique ID
probably means adding "entity_id: some-unique-string"
Before searching more try clearing browser cache.
Error during logbook entry retrieval
refresh browser
Offset
-1:15:00
Binary sensors
Door open or closed
on = Open
offf = Closed
In a group:
Open + Closed = Open
Platform configuration is deprecated
"platform" being used in configuration file, while the integration no longer needs that
Config error. See dev-info panel for details.
That's under "Developer tools" tab "Logs"
Find new zigbee device via conbee/deconz
Assuming phoscon already found it: Go to Developer Tools->Services and enter
deconz.device_refresh
and then look in home-assistant.log for a lines like
INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.deconz entity: sensor.temperature_20
after a while it should also show up in Configuration->Entities (TIP: here change the Entity ID to something more useful)
The name you give the device on the deconz interface will show up in HA under "Devices"
Reload configuration.yml
That's done by the "restart server", make sure to run "check configuration" first
Where did "check configuration" go?
Developer Tools->Services
reload configuration from commandline
hass --script check-config ??
Unable to open database "home-assistant_v2.db": file is encrypted or is not a database
try
sqlite3 home-assistant_v2.db
Test templates
ansible localhost -m debug -a 'msg=Template:"0.005"'
homeassistant.exceptions.HomeAssistantError: Entity id already exists
In at least one case restarting home-assistant fixed it (deconz sensor)
Unable to open the Home Assistant UI in a browser.
??
AttributeError: module 'homeassistant.util.yaml.loader' has no attribute 'Secrets'
An integration needs upgrading
UI showing "restored" in red
was re-enabled but without data (yet?)
Frontend
Show badge only when condition met
https://community.home-assistant.io/t/conditional-badge-at-all-possible/133313/5
style: | :host { display: {% if states('sensor.motion_living_battery') | float > 90 %} none; {% endif %} }
Devices
Zigbee
Aqacube fired event '7000'
Terms and meanings (or my guesses at it)
device
seems to exist only if discovered?
service
entity
a gnome?
Platform
https://developers.home-assistant.io/docs/creating_platform_index/
binary_sensor
https://esphome.io/components/binary_sensor/homeassistant.html
deconz
pydeconz.errors.Unauthorized: /lights/2/state unauthorized user
I found simply restarting home-assistant made this go away again
ZHA
Zigbee Home Automation Probably the best way to use zigbee now