Add Tradfri Battery sensors and air quality sensor to Starkvind air purifier

FYI, I have raised the topic of making this architectural change with the HA team here: Refactor native Tradfri integration to use a data coordinator · Discussion #699 · home-assistant/architecture · GitHub

1 Like

Just a question, what is the best way to test this?

We are currently working on adding these changes to HA. I would expect this to be available in end of February to mid March.

guess I will wait, thanks…

As of yesterday, both of these features are in the Home Assistant dev branch on Github so they will be available in the beta release on February 23, or in the release of 2022.3 on March 3.

1 Like

Great! I’ve got them in dev, and working! Congrats!!

Only thing: they are unknown if the fan is ‘off’.

Couldn’t the sensor be life always?

1 Like

The sensor returns an air quality value of 65535 when the fan is off. You probably don’t want that, and representing it as a value of 0 would also be wrong as it could lead you to believe that the air quality is perfect. Thus, we’ve disabled the value altogether in those cases.

yes, I remember that when in your CC. Couldn’t it be ‘off’ too? all those unknowns are so ugly in the frontend. And using a conditional card makes one forget about the sensor…

Can we do something with the speedlist?

speed_list:
  - 'off'
  - low
  - medium
  - high
  - Auto
preset_modes:
  - Auto
speed: low
percentage: 29
percentage_step: 2.0408163265306123
preset_mode: null
friendly_name: Huiskamer
supported_features: 9

also running the Beta in DEV and happy to see the sensors, great work!

HI GG,

just wanted to let you know I really really appreciate all the work you’ve been doing with Martin on the Tradfri integration.

Works a miracle, and practically never have an issue with it any more. Thank you very much!

Only thing we now need is actions on the motion sensors/buttons :wink: It we could use these for triggers, the integration would be complete…

hope you will import these too sometime

for now, Kudos and keep up the amazing work!

@Mariusthvdb thank you, much appreciated!

Regarding the sensors I too would happily add them. Unfortunately, IKEA don’t allow us to read their values from the gateway’s API. :frowning:

Maybe we should startup a chat and invite them :wink:

How come they can be used via the zigbee stack? We can see on/off on those motion sensors via eg Deconz and Z2m

We have communicated with them in the past. Their stance is that they will provide no support, nor any information, regarding their internal API. We are, however, free to use and explore it if we want.

thats too bad really. and completely opposed to what I remember when starting with HA. At that time, there was an issue of sorts, and I clearly recall the community here stating there had been close and immediate interaction with the Ikea devs, and things got sorted.

O well, just to be sure I ordered an extra Zigbee dongle :wink:

Yes, you’re probably referring to when they updated their password management and informed us of the change. But that was the only time. I’m using ZHA and a dongle in my fathers summer house, where there is a mix of sensors and lights. Works really well! Have tried Deconz in the same environment. Worked really poorly with constant loss of connection to nodes.

yes, (this might be getting off topic though), I have a Conbee stick and have not very positive experience with it. Now ordered a Sonof 3.0 usb dongle hoping it will fare better.

no sure how I should set it up using just the motion sensors though, as the sensors are the center of the Groups in Ikea;s App itself… And I dont want to move away from that, especially now when the integrations is so well developed :wink:

Agree, let’s close this copy/mark as answered, if possible?

Sorry if this is not the way to do so but is it possible to read the air quality sensor without using the Tradfri Hub? I am using an Electrolama zzh and can’t seem to figure it out.

Hi GG!

after updating to todays nightly there s message on the attribute speed not being available on the fans… was this taken out, or did I completely miss some earlier PR…

(didnt want to raise an issue not to embarrass myself…)
Logger: homeassistant.helpers.template
Source: helpers/template.py:1828
First occurred: 11:50:06 (11 occurrences)
Last logged: 11:55:33

Template variable warning: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'speed' when rendering '{% if states[config.entity] is not none %} {% if states[config.entity].state == 'on' %} On: {{states[config.entity].attributes.speed}} - {{states[config.entity].attributes.percentage}} {% else %} Off since {{relative_time(states[config.entity].last_changed)}} {% endif %} {% else %} Not yet set {% endif %} {% if states[config.entity] is not none %} Air quality: {% set id = states[config.entity].object_id %} {% if states('sensor.' ~ id ~ '_air_quality') in ['unknown','unavailable'] %} {% if states[config.entity].state == 'on' %} Initializing {% else %} Device not ready {% endif %} {% else %} {{states('sensor.' ~ id ~ '_air_quality')}} µg/m³ {% endif %} {% else %} Not yet set {% endif %}'

because of my frontend card:

  - type: custom:template-entity-row
# https://community.home-assistant.io/t/card-mod-add-css-styles-to-any-lovelace-card/120744/2182
    entity: fan.luchtreiniger_ella
    name: Ella
    <<: &fan
      secondary: >
        {% if states[config.entity] is not none %}
          {% if states[config.entity].state == 'on' %}
            On: {{states[config.entity].attributes.speed}} - {{states[config.entity].attributes.percentage}}
          {% else %} Off since {{relative_time(states[config.entity].last_changed)}}
          {% endif %}
        {% else %} Not yet set
        {% endif %}
        {% if states[config.entity] is not none %}
          Air quality:
          {% set id = states[config.entity].object_id %}
          {% if states('sensor.' ~ id ~ '_air_quality') in ['unknown','unavailable'] %}
            {% if states[config.entity].state == 'on' %} Initializing
            {% else %} Device not ready
            {% endif %}
          {% else %} {{states('sensor.' ~ id ~ '_air_quality')}} µg/m³
          {% endif %}
        {% else %} Not yet set
        {% endif %}

it was there before…no?