Kane610 / deconz

Python library wrapping deconz rest api for home-assistant
MIT License
46 stars 17 forks source link

Feature request: expose more IKEA Starkvind functions to Home Assistant #322

Open dieugab opened 2 years ago

dieugab commented 2 years ago

As originally reported here: https://github.com/home-assistant/core/issues/74788 the IKEA Starkvind when paired through deCONZ with the deCONZ Home Assistant integration only exposes one (1) air quality sensor. deCONZ reports more clusters available, but these aren't available in Home Assistant. image

Requested features

A few examples of expected functionality from the official IKEA Home Assistant integration:

image

Additional features seeminly available through the deCONZ REST API / cluster, but also not exposed to Home Assistant:

REST API:

{
  "state" : {
    "deviceruntime" : 95750,
    "speed" : 20,
    "lastupdated" : "2022-07-09T10:00:34.289",
    "filterruntime" : 95750,
    "replacefilter" : false
  },
  "lastseen" : "2022-07-09T09:59Z",
  "ep" : 1,
  "swversion" : "1.0.033",
  "manufacturername" : "IKEA of Sweden",
  "type" : "ZHAAirPurifier",
  "uniqueid" : "cc:86:ec:ff:fe:83:25:fe-01-fc7d",
  "lastannounced" : null,
  "config" : {
    "reachable" : true,
    "locked" : false,
    "filterlifetime" : 259200,
    "ledindication" : true,
    "mode" : "auto",
    "on" : true
  },
  "modelid" : "STARKVIND Air purifier table",
  "etag" : "33e4719fd2bfe58ece3303b818ade420",
  "name" : "AirPurifier 187"
}

Screenshots from deCONZ:

image

image

image

image

Kane610 commented 2 years ago

Thanks! There are still aspects of the integration that will need refactoring before I will expand it with more features but this will definitely be added.

Crayjin commented 1 year ago

Hi there, may i humbly ask if there is any news?

Kane610 commented 1 year ago

Hi there, may i humbly ask if there is any news?

Yes. I should get back to this. :)

oywino commented 1 year ago

As listed in the changelog for deConz v2.24.1 beta a DDF was added for IKEA STARKVIND Airpurifier, also discussed here: https://github.com/dresden-elektronik/deconz-rest-plugin/pull/7248 But after updating deConz to v2.24.1 Beta, nothing new appeared in HA related to the STARKVIND. What should be expected? Does the new DDF bring anything at all?

Kane610 commented 1 year ago

As listed in the changelog for deConz v2.24.1 beta a DDF was added for IKEA STARKVIND Airpurifier, also discussed here: dresden-elektronik/deconz-rest-plugin#7248 But after updating deConz to v2.24.1 Beta, nothing new appeared in HA related to the STARKVIND. What should be expected? Does the new DDF bring anything at all?

Replacing a C definition with a DDF definition shouldn't necessarily bring more functionality, it depends on the scope of the DDF. There is also a change in a type which pydeconz does not yet support.

Can you enable debug logging in the deconz integration in home assistant and share the the output from the log so we can see all reported data for the Starkvind device?

oywino commented 1 year ago

Log enclosed. The funny thing is that it is no longer visible as a device in the deConz integration at all. There are log entries for it, but it's nowhere to be found. But before upgrading to deConz v2.24.1beta, it was at least present and visible, but only with two fairly useless entities. So i am now accessing and controlling it directly using the API. It works ok, but isn't ideal. image home-assistant_deconz_2023-10-28T17-13-56.279Z.log

Kane610 commented 1 year ago

I don't see any print from pydeconz only pydeconz.websocket, during start up of home assistant you should see the full response with all devices from deconz in debug. Its a very long print that starts with HTTP request response

I don't know if you cut out the early parts of the log because I see 2023-10-28 09:04:04.428 WARNING (MainThread) [pydeconz.models] Unsupported device type ZHAParticulateMatter which should happening just after the call.

oywino commented 1 year ago

I don't know. All I did was to enable debug logging. Then I jumped around in HA and searched for deConz entities, before disabling debug logging, at which point it cam up automatically with the result which I saved as a file and included above. Do I need to do something in particular to trigger the log entries you are requesting?

Kane610 commented 1 year ago

I don't know. All I did was to enable debug logging. Then I jumped around in HA and searched for deConz entities, before disabling debug logging, at which point it cam up automatically with the result which I saved as a file and included above. Do I need to do something in particular to trigger the log entries you are requesting?

You need to either restart home assistant after enabling debugging or reload the integration

oywino commented 1 year ago

OK, I just did a reload. Here it is. Sorry for my ignorance. home-assistant_deconz_2023-10-29T13-00-25.974Z.log

Kane610 commented 1 year ago

OK, I just did a reload. Here it is. Sorry for my ignorance. home-assistant_deconz_2023-10-29T13-00-25.974Z.log

Thanks! That's the one I needed.

Kane610 commented 1 year ago

Are these still the only expected values of the device? The more explicit definition the better for me.

Controls

Sensors

oywino commented 1 year ago

Is that a question for me to answer?

Kane610 commented 1 year ago

Is that a question for me to answer?

Anyone wanting Starkvind features exposed in home assistant :)

Crayjin commented 1 year ago

Are these still the only expected values of the device? The more explicit definition the better for me.

I do have the STARKVIND device running here too, but I'm not exactly sure what you mean. If I'm totally OT, just ignore this:

Personally, I'm missing the "Air Quality" and "Filter replacement" value in your list (Like in @oywino's screenshot), but maybe these values can be interpolated by the already listed values.

oywino commented 1 year ago

Well, at last the ones you listed pluss those listed in my picture posted above. We reminds me of my original question: What to expect from the STARKVIND DDF included in deConz v2.24.1 beta? I mean, someone did include it for a reason, right?

Crayjin commented 3 months ago

@Kane610 I know your time is limited, but are there any plans for the near future to get the missing values? Thanks in advance. :-)

Kane610 commented 3 months ago

Yes I feel a bit awkward not having done anything on this yet, I have a couple of bugs that needs to take priority and then I must do something about this :)

Kane610 commented 2 months ago

Could someone share an updated debug log from deCONZ integration so I do changes based on up to date information

Crayjin commented 2 months ago

I activated the debug logs and restarted HA. I hope this is the log you looking for.

home-assistant_2024-08-07T18-28-12.387Z.log

Kane610 commented 2 months ago

I activated the debug logs and restarted HA. I hope this is the log you looking for.

home-assistant_2024-08-07T18-28-12.387Z.log

Exactly, Thanks!

Kane610 commented 2 months ago

We reminds me of my original question: What to expect from the STARKVIND DDF included in deConz v2.24.1 beta? I mean, someone did include it for a reason, right?

I have no idea

Kane610 commented 2 months ago

So lets be clear about what should be implemented, no referencing previous posts lets build a new complete list

Controls Looking at what is controllable, I'd say these three are just one control https://dresden-elektronik.github.io/deconz-rest-doc/devices/ikea/starkvind_air_purifier/#config-attributes

Sensors

From above it would seem its only controlling the mode (off/auto/specific speed) and the filter time left that are wanted

Current list would be:

Control

Sensor

Kane610 commented 2 months ago

Personally, I'm missing the "Air Quality" and

That should already exist as entity afaik

Crayjin commented 2 months ago

I agree to your new list and yes, AQ is already available.

Btw. is there a way to change the "off" value. Currently, it will default to 65.535 and therefore is messing up the history charts.

Kane610 commented 2 months ago

Btw. is there a way to change the "off" value. Currently, it will default to 65.535 and therefore is messing up the history charts.

Which off? The mode or the device state?

Which value will become 65.535?

Crayjin commented 2 months ago

Ah sorry. I was talking about the PM25 AQ sensor. Its value defaults to 65.535 when the speed is "off".

image

Kane610 commented 2 months ago

Ok. Which setting triggers this to spike? Maybe it is a bug in deCONZ or perhaps something that can be defined in the DDF to handle?

Im trying to template all data in the integration meaning it's hard to do a lot of special cases, better to fix as close to source as possible.

Crayjin commented 2 months ago

Okay thanks. Will check the DDF.

Kane610 commented 2 months ago

Okay thanks. Will check the DDF.

Bring your observation up with deconz devs, see if it is something that they can do

Kane610 commented 2 months ago

Im considering just exposing data as is, meaning not providing a sensor calculating time left but rather one sensor with filter time and a number entity that can configure filterlifetime and then a user can create a template calculating time left, thoughts on this?

Crayjin commented 2 months ago

If the filterlifetime number entity defaults to the currently used one, that's fine with me.

Kane610 commented 2 months ago

Thanks! Id prefer not to do too much logic in entities

Kane610 commented 2 months ago

How often does the filter time data get updated? Every second?

Crayjin commented 2 months ago

Not really sure how to check this. I do have a custom sensor which is using the filterruntime value and it's getting updated almost every 15 minutes

- platform: rest resource: <sensor uri> value_template: '{{ (value_json.config.filterlifetime -value_json.state.filterruntime) | multiply(0.000694) | round(2) }}' name: ISAP - Filter Remaining Days device_class: duration unit_of_measurement: d

image

Kane610 commented 2 months ago

Well ding the polling thing doesnt eeflect how often the value updates on the websocket. You could just enable debug logging for the integration and check the logs how often it gets updated.

Kane610 commented 2 months ago

Good News is that selecting fan mode has been integrated for th release of 2024.9 release but we need to figure out the filter runtime data before that gets merged

Crayjin commented 2 months ago

home-assistant_deconz_2024-08-29T07-05-32.852Z.log Maybe this helps.

Kane610 commented 2 months ago

home-assistant_deconz_2024-08-29T07-05-32.852Z.log Maybe this helps.

Thanks! Looking at the logs the filter run time data didn't change values for 15 minutes throughout your full log.

Kane610 commented 2 months ago

Home Assistant 2024.9.0 with the fan mode select entity is now out, try it out!

Crayjin commented 2 months ago

The speed trigger is now available but I don't see the filter runtime. Is it maybe blocked due to my custom sensor, which I have not removed yet?

image

Kane610 commented 2 months ago

but I don't see the filter runtime

It is not yet merged yet, I needed to understand how often the value changed as that was inquired in the PR review. It should hopefully be ready for next release

Crayjin commented 2 months ago

Ah okay. Great work anyways! :-)

Kane610 commented 2 months ago

Ah okay. Great work anyways! :-)

Thank you!

Kane610 commented 1 month ago

Filter run time support has now been merged. Ready for 2024.10.0 release