Home Assistant: Difference between revisions
m Added categories and navbox |
No edit summary |
||
| Line 73: | Line 73: | ||
Now that you've added a RTSP camera to Home Assistant, you can also configure it to record | Now that you've added a RTSP camera to Home Assistant, you can also configure it to record | ||
{{Navbox Linux}} | |||
== Troubleshooting == | |||
=== Error: Only automations in automations.yaml can be deleted. === | |||
This is such an opaque error message which I somehow managed to encounter after renaming one of my automations. There was no way to delete this phantom automation from the web interface since any attempt to interact with the automation will result in this helpful error: <code>Only automations in automations.yaml can be deleted.</code> | |||
To fix this, you will have to edit the automations.yml file to contain an automation with this ID and alias name. Go to your automations page and click on the problematic automation. The URL should contain the ID number. The alias is the name of the automation. Add the following block to the automations.yml file: | |||
{{Highlight | |||
| code = - id: '1668998180437' | |||
alias: my broken automation's name | |||
description: foobar | |||
trigger: [] | |||
condition: [] | |||
action: [] | |||
mode: single | |||
| lang = terminal | |||
}} | |||
Restart Home Assistant. Go back to your automations list and you should now hopefully be able to delete the automation because it's now in the file.{{Navbox Linux}} | |||
[[Category:Linux]] | [[Category:Linux]] | ||
[[Category:LinuxUtilities]] | [[Category:LinuxUtilities]] | ||
Revision as of 07:34, 22 November 2022
Home assistant is an open source home automation platform that can run on a local server. It makes it extremely easy to integrate data from online and sensors around your home and performing some action based on the input.
Tasmota Integration
Read over the documentation at https://tasmota.github.io/docs/Home-Assistant/. However, a few things that I've constantly needed to look up are listed below.
- Relays as switches can be changed to a light entity by setting
SetOption30 1 SetOption114when set to 1 detaches the switch from its relay and sends MQTT messages insteadSetOption19when set to0enables Home Assistant auto discovery; set to1only if you want to use the device as a MQTT device. It's one or the other; the device will show up under Tasmota xor MQTT.SwitchMode#should be set to15for switches that are reading values
Tasmota switches will by default show up as binary_sensor.switch#; this is expected. Manually change the entity ID.
Tasks
Adding Tasmota devices to Home Assistant
For the most part, Tasmota devices should automatically be found once you add the MQTT integration followed by the Tasmota integration. There is nothing to configure with the Tasmota configuration, however your devices running Tasmota need to be configured with an appropriate Topic and FullTopic MQTT setting (the defaults should work!).
If your devices aren't being detected by Home Assistant, ensure that your Tasmota devices have FullTopic set to something that includes the %prefix% and %topic% variables. Eg. /tasmota/%topic%/%prefix%/. Restart the device. When the devices connects to the MQTT server, the Tasmota integration should be able to detect it.
As a side note: For read-only switch sensors (eg. PIR/alarm zones), Tasmota should be configured with SetOption114 1 and SwitchOption# 15. With this configuration, the switches should appear as a binary sensor.
Changing a Tasmota switch as a motion device
Tasmota switches with SetOption114 are detected as binary_sensors by default. For blueprints that filter based on specific device classes (Eg. motion, light bulb), you will want change the device class.
The simplest way to change an existing entity's device class is to specify a customization in configuration.yml using its entity ID:
- Make sure that you see the tasmota device and its entities. Change the entity ID as required (since they'll most likely be called
binary_sensor.sensor#). - Edit
configuration.ymland add the following lines. The key must match the entity ID set in the previous step. Specify thedevice_classto something that makes sense (motion, door, light, illuminance, etc. See: https://www.home-assistant.io/docs/configuration/customizing-devices/#device-class)
homeassistant:
customize:
binary_sensor.leosroom_pir:
friendly_name: Leo Room Movement
device_class: motion
binary_sensor.mainfloor_pir:
friendly_name: Main Floor Movement
device_class: motion
- Restart Home Assistant or reload the customizations (something that you need to enabled in your profile)
- The devices should appear with the new device class -- the icons should reflect this. If not, restart the device as well to trigger an auto discovery.
Alternatively, you can try the instructions outlined at https://blakadder.com/pir-in-tasmota/. However, this method will create another device and entity under the MQTT integration and requires injecting a couple rules into the Tasmota device. I tried to follow the instructions and was only partially successful. In the end, I resorted to the customizations in configuration.yml instead.
Setting up a reverse proxy to home assistant
In order for Home Assistant to work behind a reverse proxy, you will need to add the following to your configuration.yml file:
http:
base_url: http://assistant.example.com
use_x_forwarded_for: true
trusted_proxies:
- 127.0.0.1
- 172.18.0.0/16
Adjust the reverse proxy subnet as required. In my case, because I was running Home Assistant behind a Traefik reverse proxy on the docker subnet, I allowed the entire 172.18.0.0/16 subnet, but you can be more precise.
Adding RTSP camera feeds to home assistant
The camera integration (https://www.home-assistant.io/integrations/camera/) can be activated by adding the following to your configuration.yml file.
camera:
- platform: ffmpeg
name: frontdoor
input: -rtsp_transport tcp -i rtsp://rtsp-server/frontdoor
- platform: ffmpeg
name: street
input: -rtsp_transport tcp -i rtsp://rtsp-server/street
After adding this, you should see the RTSP streams in your Lovelace dashboard.
Now that you've added a RTSP camera to Home Assistant, you can also configure it to record
Troubleshooting
Error: Only automations in automations.yaml can be deleted.
This is such an opaque error message which I somehow managed to encounter after renaming one of my automations. There was no way to delete this phantom automation from the web interface since any attempt to interact with the automation will result in this helpful error: Only automations in automations.yaml can be deleted.
To fix this, you will have to edit the automations.yml file to contain an automation with this ID and alias name. Go to your automations page and click on the problematic automation. The URL should contain the ID number. The alias is the name of the automation. Add the following block to the automations.yml file:
- id: '1668998180437'
alias: my broken automation's name
description: foobar
trigger: []
condition: []
action: []
mode: single
Restart Home Assistant. Go back to your automations list and you should now hopefully be able to delete the automation because it's now in the file.