Home Assistant integrations

Home Assistant uses so-called integrations to connect devices. The integrations allow direct communication to the devices, or the connection of other gateways. As an example, for ZigBee devices there are several possibilities how to integrate them:

ZigBee integration with the ConBee 2 USB stick: 3 possible integration variants:

  1. Phoscon deCONZ (I would not recommend this)
  2. ZHA (recommended variant)
  3. Zigbee2MQTT (possible variant)

To be able to control my ZigBee devices via Home-Assistant, I use a ConBee II USB stick. Information about the setup, see: Conbee 2: Phoscon deCONZ - Docker Startup | Review. Originally I used the manufacturer software of the ConBee 2 stick: deCONZ with the graphical user interface Phoscon.

But alternatively ConBee 2 can be integrated directly into Home Assistant and as a third option via Zigbee2MQTT. With the last two variants also a cheaper ZigBee adapter, as example: CC2652 or CC1352 can be used. I used deCONZ for about one year and then changed the setup to Zigbee2MQTT, which I used for another year. When I changed from deCONZ to Zigbee2MQTT I had to reconnect the end devices. Zigbee2MQTTworks wonderfully, yet I am currently testing ZHA. There will be an update soon with my experiences with the switch and with ZHA in general. Already this much: I did not have to reconnect the devices completely.

1) ConBee 2 Manufacturer software: deCONZ / Phoscon

If you already have ConBee and Phoscon in use, you have to set the Phoscon-GW to "Connect App" as preparation for the connection of Home Assistant:

Home Assistant already reports the detected deCONZ setup via the notification:

Alternatively, the integration can also be added in the menu item configuration:

Details see, https://www.home-assistant.io/integrations/deconz/

2) Access to ConBee 2, directly from Home Assistant (Zigbee Home Automation: ZHA)

Alternatively to the connection of the ConBee stick via the deCONZ Zigbee gateway, the stick can also be integrated directly in Home Assistant. For this, Home Assistant, as well as the deCONZ container, must be started with the parameter "--device":

docker run -d --name="home-assistant" \
-v ha:/config \
-v /etc/localtime:/etc/localtime:ro \
--net=host \
--restart=always \
--device=/dev/ttyACM0 \


Devices that were previously integrated into deCONZ cannot be used at this point, they must be reconnected:

ZHA is certainly the easiest way to integrate ZigBee devices into HomeAssistant. Another alternative to deCONZ and ZHA is Zigbee2MQTT. See also: ZHA commissioning and change of Zigbee2MQTT

3) Independent solution: Zigbee2MQTT

Zigbee2MQTT is a Zigbee bridge for communication between Zigbee and a MQTT broker. The setup with Home Assistant consists of three components:

In Home-Assistant, MQTT can be added in the integrations:

See: MQTT - Broker : Docker Setup, or my complete Docker Compose setup: Zigbee2MQTT- docker-compose.yml.

Compared to Phoscon, see: Zigbee2MQTT vs deCONZ and Phoscon.

Home Assistant Community Store (HACS)

Actually I just wanted to add a RGB light to the dashboard, works but without the possibility to change the color: At this point I would have expected more. Researching and installing an integration for controlling colors took me much more time than the actual Home Assistant installation. But in return, HACS gave me the foundation for further customization. HACS is an integration to download GitHub repositories via a kind of software catalog.

I installed HACS via a command in the Docker container:

user@rechner:~$ docker exec -it home-assistant bash
bash-5.0# wget -q -O - https://install.hacs.xyz | bash -

then to Settings, Integration 

and then the installation has to be registered on GitHub, see: hacs.xyz/docs/configuration/basic

Once HACS is installed, adding additional repositories is relatively easy:

System Monitor

To monitor the operating system - on which Home Assistant runs - in a rudimentary way, additional sensors can be added in configuration.yaml, for example disk and memory:


  - platform: systemmonitor
      - type: disk_use_percent
        arg: /
      - type: disk_use_percent
        arg: /daten
      - type: memory_free    

Monitor server or Linux systems

If you want to monitor the status of other Linux systems, you can use the integration "Glances". Glances collects data about CPU, memory or the free space of a hard disk and much more. As a prerequisite, Glances must first be installed on the systems to be monitored, see also: Glances - Monitor Linux Server

Template sensor

A template sensor can be used to create sensors based on certain values, e.g. for sunrise and sunset:


  - platform: template
        friendly_name: 'Sonnenaufgang'
        value_template: >
          {{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom(' %H:%M') | replace(" 0", "") }}
        icon_template: mdi:weather-sunset-up
        friendly_name: 'Sonnenuntergang'
        value_template: >
          {{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom(' %H:%M') | replace(" 0", "") }}
        icon_template: mdi:weather-sunset-down
        friendly_name: 'Sonne'
        value_template: >
          {{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom(' %H:%M') | replace(" 0", "") }} - {{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom(' %H:%M') | replace(" 0", "") }}
        icon_template: mdi:weather-sunset-up   

Platform Integration

To determine consumption from an instantaneous value, a so-called platform integration can be used. As an example, from certain consumption values: Watts the complete consumption can be summed:

  - platform: integration
    source: sensor.waschmaschine_power
    name: waschmaschine_energy_sum
    unit_prefix: k
    unit_time: h
    round: 2  

Consumption is summed:

To relate the summed consumption back to a specific time period, the Platform Integration can be used as "utility_meter":


The utility meter uses the total consumption and divides it into specific time periods: e.g. hourly or (daily) daily:

    source: sensor.trockner_energy_sum
    name: Waschmaschine hour
    cycle: hourly  
    source: sensor.trockner_energy_sum
    name: Waschmaschine hour
    cycle: daily

Statistics Platform

The Statistics Platform can be used to represent certain historical values, as an example the sum of certain values:

  - name: rain_weather_24
    platform: statistics
    entity_id: sensor.rain_weather
    state_characteristic: sum
      hours: 24

sum_differences uses the differences between the values in a continuous counter:

  - name: powerplug_24
    platform: statistics
    entity_id: sensor.powerplug_summation_delivered
    state_characteristic: sum_differences	
      hours: 24


Since Home Assistant makes it easy to connect different systems, I use a WLAN switch in addition to ZigBee. Shelly is a small in-wall WLAN switch for controlling e.g. a power socket.

After setup, the device is automatically assigned to the default home dashboard:

Device Tracker OpenWrt

If you want to track the presence of devices via OpenWrt, you can do this with the device_tracker entry in the configuration.yaml file:

  - platform: luci
    username: root
    password: ???
    interval_seconds: 30
    consider_home: 360
       track_new_devices: true

For OpenWRT the package luci-mod-rpc is required. For information on OpenWrt, see: Alternative Router Firmware: OpenWrt and no longer DD-WRT

Alternatively, the status can also be queried via a ping:

Ping to a network device

If you want to track the presence of devices via OpenWrt using a ping, you can do this with the binary_sensor entry in the configuration.yaml file:

  - platform: ping
    name: FireTV
    scan_interval: 120

The status of the sensor is depending on the accessibility of the device: "off" or "on".

Connect MQTT devices as sensor

After adding the MQTT integration, a new sensor can be created in the configuration.yaml file:

MQTT requires an MQTT broker server, see MQTT - Broker : Docker Setup.

Adding individual sensors in the configuration.yaml file:

  - platform: mqtt
    state_topic: "flowmeter/flow"   
    name: "flowmeter"
    unit_of_measurement: "m³/h"

Services that use the MQTT broker, see:

Troubleshooting - deCONZ


In the Developer Tools, in the "EVENTS" tab you can observe which devices trigger an action, for example when pressing a button:


The configuration flow could not be loaded

Running deCONZ in Docker can cause the IP address of the deCONZ container to change on restart. Home Assistant does not use the name of the container for the connection, but its IP address, therefore the connection does not work anymore then:

The setting in the .storage/core.config_entries file then points to an incorrect IP address:

Marquee control - grayed out

I initially had the problem that my awning could only be moved in one direction.

According to Phoscon the ZigBee switch is the model FB56+CUR17SB2.2(Heiman).

Advanced mode is needed to adjust certain settings.

Settings: Customization

This allows to change certain attributes in the settings, in my case "assumed_state".

This fills the file customize.yaml as follows:

  assumed_state: true

In order for the settings to be loaded, the file still needs to be specified in configuration.yaml:

  customize: !include customize.yaml

Then still restarted the Docker container and lo and behold, now the other direction also works:

Edit data from wrong entries directly in the database.

When integrating my water meter, I changed the unit from m³/h to liters, playing wrong values into the database. The SQLite database can be read and edited via Linux board means with the command sqlite. Attention please make a backup of the database before delete or update statements are executed. First, I connect to the Docker container of Home Assistant:

docker exec -it home-assistant /bin/bash

In the Docker container, sqlite can be installed and the database can be connected with the following command:

bash-5.1# apk add sqlite
bash-5.1# sqlite3 /config/home-assistant_v2.db

Connecting to the database allows any database queries to be executed. As an example, certain entries can be output with "select" or deleted with "delete":

sqlite> select * from states where entity_id = "sensor.water_value" and last_updated < "2022-12-22 22:56:48.421279";
sqlite> delete from states where entity_id = "sensor.water_value" and last_updated < "2022-12-22 22:56:48.421279";
sqlite> delete from states where entity_id = "sensor.water_state" and state > "890100";

See also: Home Assistant SQlite - Change statistics data

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Questions / Comments

By continuing to browse the site, you agree to our use of cookies. More Details