etheralm / libpurecool

Python library for dyson devices.
Other
67 stars 30 forks source link

US "Dyson Pure Hot+Cool™ HP04 purifying heater + fan" not recognized #4

Closed docBliny closed 4 years ago

docBliny commented 5 years ago

The US version of the HP04 fan has a ProductType of 527, but the current logic and constants in https://github.com/etheralm/libpurecool/blob/master/libpurecool/const.py prevent it from being accepted as a valid device.

Calling the v2 API at https://api.cp.dyson.com/v2/provisioningservice/manifest returns the following (sanitized) response:

[
    {
        "Serial": "ZZ4-US-XXXXXXXX",
        "Name": "Office",
        "Version": "ECG2PF.30.01.003.0012",
        "LocalCredentials": "[snip]",
        "AutoUpdate": true,
        "NewVersionAvailable": false,
        "ProductType": "527",
        "ConnectionType": "mqtts"
    }
]

I was hoping the 0.93.0 version of Home Assistant that pulled in this library would have finally worked with my Dyson, but turns out the above prevents it from being available. Manually hacking the code on the instance got it to show up and based on a quick test everything works.

EDIT: On further investigation, this would need to be a new device type since it supports heating.

adzero commented 5 years ago

Same problem here, with the same model in Europe.

[
    {
        "Serial": "A1A-EU-XXXXXXXX",
        "Name": "Chambre",
        "Version": "ECG2PF.30.01.003.0012",
        "LocalCredentials": "[something]",
        "AutoUpdate": true,
        "NewVersionAvailable": false,
        "ProductType": "527",
                "ConnectionType": "mqtts"
    }
]
etheralm commented 5 years ago

Hey guys sorry long vacation, but I'm back. I can try to add support for those fans, but I'll need your help, since I don't have that model.

adzero commented 5 years ago

Hey.

Let me know how I can help you.

Parlane commented 5 years ago

I have created a pull request ( #5 ) for this issue, it really looks like the original Libpurecoollink project is dead. So I was very glad to find this one :)

khzd commented 4 years ago

Hi, I have also a HP04 to integrate in HA :)

Calling the v2 API at https://api.cp.dyson.com/v2/provisioningservice/manifest returns the following (sanitized) response: [{"Serial":"A1A-EU-XXXXXXXX", "Name":"Salon", "Version":"ECG2PF.30.06.002.0001", "LocalCredentials":"XXX", "AutoUpdate":true, "NewVersionAvailable":false, "ProductType":"527", "ConnectionType":"wss"}]

as mentioned the current lib release dosent manage product code 527. May I contribute? How can i join test team ? Cheers

etheralm commented 4 years ago

Ok I think did all the changes needed to add support for HP04.

Since I don't have this model it would be really nice if someone that does can test it. I wrote a small script to test all the functions.

Following are the instructions how to run it:

Clone the repo: git clone git@github.com:etheralm/libpurecool.git

Switch to the branch that contains the changes: git checkout new_hot_cool

Install all the needed dependencies: pip install -r requirements.txt

Open the test.py file in the root folder and change <email> and <password> with your dyson account details.

Run the script: python test.py

Note: The first thing the script will do will be to list all the devices connected to your dyson account. If you have more than 1 dyson device on it, make sure that the first device listed is an HP04 fan (it will be listed as DysonPureHotCool). If its not, note the device number of the HP04 and change DEVICE_NUM in test.py to the number corresponding to that fan.

The script will call all functions of the fan with pauses of 10 seconds between each call. Please make sure that it is actually doing the stated operation and let me know if it isn't.

Post the output of the log here (don't forget to remove any personal information like device serial numbers and ip addresses!).

If everything works fine. I'll merge the changes and release a new version. After that I can start working on a PR to add support for it in home assistant.

Cheers.

brott8 commented 4 years ago

For me, the device is found, but the auto_connect method is hanging. Note that I am currently using Parlene's mod, and calling the device by IP. Not sure if this is a "me" problem or not.

(cool) [me@me libpurecool]$ python test.py device #0: DysonPureHotCool(serial=<serial>,active=None,name=<name>,version=ECG2PF.30.06.002.0001,auto_update=True,new_version_available=False,product_type=527,network_device=None) ^CTraceback (most recent call last): File "test.py", line 41, in <module> connected = devices[DEVICE_NUM].auto_connect() File "/libpurecool/libpurecool/libpurecool/dyson_pure_cool_link.py", line 138, in auto_connect return self._mqtt_connect() File "/libpurecool/libpurecool/libpurecool/dyson_pure_cool_link.py", line 170, in _mqtt_connect self._state_data_available.get() File "/usr/lib/python3.7/queue.py", line 170, in get self.not_empty.wait() File "/usr/lib/python3.7/threading.py", line 296, in wait waiter.acquire() KeyboardInterrupt ^CException ignored in: <module 'threading' from '/usr/lib/python3.7/threading.py'> Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 1308, in _shutdown lock.acquire() KeyboardInterrupt

etheralm commented 4 years ago

Can you try to change the script to manually connect by replacing line 41 in test.py with: connected = devices[DEVICE_NUM].connect("<ip of fan>")

brott8 commented 4 years ago

Same problem. I thought it might have been the country code (GB in the test.py, while I'm in AU), but same thing. It hangs with the same error message as above.

etheralm commented 4 years ago

Just a quick question, do you have the lib with Parlane's modifications running on the same pc at the same time, this may cause some issues.

If not then there may be some issue with my changes I'll have a look.

brott8 commented 4 years ago

Actually, I'm running this from a machine without hass installed. Is that an issue? It is a separate machine from where I am using Parlene's changes. It's also in a virtualenv.

etheralm commented 4 years ago

Not an issue at all, just wanted to check if there isn't another instance of the lib already connected to the fan on the same machine.

I'll have a look at the code and see if I haven't missed something. Thanks for testing it.

FutureGUIs commented 4 years ago

I can confirm similar results to @brott8, and my regular hp02 devices seem to connect and send/get data just fine from the logging I see, but my hp04 doesn't even connect, even trying to manually connect using its IP address... I get no logging either with the hp04

etheralm commented 4 years ago

Can you pull the latest changes from that branch and run the test script again. It should log a line similar to this one before it hangs: State payload: {"msg":"CURRENT-STATE",...,"product-state":... Looks like some of the state property names changed in this model...

FutureGUIs commented 4 years ago

Here's that logging now: State payload: {"msg":"CURRENT-STATE","time":"2019-12-09T16:45:17.000Z","mode-reason":"LAPP","state-reason":"MODE","rssi":"-66","channel":"149","fqhp":"91328","fghp":"0","product-state":{"fpwr":"OFF","auto":"ON","oscs":"OFF","oson":"OFF","nmod":"ON","rhtm":"ON","fnst":"OFF","ercd":"31U2","wacd":"NONE","nmdv":"0004","fnsp":"AUTO","bril":"0002","corf":"OFF","cflr":"0100","hflr":"0100","cflt":"CARF","hflt":"GHEP","sltm":"OFF","osal":"0135","osau":"0225","ancp":"0090","hmod":"HEAT","hmax":"2932","tilt":"OK","hsta":"OFF","psta":"OFF","fdir":"ON"},"scheduler":{"srsc":"000000005dec6e83","dstv":"0001","tzid":"0001"}}

etheralm commented 4 years ago

Ok as I suspected, this model doesn't have focus mode. Should work now with the latest commit.

Just to be thorough, I've added a line that logs the environment state payload that comes from the fan to see if they haven't changed anything there. Can you please pull the latest changes, run the test script and paste the line here that starts with: Environment state payload:

Keep in mind that this will spam a log message every few seconds, after we verify that the environment state is also ok, I'll remove it and you can run the rest of the tests.

FutureGUIs commented 4 years ago

Here's the logging so far:

Environment state payload: {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2019-12-09T17:58:06.000Z","data":{"tact":"2941","hact":"0050","pm25":"0000","pm10":"0000","va10":"0003","noxl":"0001","p25r":"0001","p10r":"0001","sltm":"OFF"}} device connected: True device state: DysonPureHotCoolV2State(fan_power=OFF,front_direction=ON,auto_mode=ON,oscillation_status=OFF,oscillation=OFF,night_mode=ON,continuous_monitoring=ON,fan_state=OFF,night_mode_speed=0004,speed=AUTO,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0135,oscillation_angle_high=0225,tilt=OK,heat_mode=HEAT,heat_target=2932,heat_state=OFF) Turning off device... Environment state payload: {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2019-12-09T17:58:06.000Z","data":{"tact":"2941","hact":"0050","pm25":"0000","pm10":"0000","va10":"0003","noxl":"0001","p25r":"0001","p10r":"0001","sltm":"OFF"}} DysonEnvironmentalSensorV2State(temperature=294.1,humidity=50,particulate_matter_25=0,particulate_matter_10=0,volatile_organic_compounds=3,nitrogen_dioxide=1,p25r=1,p10r=1,sleep_timer=0) DysonPureHotCoolV2State(fan_power=OFF,front_direction=ON,auto_mode=ON,oscillation_status=OFF,oscillation=OFF,night_mode=ON,continuous_monitoring=ON,fan_state=OFF,night_mode_speed=0004,speed=AUTO,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0135,oscillation_angle_high=0225,tilt=OK,heat_mode=HEAT,heat_target=2932,heat_state=OFF) Turning on device... DysonPureHotCoolV2State(fan_power=ON,front_direction=ON,auto_mode=ON,oscillation_status=OFF,oscillation=OFF,night_mode=ON,continuous_monitoring=ON,fan_state=OFF,night_mode_speed=0004,speed=AUTO,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0135,oscillation_angle_high=0225,tilt=OK,heat_mode=HEAT,heat_target=2932,heat_state=OFF) Enabling oscillation... DysonPureHotCoolV2State(fan_power=ON,front_direction=ON,auto_mode=ON,oscillation_status=ON,oscillation=OION,night_mode=ON,continuous_monitoring=ON,fan_state=OFF,night_mode_speed=0004,speed=AUTO,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0090,oscillation_angle_high=0180,tilt=OK,heat_mode=HEAT,heat_target=2932,heat_state=OFF) Environment state payload: {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2019-12-09T17:58:36.000Z","data":{"tact":"2950","hact":"0048","pm25":"0001","pm10":"0000","va10":"0003","noxl":"0000","p25r":"0002","p10r":"0002","sltm":"OFF"}} Disabling oscillation... DysonPureHotCoolV2State(fan_power=ON,front_direction=ON,auto_mode=ON,oscillation_status=OFF,oscillation=OIOF,night_mode=ON,continuous_monitoring=ON,fan_state=OFF,night_mode_speed=0004,speed=AUTO,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0090,oscillation_angle_high=0180,tilt=OK,heat_mode=HEAT,heat_target=2932,heat_state=OFF) Enabling sleep timer... DysonPureHotCoolV2State(fan_power=ON,front_direction=ON,auto_mode=ON,oscillation_status=OFF,oscillation=OIOF,night_mode=ON,continuous_monitoring=ON,fan_state=OFF,night_mode_speed=0004,speed=AUTO,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=0100,oscillation_angle_low=0090,oscillation_angle_high=0180,tilt=OK,heat_mode=HEAT,heat_target=2932,heat_state=OFF) Disabling sleep timer... DysonPureHotCoolV2State(fan_power=ON,front_direction=ON,auto_mode=ON,oscillation_status=OFF,oscillation=OIOF,night_mode=ON,continuous_monitoring=ON,fan_state=OFF,night_mode_speed=0004,speed=AUTO,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0090,oscillation_angle_high=0180,tilt=OK,heat_mode=HEAT,heat_target=2932,heat_state=OFF) Setting fan speed... Environment state payload: {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2019-12-09T17:59:06.000Z","data":{"tact":"2950","hact":"0048","pm25":"0001","pm10":"0001","va10":"0003","noxl":"0000","p25r":"0002","p10r":"0002","sltm":"OFF"}} DysonPureHotCoolV2State(fan_power=ON,front_direction=ON,auto_mode=OFF,oscillation_status=OFF,oscillation=OIOF,night_mode=ON,continuous_monitoring=ON,fan_state=FAN,night_mode_speed=0004,speed=0010,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0090,oscillation_angle_high=0180,tilt=OK,heat_mode=HEAT,heat_target=2932,heat_state=OFF) Enabling frontal direction... DysonPureHotCoolV2State(fan_power=ON,front_direction=ON,auto_mode=OFF,oscillation_status=OFF,oscillation=OIOF,night_mode=ON,continuous_monitoring=ON,fan_state=FAN,night_mode_speed=0004,speed=0010,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0090,oscillation_angle_high=0180,tilt=OK,heat_mode=HEAT,heat_target=2932,heat_state=OFF) Disabling frontal direction... DysonPureHotCoolV2State(fan_power=ON,front_direction=OFF,auto_mode=OFF,oscillation_status=OFF,oscillation=OIOF,night_mode=ON,continuous_monitoring=ON,fan_state=FAN,night_mode_speed=0004,speed=0010,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0090,oscillation_angle_high=0180,tilt=OK,heat_mode=OFF,heat_target=2932,heat_state=OFF) Environment state payload: {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2019-12-09T17:59:36.000Z","data":{"tact":"2948","hact":"0048","pm25":"0001","pm10":"0000","va10":"0003","noxl":"0002","p25r":"0002","p10r":"0002","sltm":"OFF"}} Enabling auto mode... DysonPureHotCoolV2State(fan_power=ON,front_direction=OFF,auto_mode=ON,oscillation_status=OFF,oscillation=OIOF,night_mode=ON,continuous_monitoring=ON,fan_state=OFF,night_mode_speed=0004,speed=AUTO,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0090,oscillation_angle_high=0180,tilt=OK,heat_mode=OFF,heat_target=2932,heat_state=OFF) Disabling auto mode... DysonPureHotCoolV2State(fan_power=ON,front_direction=OFF,auto_mode=OFF,oscillation_status=OFF,oscillation=OIOF,night_mode=ON,continuous_monitoring=ON,fan_state=FAN,night_mode_speed=0004,speed=0010,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0090,oscillation_angle_high=0180,tilt=OK,heat_mode=OFF,heat_target=2932,heat_state=OFF) Enabling night mode... DysonPureHotCoolV2State(fan_power=ON,front_direction=OFF,auto_mode=OFF,oscillation_status=OFF,oscillation=OIOF,night_mode=ON,continuous_monitoring=ON,fan_state=FAN,night_mode_speed=0004,speed=0010,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0090,oscillation_angle_high=0180,tilt=OK,heat_mode=OFF,heat_target=2932,heat_state=OFF) Environment state payload: {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2019-12-09T18:00:06.000Z","data":{"tact":"2946","hact":"0048","pm25":"0003","pm10":"0002","va10":"0003","noxl":"0007","p25r":"0003","p10r":"0004","sltm":"OFF"}} Disabling night mode... DysonPureHotCoolV2State(fan_power=ON,front_direction=OFF,auto_mode=OFF,oscillation_status=OFF,oscillation=OIOF,night_mode=OFF,continuous_monitoring=ON,fan_state=FAN,night_mode_speed=0004,speed=0010,carbon_filter_state=0100,hepa_filter_state=0100,sleep_timer=OFF,oscillation_angle_low=0090,oscillation_angle_high=0180,tilt=OK,heat_mode=OFF,heat_target=2932,heat_state=OFF) Enabling heating mode... Traceback (most recent call last): File "test.py", line 114, in <module> device.enable_heat_mode() File "C:\github\libpurecool\libpurecool\dyson_pure_hotcool.py", line 47, in enable_heat_mode self.set_fan_configuration(data) File "C:\github\libpurecool\libpurecool\dyson_pure_cool_link.py", line 216, in set_fan_configuration self._mqtt.publish(self.command_topic, json.dumps(payload), 1) File "C:\Python38-32\lib\json\__init__.py", line 231, in dumps return _default_encoder.encode(obj) File "C:\Python38-32\lib\json\encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "C:\Python38-32\lib\json\encoder.py", line 257, in iterencode return _iterencode(o, 0) File "C:\Python38-32\lib\json\encoder.py", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type HeatMode is not JSON serializable

etheralm commented 4 years ago

Thank you.

Looks great so far there are no new or renamed properties in the environment state message.

I've removed the debug logging of the state message and updated the test.py script. Can you pull the latest changes, run the script and verify that the fan is executing all the operations that the script is logging.

FutureGUIs commented 4 years ago

getting an error setting heat mode:

Enabling heating mode... Traceback (most recent call last): File "test.py", line 114, in <module> device.enable_heat_mode() File "C:\github\libpurecool\libpurecool\dyson_pure_hotcool.py", line 47, in enable_heat_mode self.set_fan_configuration(data) File "C:\github\libpurecool\libpurecool\dyson_pure_cool_link.py", line 215, in set_fan_configuration self._mqtt.publish(self.command_topic, json.dumps(payload), 1) File "C:\Python38-32\lib\json\__init__.py", line 231, in dumps return _default_encoder.encode(obj) File "C:\Python38-32\lib\json\encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "C:\Python38-32\lib\json\encoder.py", line 257, in iterencode return _iterencode(o, 0) File "C:\Python38-32\lib\json\encoder.py", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type HeatMode is not JSON serializable

etheralm commented 4 years ago

Good catch!

Should be fixed. Can you please pull and run it again.

FutureGUIs commented 4 years ago

All tests are functioning and is giving status back nicely :)

etheralm commented 4 years ago

Awesome . I'll put a new version up tomorrow and then I'll have a look at the home assistant integration.

Thanks for testing.

brott8 commented 4 years ago

Worked for me too! Well done, thanks etheralm for your work.

etheralm commented 4 years ago

Ok guys, I just added all tests, merged the branch to master and pushed a new version to pypi. Thank you for helping out.

Now what's left is to add support for it in home assistant. I'll try to work on that next week. You can track the progress here: https://github.com/etheralm/home-assistant/tree/dyson_new_pure_hotcool

FutureGUIs commented 4 years ago

Hi, any updates on getting the HA support updated? Or would it be possible to list out what needs to get done so maybe one of us can work it out to get it going? Thanks.

etheralm commented 4 years ago

I was on vacation until today, sorry about that. I have some free time tomorrow, so I'll try to get something working until the end of the week.

Otherwise if someone else wants to have a go at it, the climate component of the dyson integration in HA has to be updated more or less the same way the fan component was updated for the TP04 model.

etheralm commented 4 years ago

@FutureGUIs I just pushed an initial test version of the HA climate component in this branch: https://github.com/etheralm/home-assistant/tree/dyson_new_pure_hotcool

Can you please test it by adding the climate.py file from here as a custom component in HA. Let me know if your fan shows up in home assistant afterwards.

docBliny commented 4 years ago

@etheralm I did a quick test by copying the whole dyson folder from your test branch into my HA custom_components, and my unit was found after the HA server restart.

I'm seeing the Dyson show up as a climate device, fan, temperature sensor, air quality sensor, and humidity sensor. Changing the desired heat set point is also reflected on the unit and toggling between heat and cool works (which you can't do via the Dyson app!).

I also finally get Celsius (in HA) since the stupid thing won't let you select your units (and support originally told me that that's all you get since it's a USA unit with US firmware...).

I was able to toggle oscillation and night mode via the dev tools succesfully.

Thanks so much for all the effort! This will finally make my unit useful as I can automate it like I had originally intended.

Edit: The one thing I don't see if on/off in the climate card. I'm assuming that's because it's in the fan component and not the climate component?

FutureGUIs commented 4 years ago

I can confirm that all is functioning well for me too. Thank you so much!

And following up on @docBliny edit, I was wondering why the Dyson units don't show off/auto settings as well?

troykelly commented 4 years ago

Seems to be working well - but AQI == nitrogen dioxide. Is that expected?

Screen Shot 2020-01-10 at 1 38 23 pm
docBliny commented 4 years ago

@troykelly I wonder if it's just showing the highest value as I see the following (VOC=4, AQI=4): image

troykelly commented 4 years ago

That sounds like it could be correct @docBliny I will keep an eye out and see. It seems Dyson have invented their own "AQI" given the readings from the machine never match actual API - this is a sensor in the same room about 2m away from the Dyson. While the Dyson shows 12 the actual readings are...

Screen Shot 2020-01-10 at 2 26 52 pm
brott8 commented 4 years ago

Added your climate control in. The plus side is that I am now getting readings on the fan for all settings. I can also successfully set speed. The down side is that as per docBliny's edit, "off" does not show in the climate card anymore (whereas before, it did - at least with Parlane's patch).

@docBliny , I believe AQI should be max of the four sensors (NO2, VOC, pm2.5, pm10). Though the code seems to set it to VOC.

EDIT: My sensors don't appear to work (with the exception of humidity and temperature). I am using a hacked together version, so I'll try reverting it to your clean version later tonight. Thanks!

EDIT 2: I have the humdity and temperature sensors. Air quality shows up as an entity. Though I'm missing the dust and filter life sensors which I had before. Additionally, the NO2, VOC, PM2.5, and PM10 are wrapped under the air quality entity. Would it be possible to expose all sensors individually?

PxUnderscore commented 4 years ago

I would like to test this, with my EU version of the fan. Can anyone guide me through getting the custom component to work? I added the files, but when adding credentials etc. in the configurations.yaml file, it's still not showing up.

brott8 commented 4 years ago

@Kanonkaj , copy the files to custom_components/dyson . Then set up your config like this:

dyson:
  username: <email>
  password: <pwd>
  language: GB
  devices:
    - device_id: <device_id>
      device_ip: <ip of the device>
PxUnderscore commented 4 years ago

@Kanonkaj , copy the files to custom_components/dyson . Then set up your config like this:

dyson:
  username: <email>
  password: <pwd>
  language: GB
  devices:
    - device_id: <device_id>
      device_ip: <ip of the device>

Well that's almost what I did, somehow it is required (for me atleast) to use GB as language, even though it is not connected to my Dyson UK account...

But thanks a lot! Made me try some more stuff.

etheralm commented 4 years ago

I'm really happy to hear that it worked on the first try, I didn't expect it to be honest. It was just a quick and dirty version that I cobbled up in 5 minutes. I'll reopen this ticket until the ha integration is ready.

@docBliny @FutureGUIs @brott8 I just pushed a new version of climate.py that should enable the power and speed controls. Update it and let me know if everything works please.

@troykelly The fan itself doesn't report AQI, I added it to the HA integration following the logic in their app and what I read at the time, it shows the highest value from the other sensors. The code for it looks like this:

return max(
    self.particulate_matter_2_5,
    self.particulate_matter_10,
    self.nitrogen_dioxide,
    self.volatile_organic_compounds,
)

If someone can suggest a more accurate way to do it I'll be happy to implement it.

@docBliny The fan itself sends the temperature value in Kelvins. After reading your comment I noticed that the old climate component implementation is hard-coded to show Celsius and I copied it over for this one. I'll push an update tomorrow that will use the home assistant setting for temperature units. In the mean time can you please verify that the temperature sensor(the standalone entity that's created, not the value in the climate component) is showing the temperature value in Fahrenheit if you have home assistant configured to use imperial.

@brott8 You can find the remaining filter life for both filters (HEPA and carbon) as attributes of the fan entity itself. The dust sensor of the previous models corresponds to the particulate matter 10 attribute in the air quality entity. The new models provide one more sensor for finer particles, particulate matter 2.5.

If you want to extract any of the attributes of the fan or air quality entities as separate sensors you can use template sensors for that. I'm actually already doing that, here is my config:

sensor: 
  - platform: template
    sensors:
      air_quality_index:
        value_template: "{{ state_attr('air_quality.living_room', 'air_quality_index') }} "
        friendly_name: "Air quality index"
      nitrogen_dioxide:
        value_template: "{{ state_attr('air_quality.living_room', 'nitrogen_dioxide') }}"
        friendly_name: "Nitrogen dioxide"
      particulate_matter_10:
        value_template: "{{ state_attr('air_quality.living_room', 'particulate_matter_10') }}"
        friendly_name: "Particulate matter 10μm"
      particulate_matter_2_5:
        value_template: "{{ state_attr('air_quality.living_room', 'particulate_matter_2_5') }}"
        friendly_name: "Particulate matter 2.5μm"
      volatile_organic_compounds:
        value_template: "{{ state_attr('air_quality.living_room', 'volatile_organic_compounds') }}"
        friendly_name: "Volatile organic compounds"
      living_room_fan_hepa_filter:
        value_template: "{{ state_attr('fan.living_room_fan', 'hepa_filter') }}"
        friendly_name: "Living room fan HEPA filter"
      living_room_fan_carbon_filter:
        value_template: "{{ state_attr('fan.living_room_fan', 'carbon_filter') }}"
        friendly_name: "Living room fan carbon filter"

Hope it helps.

troykelly commented 4 years ago

Thank you @etheralm Re AQI - I think that's probably going to be difficult - it's calculated differently all over the world. It's probably just going to cause arguments unless you use something simple as you have. If it's not suitable - we can just create a custom sensor and do the calculation ourselves.

docBliny commented 4 years ago

@etheralm

Results from quick tests:

image

etheralm commented 4 years ago

@docBliny

Hmm that's weird, is that with the latest version of climate.py from yesterday? I guess I'll have to have a look at the frontend climate component to see whats going on.

Thanks for testing the temperature, I misunderstood your first post and thought that the temperature wasn't showing properly in imperial, looks to be working fine.

docBliny commented 4 years ago

@etheralm I was testing with the latest from yesterday just before I tested/posted.

Ah sorry. When I was talking about Fahrenheit, I meant that you can't change the units on the Dyson's display (nor app) to Celsius which is what I want to use.

I had a quick look at the code, and I think it's based on supported HVAC modes (https://github.com/home-assistant/home-assistant-polymer/blob/master/src/panels/lovelace/cards/hui-thermostat-card.ts#L37 and https://github.com/home-assistant/home-assistant-polymer/blob/master/src/panels/lovelace/cards/hui-thermostat-card.ts#L234)

etheralm commented 4 years ago

Good find, that's exactly what I wanted to check. I just added an hvac_off mode, can you please pull the latest version and try it out.

Further looking into the thermostat card code, there is nothing about speed, so at least the fan_mode setting is not used there. Can you check if it is shown in the more info card of the climate entity (not the thermostat one) maybe it is used there.

docBliny commented 4 years ago

Yup, the power icon now shows up, but I don't think the HVAC mode is getting reflected correctly, i.e. the card is showing "Heat" as active (colored), but the unit is currently off. Turning off works by clicking on the power icon, but you can't turn it back on (i.e. by clicking on heat or cool icons, nor power icon to toggle).

Below is a screenshot of the details for thermostat card (by clicking the "..." on card): image

Here's the info from the climate.office entity: image

Here's the info from fan.office entity via UI: image

and state from dev tools: image

etheralm commented 4 years ago

Thanks for testing this, there is some progress. I'm not sure why the state is not reflected properly in the climate entity, can't see why on first glance. Can you please also post a screenshot of the fan entity state from dev tools while the fan is turned off.

etheralm commented 4 years ago

nvm I found the issue. My bad, can you please pull and try again. Both the thermostat card and the climate entity more info fan mode dropdown should work properly

docBliny commented 4 years ago

Here's the latest:

docBliny commented 4 years ago

Here are the states from dev tools when unit is off: image

image

etheralm commented 4 years ago

Ok the states look fine right now in both entities, I think I found why it wasn't turning on properly, just pushed a fix for it. Can you please test it and let me know if it works.

docBliny commented 4 years ago

👍 Turning back on works now.

cschleiden commented 4 years ago

Also tested with my HP04, works great so far 🙇