Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DDF for Ikea Starkvind #6118

Merged
merged 1 commit into from
Jun 7, 2022
Merged

Conversation

manup
Copy link
Member

@manup manup commented Jun 6, 2022

The device can be controlled via config.mode with the values which reflect the on device states:

"off", "auto", "speed_1", "speed_2", "speed_3", "speed_4", "speed_5"

The read-only state.speed attribute reflects the current speed as normalized number 0..100.
When the mode is changed manually with the knob the config.mode is updated automatically.

Note 1: The device target/current values might not always be in steps of 10, e.g. 10..20, 20..30, etc. in which case they are mapped to the best fitting config.mode value, so 3 → 10 aka "step_1".

Note 2: the state.airquality string values might need to be changed to better reflect the numeric values.

JSON view:

{
    "config": {
        "mode": "off",
        "on": true,
        "reachable": true
    },
    "etag": "80ae0dff37324f2582044ec71f3755ae",
    "lastannounced": null,
    "lastseen": "2022-06-06T18:08Z",
    "manufacturername": "IKEA of Sweden",
    "modelid": "STARKVIND Air purifier",
    "name": "AirQuality 234",
    "state": {
        "airquality": "excellent",
        "airqualityppb": 19,
        "lastupdated": "2022-06-06T18:09:00.681",
        "speed": 0
    },
    "swversion": "1.0.033",
    "type": "ZHAAirQuality",
    "uniqueid": "0c:43:14:ff:fe:6e:65:55-01-fc7d"
}

This PR only contains the basics to make the Ikea Starkvind controllable, other features as locking and filter monitoring should be added in future.

The device can be controlled via config.mode with the values:

"off", "auto", "speed_1", "speed_2", "speed_3", "speed_4", "speed_5"

The read only state.speed attribute reflects the current speed as normalized number 0..100.
@manup manup linked an issue Jun 6, 2022 that may be closed by this pull request
@manup manup added this to the v2.17.0-beta milestone Jun 6, 2022
@manup manup merged commit 073b74f into dresden-elektronik:master Jun 7, 2022
@ebaauw
Copy link
Collaborator

ebaauw commented Jun 10, 2022

Thanks for the PR! Moved my Starkvind over to my test network running v2.17.0-beta.

Unfortunately, I'm running into a number of issues:

  • The type is ZHAAirQuality, which is used for an Air Quality sensor. I think we need to use a different type for the air purifier, e.g. ZHAAirPurifier. It would be very different for API clients to distinguish between these device types, having to look at the presence of config.mode and state.speed.
  • Somehow state.airquality remains null, even when state.airqualitypbb is updated. I'm lost as to why. The code looks the same as for the Xiaomi Aqara TVOC sensor, and that seems to work.
  • I think state.airquality and state.airqualityppb should be null when 0xFC7D/0x0004 is 65535: the air purifier reports this when it's off and doesn't measure air aquality. If that's too hard, just expose 65534 and unknown.
  • As mentioned in IKEA Starkvind Air purifier (E2007/E3007) #5351: the air purifier measures and reports PM2.5 in µg/m³. It makes no sense to report this using state.airqualityppb, which is used for TVOC in ppb for the Aqara sensor. Also, the mapping to airquality should be different.

@kimosak
Copy link

kimosak commented Dec 27, 2022

Same here, olny sensor with airquality repors, but no control of fan etc..

@Smanar
Copy link
Collaborator

Smanar commented Dec 27, 2022

Can you take a look in the API if the control are missing ?
Using for exemple Phoscon / help/ API INformation / sensors,

@oywino
Copy link

oywino commented Dec 27, 2022

Can you take a look in the API if the control are missing ? Using for exemple Phoscon / help/ API INformation / sensors,

Cheking there, I get high activity with a large number of various events, i.e.:
image

@kimosak
Copy link

kimosak commented Dec 27, 2022

Have 2 of them there
IMG_20221227_194504
{ "config": { "filterlifetime": 259200, "ledindication": true, "locked": false, "mode": "auto", "on": true, "reachable": true }, "ep": 1, "etag": "26a76d2a36f392b14e126f931bd4256f", "lastannounced": null, "lastseen": "2022-12-27T18:43Z", "manufacturername": "IKEA of Sweden", "modelid": "STARKVIND Air purifier table", "name": "Cisticka vzduchu Ikea", "state": { "deviceruntime": 186097, "filterruntime": 186097, "lastupdated": "2022-12-27T18:44:21.552", "replacefilter": false, "speed": 20 }, "swversion": "1.1.001", "type": "ZHAAirPurifier", "uniqueid": "50:32:5f:ff:fe:b4:ab:f8-01-fc7d" }

{ "config": { "on": true, "reachable": true }, "ep": 1, "etag": "b9178a9079d6af842ee3849749397425", "lastannounced": null, "lastseen": "2022-12-27T18:45Z", "manufacturername": "IKEA of Sweden", "modelid": "STARKVIND Air purifier table", "name": "Cisticka vzduchu Ikea", "state": { "airquality": "good", "lastupdated": "2022-12-27T18:46:19.423", "pm2_5": 18 }, "swversion": "1.1.001", "type": "ZHAAirQuality", "uniqueid": "50:32:5f:ff:fe:b4:ab:f8-02-fc7d" }

@Smanar
Copy link
Collaborator

Smanar commented Dec 27, 2022

{
  "config": {
    "filterlifetime": 259200,
    "ledindication": true,
    "locked": false,
    "mode": "auto",
    "on": true,
    "reachable": true
  },
  "ep": 1,
  "etag": "26a76d2a36f392b14e126f931bd4256f",
  "lastannounced": null,
  "lastseen": "2022-12-27T18:43Z",
  "manufacturername": "IKEA of Sweden",
  "modelid": "STARKVIND Air purifier table",
  "name": "Cisticka vzduchu Ikea",
  "state": {
    "deviceruntime": 186097,
    "filterruntime": 186097,
    "lastupdated": "2022-12-27T18:44:21.552",
    "replacefilter": false,
    "speed": 20
  },
  "swversion": "1.1.001",
  "type": "ZHAAirPurifier",
  "uniqueid": "50:32:5f:ff:fe:b4:ab:f8-01-fc7d"
}

So you have some control in this one, in the "config" part

@oywino
Copy link

oywino commented Dec 27, 2022

Yes, here's mine:

{
    "config": {
        "filterlifetime": 259200,
        "ledindication": true,
        "locked": false,
        "mode": "speed_2",
        "on": true,
        "reachable": true
    },
    "ep": 1,
    "etag": "9fda7d1de6cc93397f017ee5a753fcb0",
    "lastannounced": null,
    "lastseen": "2022-12-27T20:08Z",
    "manufacturername": "IKEA of Sweden",
    "modelid": "STARKVIND Air purifier table",
    "name": "STARKVIND AirPurifier",
    "state": {
        "deviceruntime": 374,
        "filterruntime": 374,
        "lastupdated": "2022-12-27T20:08:04.062",
        "replacefilter": false,
        "speed": 40
    },
    "swversion": "1.0.033",
    "type": "ZHAAirPurifier",
    "uniqueid": "50:32:5f:ff:fe:c8:ef:45-01-fc7d"
}

Maybe I need to update mine? I see you have a more up-to-date FW than I do.

@kimosak
Copy link

kimosak commented Dec 27, 2022

Ok, there is control in config part, but still I have same issue as oywino I am not able to control it as the purifier seems to be only like sensor and switches are not available
IMG_20221227_211635
IMG_20221227_211609

@oywino
Copy link

oywino commented Dec 27, 2022

I can control STARKVIND through the REST-API, i.e.:

{
   "config":{
      "mode": "speed_3"
   }
}

The above JSON works just fine.

@kimosak
Copy link

kimosak commented Dec 27, 2022

Ok, me too but nothing is available/controllable in HA. I'm currently on latest HA 2022.12.8

@Smanar
Copy link
Collaborator

Smanar commented Dec 28, 2022

So this question concern HA not deconz.
Perhaps you can set custom widget in HA ?

@oywino
Copy link

oywino commented Dec 29, 2022

I'm not sure what custom widges is and how this can "solve these issues". I did a quick Google search for Home Assistant custom widget but it came up with nothing useful except for some Android related stuff (?)
Anyway, I'm now fully able to read all parameters and control all settings on my IKEA STARKVIND using the REST-API even though none of its entities are directly visible in HA. Here's the result of a Lovelace Card I just made:

image

@Mimiix
Copy link
Collaborator

Mimiix commented Dec 29, 2022

I'm not sure what custom widges is and how this can "solve these issues". I did a quick Google search for Home Assistant custom widget but it came up with nothing useful except for some Android related stuff (?) Anyway, I'm now fully able to read all parameters and control all settings on my IKEA STARKVIND using the REST-API even though none of its entities are directly visible in HA. Here's the result of a Lovelace Card I just made:

image

Looks very nice!

@oywino
Copy link

oywino commented Dec 29, 2022

Thanks 😊 I mistakenly believed that the "on" parameter (= true/false) is used to actually switch the whole device on/off, but that's not the case. Both the ZHAAirPurifier and the ZHAAirQuality has the config parameters on and reachable which can be read and set, but nothing seems to happen when on is set to false on either of these two sensors. Manually turning the unit off doesn't change any of the on-parameter values except that the parameter mode is set to off.
Is there a way to find out what these on parameters actually mean?

{
    "config": {
        "on": true,
        "reachable": true
}}

@ebaauw
Copy link
Collaborator

ebaauw commented Dec 29, 2022

I would want to say: see the documentation, but that's still pathetic.

config/on is read/write and used to enable/disable the sensor. This attribute was copied from the Hue API, but behaves differently. When set to false, conditions for this resource won't fire any rules. I use this to disable temporary any rules for my motion sensor to turn on the lights, while automatically closing my curtains on sunset. The motion sensor picks up the closing curtains, and I don't want my lights to turn on because of this.

config/reachable is read-only and mostly useless. deCONZ sets it to false when it doesn't receive an ACK after several attempts, when sending a unicast message to the device. When receiving a message from the device, deCONZ sets the attribute to true. Unlike its name, this attribute does not indicate whether the device is currenyly reachable. In fact, Zigbee end devices are unreachable most of the time, as they turn off their radio to preserve (battery) power.

@oywino
Copy link

oywino commented Dec 29, 2022

I would want to say: see the documentation, but that's still pathetic.

Thanks for the info. But what documentation do you refer to exactly?
"When set to false, conditions for this resource won't fire any rules." - "won't fire any rules" - does this mean; will not generate any events, thus preventing automations from being triggered? (fire=event, rule=automation ?) ..... or ?

@ebaauw
Copy link
Collaborator

ebaauw commented Dec 29, 2022

But what documentation do you refer to exactly?

https://dresden-elektronik.github.io/deconz-rest-doc/

"won't fire any rules" - does this mean; will not generate any events, thus preventing automations from being triggered?

The web socket notifications continue to happen, but deCONZ rules aren't triggered. If you use an external (to deCONZ) home automation system it's up to them to take into account the value of config/on (and I'm pretty sure they don't).

@oywino
Copy link

oywino commented Dec 30, 2022

Great. Thanks. I'm learning new tricks every day. 😊
I was unaware of the existence of "rules" and after reading about this in the Docs and listing all rules, these are what I found:

image

But I am not aware that I created any of these rules myself, and none of them seems to be related to the IKEA STARKVIND (?).
What do you make of it?

@ebaauw
Copy link
Collaborator

ebaauw commented Dec 30, 2022

I don't use Phoscon, but I know it does create rules. These seem to be for a motion sensor (PIR = passive infrared).

@oywino
Copy link

oywino commented Dec 30, 2022

I made a descriptive summary of how I finally got control over my IKEA STARKVIND from Home Assistant. In case anyone else would like to check it out - you'll find a PDF on OneDrive here:
https://1drv.ms/b/s!Aubs2beaxXQegZgTPj9vktrfeb2aBA?e=xfzZHJ

@kimosak
Copy link

kimosak commented Jan 3, 2023

@oywino could you please re-share the PDF how you manage to control Starkvind from HA? Seems like the OneDrive link is not working. Thank you!

@manup manup deleted the ikea_starkvind branch January 3, 2023 13:26
@Mimiix
Copy link
Collaborator

Mimiix commented Jan 3, 2023

@oywine Please share the files here or better: create a wiki page and a PR for the DDF :)

@oywino
Copy link

oywino commented Jan 3, 2023

@oywine Please share the files here or better: create a wiki page and a PR for the DDF :)

I did not make a DDF, I'm just using deConz as-is.
Here's the file;
How to control the IKEA STARKVIND AirPurifier via REST-API.pdf

@kimosak
Copy link

kimosak commented Jan 3, 2023

@oywino many thanks for the great manual! Works like charm!
image

@oywino
Copy link

oywino commented Jan 3, 2023

@kimosak - I'm glad you liked it 👍

@dusopn
Copy link

dusopn commented Apr 7, 2023

Hello guys, thanks for the honorable effort and the pdf document, I am experiencing the same thing, only AQ entity is exposed automatically. I would however prefer to actually understand what has happened here. Does this mean that if IKEA releases a new product which gets implemented by deconz team, I have to reinstall / reset the addon or integration? Or just delete the device from zigbee network and re-add it? I always thought this would be automatic process. I can see that as of today I still only have AQ entity exposed, but would prefer to do this the right way. Not sure why I should be doing the mentioned steps at all?

@oywino
Copy link

oywino commented Apr 9, 2023

Until someone makes a working DDF for the IKEA Air Purifier, the only way to take full advantage of its features into HA, is through the REST-API as described in the PDF doc.

@dusopn
Copy link

dusopn commented Apr 10, 2023

Ah, I see. Thanks for answer. I am not a programmer so I don't understand this very much, is there some guide to how to make ddf maybe? At least I would like to understand how this works. I have deconz addon and I can see DDF editor in deconz. I have also noticed that it seems in that part (DDF editor) there are already some settings I just dont see anything in HA.

@SwoopX
Copy link
Collaborator

SwoopX commented Apr 10, 2023

The Starkvind has a DDF and that's why the device is working via REST API.

@oywino
Copy link

oywino commented Apr 10, 2023

Ha, ha 😄 That's how much I know about these things.
Thanks for the info 👍

@dusopn
Copy link

dusopn commented Apr 10, 2023

The Starkvind has a DDF and that's why the device is working via REST API.

Except it doesn't. We only see the AQ indication, nothing else works.

@SwoopX
Copy link
Collaborator

SwoopX commented Apr 10, 2023

The Starkvind has a DDF and that's why the device is working via REST API.

Except it doesn't. We only see the AQ indication, nothing else works.

How does it look like in the API then?

@dusopn
Copy link

dusopn commented Apr 10, 2023

I can see two entries. First:

{ "config": { "on": true, "reachable": true }, "ep": 1, "etag": "6ce8d73281b7a74b97eeb2ada0233bbb", "lastannounced": null, "lastseen": "2023-04-10T11:29Z", "manufacturername": "IKEA of Sweden", "modelid": "STARKVIND Air purifier table", "name": "Air Purifier", "state": { "airquality": "good", "lastupdated": "2023-04-10T11:29:57.417", "pm2_5": 14 }, "swversion": "1.1.001", "type": "ZHAAirQuality", "uniqueid": "cc:86:ec:ff:fe:83:26:c1-02-fc7d" }

Second:

{ "config": { "filterlifetime": 259200, "ledindication": true, "locked": true, "mode": "auto", "on": true, "reachable": true }, "ep": 1, "etag": "dd2f44c1fb9dbe775ff44b209394fcf7", "lastannounced": null, "lastseen": "2023-04-10T11:31Z", "manufacturername": "IKEA of Sweden", "modelid": "STARKVIND Air purifier table", "name": "Air Purifier", "state": { "deviceruntime": 181434, "filterruntime": 181434, "lastupdated": "2023-04-10T11:31:33.791", "replacefilter": false, "speed": 20 }, "swversion": "1.1.001", "type": "ZHAAirPurifier", "uniqueid": "cc:86:ec:ff:fe:83:26:c1-01-fc7d" }

@SwoopX
Copy link
Collaborator

SwoopX commented Apr 11, 2023

So that show us deconz is offering everything it should.

@dusopn
Copy link

dusopn commented Apr 12, 2023

That's what I thought, But the device in HA doesn't see other entities just the AQ. No control or anything else. Tried restarting HA and deleting and re-adding the STARKVIND into deconz, but that did not help.

@Mimiix
Copy link
Collaborator

Mimiix commented Apr 12, 2023

Hi,

Best to discuss this on the forums, additionally, HA related stuff needs to be done in their help channels.

Locking this PR up.

@dresden-elektronik dresden-elektronik locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IKEA Starkvind Air purifier (E2007/E3007)
8 participants