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[edit | edit source]

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
  • SetOption114 when set to 1 detaches the switch from its relay and sends MQTT messages instead
  • SetOption19 when set to 0 enables Home Assistant auto discovery; set to 1 only 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 to 15 for 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[edit | edit source]

Adding Tasmota devices to Home Assistant[edit | edit source]

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[edit | edit source]

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:

  1. 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#).
  2. Edit configuration.yml and add the following lines. The key must match the entity ID set in the previous step. Specify the device_class to 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
  1. Restart Home Assistant or reload the customizations (something that you need to enabled in your profile)
  2. 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[edit | edit source]

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[edit | edit source]

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