[APP][Pro] Home Assistant - Community App

Example of adding air quality (purifier) data to Homey as compound device

@Wesley_Witjes @Marcel_Visser

I would like to show the way to define a compound device for airpurifier or air quality details in general.

Home Assistant has another way of device definition than Homey.
The elements, HA is working with, are the entities (switch, sensor, fan…). Each entity is the base component for the Homey device you can add directly.

For example, a climate device is defined in HA as entity with a defined set of attributes, modes and services. This entity is imported as device to Homey to offer a seamless control as it would be a Homey internal device.

The HA “devices” are just a set of (independent) entities. If you don’t use special Lovelace dashboard controls, you need to add each sensor or switch as entity to your Lovelace dashboard. There you can see that they are not directly dependent to the climate/fan device.

That’s my example of a Dyson fan/heater/purifier:


You can see the climate an fan entity that can be added as Homey device.
All other entities for air quality data are differnent sensors or switches. And there will be a lot of different versions for all the purifiers of different brands.
So there is no good possibility to add these sensors into a climate/fan device.
You can add every sensor as single device to Homey and place all devices into a “room”. That would be analogous to the Lovelace dashboard adding each entity as Lovelace element.

The better way is to combine these air quality data into a compound device.

  • Search all the sensors and switched by the device name in the HA entity list
  • If you need to know the data type (numeric/char), you can list the entities in the developer view.
  • Create a compound definition, use the best fitting Homey measure type (or the generic measure_numeric for numberns or measure_generic for text)
    All possible meassure capabilities can be found in the repository description (link below).
  • If you are using a capability more than once in the capabilities list, make sure you add a subcapability id using the format “capability.subcapability”.
dyson_air:
  name: Dyson Air quality
  capabilities:
    onoff.continuous: switch.pure_hot_cool_continuous_monitoring
    onoff.night: switch.pure_hot_cool_night_mode
    measure_humidity: sensor.pure_hot_cool_humidity
    measure_temperature: sensor.pure_hot_cool_temperature
    measure_numeric.no2: sensor.pure_hot_cool_nitrogen_dioxide
    measure_numeric.pm25: sensor.pure_hot_cool_pm_2_5
    measure_numeric.pm10: sensor.pure_hot_cool_pm_10
    measure_numeric.organic: sensor.pure_hot_cool_volatile_organic_compounds
    measure_numeric.filtercarb: sensor.pure_hot_cool_carbon_filter_life
    measure_numeric.filterhepa: sensor.pure_hot_cool_hepa_filter_life
  capabilitiesTitles:
    onoff.continuous: Continuous Monitoring
    onoff.night: Night Mode
    measure_humidity: Humidity
    measure_temperature: Temperature
    measure_numeric.no2: NO2
    measure_numeric.pm25: PM 2.5
    measure_numeric.pm10: PM 10
    measure_numeric.organic: Organics
    measure_numeric.filtercarb: Filter Carbon
    measure_numeric.filterhepa: Filter Hepa

Added to Homey it looks this way:
grafik
The first uses switch is used as quick action for the tile.
The sensors are shown in device details:

If your HA entity does not provide a unit, you can set it in the YAML definition:

  capabilitiesUnits:
    measure_numeric.no2: my unit

Don’t know how to install the custom component to HA?
Here is a description:

And here you can find the component:

You can install it as file of if you are using HACS, you can just add this repository as custom component.
A direct HACS import is in work…

3 Likes