etheralm / libpurecool

Python library for dyson devices.
Other
65 stars 29 forks source link

Add full support for Dyson Pure Humidify+Cool #16

Open etheralm opened 4 years ago

etheralm commented 4 years ago

Add full support for the new Dyson Pure Humidify+Cool and Dyson Pure Humidify+Cool Cryptomic air purifiers.

Thank you @pfy for providing the preliminary implementation.

eide31 commented 4 years ago

i am using HP-06 Dyson Pure Humidify+Cool Cryptomic air purifiers

everything is ok thanks for this lib very much

but i cant turn on and off my fan with function

fan.set_configuration(fan_mode=FanMode.OFF)

after 5 minute i found i can use

fan.set_configuration(fan_power=FanPower.POWER_ON)

its work now!

thanks!

etheralm commented 4 years ago

@eide31 you can also use the helper methods to turn the fan on/off instead of passing the configuration parameters directly: fan.turn_on() and fan.turn_off().

etheralm commented 4 years ago

Ok I prepared a branch with a test script for this model.

For anyone that would like to help, can you please checkout the following branch: https://github.com/etheralm/libpurecool/tree/pure_humidify_cool and then edit the test.py file in the root folder with your credentials and run it. it should log all incoming messages from the fan. After it's connected and running change the humidity setting and paste the log here.

It would also help if you can post a screenshot of the app with the screen where you can change the different settings, just to be sure that we are not missing some option that is available there.

@alexbussa It looks like you have the cryptomic model. As far as I can remember from the ticket for the TP06 model, the app reports the state of the HEPA filter and only shows if the cryptomic filter is installed or not, but this was not reflected in the state message, I have no idea where it is getting the information if it is installed or not in the app, maybe it's a new type of message that was implemented for the new models. We can find this out if you run the script above once with the cryptomic filter installed and once without it.

alexbussa commented 4 years ago

Test Log Output

{"msg":"CURRENT-STATE","time":"2020-04-28T20:15:15.000Z","mode-reason":"NONE","state-reason":"MODE","rssi":"-41","channel":"1","fqhp":"103808","fghp":"73104","product-state":{"fpwr":"ON","auto":"OFF","oscs":"ON","oson":"ON","nmod":"OFF","rhtm":"ON","fnst":"FAN","ercd":"31U2","wacd":"NONE","nmdv":"0004","fnsp":"0005","bril":"0002","corf":"OFF","cflr":"INV","hflr":"0096","cflt":"NONE","hflt":"GCOM","sltm":"OFF","osal":"0135","osau":"0225","ancp":"0090","hume":"OFF","haut":"OFF","humt":"0050","rect":"0035","msta":"OFF","clcr":"CLNO","cdrr":"0060","cltr":"1948","wath":"2025","psta":"OFF","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}**
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:15:15.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:15:15.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:15:18.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"CURRENT-STATE","time":"2020-04-28T20:15:30.000Z","mode-reason":"NONE","state-reason":"MODE","rssi":"-41","channel":"1","fqhp":"103032","fghp":"73104","product-state":{"fpwr":"ON","auto":"OFF","oscs":"ON","oson":"ON","nmod":"OFF","rhtm":"ON","fnst":"FAN","ercd":"31U2","wacd":"NONE","nmdv":"0004","fnsp":"0005","bril":"0002","corf":"OFF","cflr":"INV","hflr":"0096","cflt":"NONE","hflt":"GCOM","sltm":"OFF","osal":"0135","osau":"0225","ancp":"0090","hume":"OFF","haut":"OFF","humt":"0050","rect":"0035","msta":"OFF","clcr":"CLNO","cdrr":"0060","cltr":"1948","wath":"2025","psta":"OFF","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:15:30.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"CURRENT-STATE","time":"2020-04-28T20:15:30.000Z","mode-reason":"NONE","state-reason":"MODE","rssi":"-41","channel":"1","fqhp":"102184","fghp":"73104","product-state":{"fpwr":"ON","auto":"OFF","oscs":"ON","oson":"ON","nmod":"OFF","rhtm":"ON","fnst":"FAN","ercd":"31U2","wacd":"NONE","nmdv":"0004","fnsp":"0005","bril":"0002","corf":"OFF","cflr":"INV","hflr":"0096","cflt":"NONE","hflt":"GCOM","sltm":"OFF","osal":"0135","osau":"0225","ancp":"0090","hume":"OFF","haut":"OFF","humt":"0050","rect":"0035","msta":"OFF","clcr":"CLNO","cdrr":"0060","cltr":"1948","wath":"2025","psta":"OFF","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:15:30.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:15:30.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"CURRENT-STATE","time":"2020-04-28T20:15:30.000Z","mode-reason":"NONE","state-reason":"MODE","rssi":"-41","channel":"1","fqhp":"102952","fghp":"73104","product-state":{"fpwr":"ON","auto":"OFF","oscs":"ON","oson":"ON","nmod":"OFF","rhtm":"ON","fnst":"FAN","ercd":"31U2","wacd":"NONE","nmdv":"0004","fnsp":"0005","bril":"0002","corf":"OFF","cflr":"INV","hflr":"0096","cflt":"NONE","hflt":"GCOM","sltm":"OFF","osal":"0135","osau":"0225","ancp":"0090","hume":"OFF","haut":"OFF","humt":"0050","rect":"0035","msta":"OFF","clcr":"CLNO","cdrr":"0060","cltr":"1948","wath":"2025","psta":"OFF","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:15:30.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:15:45.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"STATE-CHANGE","time":"2020-04-28T20:15:46.000Z","mode-reason":"LAPP","state-reason":"MODE","product-state":{"fpwr":["ON","ON"],"auto":["OFF","OFF"],"oscs":["ON","ON"],"oson":["ON","ON"],"nmod":["OFF","OFF"],"rhtm":["ON","ON"],"fnst":["FAN","FAN"],"ercd":["31U2","31U2"],"wacd":["NONE","NONE"],"nmdv":["0004","0004"],"fnsp":["0005","0005"],"bril":["0002","0002"],"corf":["OFF","OFF"],"cflr":["INV","INV"],"hflr":["0096","0096"],"cflt":["NONE","NONE"],"hflt":["GCOM","GCOM"],"sltm":["OFF","OFF"],"osal":["0135","0135"],"osau":["0225","0225"],"ancp":["0090","0090"],"hume":["OFF","HUMD"],"haut":["OFF","OFF"],"humt":["0050","0050"],"rect":["0035","0035"],"msta":["OFF","HUMD"],"clcr":["CLNO","CLNO"],"cdrr":["0060","0060"],"cltr":["1948","1948"],"wath":["2025","2025"],"psta":["OFF","OFF"],"fdir":["ON","ON"]},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:15:49.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"CURRENT-STATE","time":"2020-04-28T20:16:00.000Z","mode-reason":"LAPP","state-reason":"MODE","rssi":"-42","channel":"1","fqhp":"103464","fghp":"73104","product-state":{"fpwr":"ON","auto":"OFF","oscs":"ON","oson":"ON","nmod":"OFF","rhtm":"ON","fnst":"FAN","ercd":"31U2","wacd":"NONE","nmdv":"0004","fnsp":"0005","bril":"0002","corf":"OFF","cflr":"INV","hflr":"0096","cflt":"NONE","hflt":"GCOM","sltm":"OFF","osal":"0135","osau":"0225","ancp":"0090","hume":"HUMD","haut":"OFF","humt":"0050","rect":"0035","msta":"HUMD","clcr":"CLNO","cdrr":"0060","cltr":"1948","wath":"2025","psta":"OFF","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:16:00.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"STATE-CHANGE","time":"2020-04-28T20:16:02.000Z","mode-reason":"LAPP","state-reason":"MODE","product-state":{"fpwr":["ON","ON"],"auto":["OFF","OFF"],"oscs":["ON","ON"],"oson":["ON","ON"],"nmod":["OFF","OFF"],"rhtm":["ON","ON"],"fnst":["FAN","FAN"],"ercd":["31U2","31U2"],"wacd":["NONE","NONE"],"nmdv":["0004","0004"],"fnsp":["0005","0005"],"bril":["0002","0002"],"corf":["OFF","OFF"],"cflr":["INV","INV"],"hflr":["0096","0096"],"cflt":["NONE","NONE"],"hflt":["GCOM","GCOM"],"sltm":["OFF","OFF"],"osal":["0135","0135"],"osau":["0225","0225"],"ancp":["0090","0090"],"hume":["HUMD","HUMD"],"haut":["OFF","OFF"],"humt":["0050","0050"],"rect":["0035","0035"],"msta":["HUMD","HUMD"],"clcr":["CLNO","CLNO"],"cdrr":["0060","0060"],"cltr":["1948","1948"],"wath":["2025","2025"],"psta":["OFF","OFF"],"fdir":["ON","ON"]},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
{"msg":"STATE-CHANGE","time":"2020-04-28T20:16:06.000Z","mode-reason":"LAPP","state-reason":"MODE","product-state":{"fpwr":["ON","ON"],"auto":["OFF","OFF"],"oscs":["ON","ON"],"oson":["ON","ON"],"nmod":["OFF","OFF"],"rhtm":["ON","ON"],"fnst":["FAN","FAN"],"ercd":["31U2","31U2"],"wacd":["NONE","NONE"],"nmdv":["0004","0004"],"fnsp":["0005","0006"],"bril":["0002","0002"],"corf":["OFF","OFF"],"cflr":["INV","INV"],"hflr":["0096","0096"],"cflt":["NONE","NONE"],"hflt":["GCOM","GCOM"],"sltm":["OFF","OFF"],"osal":["0135","0135"],"osau":["0225","0225"],"ancp":["0090","0090"],"hume":["HUMD","HUMD"],"haut":["OFF","OFF"],"humt":["0050","0050"],"rect":["0035","0035"],"msta":["HUMD","HUMD"],"clcr":["CLNO","CLNO"],"cdrr":["0060","0060"],"cltr":["1948","1948"],"wath":["2025","2025"],"psta":["OFF","OFF"],"fdir":["ON","ON"]},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:16:15.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"STATE-CHANGE","time":"2020-04-28T20:16:18.000Z","mode-reason":"LAPP","state-reason":"MODE","product-state":{"fpwr":["ON","ON"],"auto":["OFF","OFF"],"oscs":["ON","ON"],"oson":["ON","ON"],"nmod":["OFF","OFF"],"rhtm":["ON","ON"],"fnst":["FAN","FAN"],"ercd":["31U2","31U2"],"wacd":["NONE","NONE"],"nmdv":["0004","0004"],"fnsp":["0006","0006"],"bril":["0002","0002"],"corf":["OFF","OFF"],"cflr":["INV","INV"],"hflr":["0096","0096"],"cflt":["NONE","NONE"],"hflt":["GCOM","GCOM"],"sltm":["OFF","OFF"],"osal":["0135","0135"],"osau":["0225","0225"],"ancp":["0090","0090"],"hume":["HUMD","OFF"],"haut":["OFF","OFF"],"humt":["0050","0050"],"rect":["0035","0035"],"msta":["HUMD","OFF"],"clcr":["CLNO","CLNO"],"cdrr":["0060","0060"],"cltr":["1948","1948"],"wath":["2025","2025"],"psta":["OFF","OFF"],"fdir":["ON","ON"]},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-04-28T20:16:19.000Z","data":{"tact":"2994","hact":"0034","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
{"msg":"STATE-CHANGE","time":"2020-04-28T20:16:20.000Z","mode-reason":"LAPP","state-reason":"MODE","product-state":{"fpwr":["ON","ON"],"auto":["OFF","OFF"],"oscs":["ON","ON"],"oson":["ON","ON"],"nmod":["OFF","OFF"],"rhtm":["ON","ON"],"fnst":["FAN","FAN"],"ercd":["31U2","31U2"],"wacd":["NONE","NONE"],"nmdv":["0004","0004"],"fnsp":["0006","0005"],"bril":["0002","0002"],"corf":["OFF","OFF"],"cflr":["INV","INV"],"hflr":["0096","0096"],"cflt":["NONE","NONE"],"hflt":["GCOM","GCOM"],"sltm":["OFF","OFF"],"osal":["0135","0135"],"osau":["0225","0225"],"ancp":["0090","0090"],"hume":["OFF","OFF"],"haut":["OFF","OFF"],"humt":["0050","0050"],"rect":["0035","0035"],"msta":["OFF","OFF"],"clcr":["CLNO","CLNO"],"cdrr":["0060","0060"],"cltr":["1948","1948"],"wath":["2025","2025"],"psta":["OFF","OFF"],"fdir":["ON","ON"]},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}

Application Remote Screen IMG_8730

@etheralm I have the regular PH01 model. I recall seeing someone had the cryptomic model, but I cannot recall where I saw that. I'm successfully using the recent update with @pfy's changes with Home Assistant.

etheralm commented 4 years ago

Thanks @alexbussa, I'll have a look the messages you posted later today and I'll try to figure out what changed I'll let you know when I push a new version that's ready for testing.

From the screenshot you posted I see 2 new buttons that we have to add support for (assuming that the purify under auto does the same thing as the auto button in the old fan models). Let me fix the environmental state update first and I'll post a new test script for those.

For the filters, I have the TP04 model which reports the hepa and carbon filter state separately, but they always have the same value, you can't even buy a replacement carbon of hepa filter for them separately. I guess that the dyson devs figured out that it's pointless to have two properties with the same value and they changed the carbon filter state to 'INV' to all the new models, starting with the first cryptomic one. I'll leave it as it is for now. We fixed it for the DP06 model in home assistant, so that it shouldn't throw an error when the carbon filter state is not an integer.

maxkraynov commented 4 years ago

Hi guys! I've just bought PH01 model. Not sure if it's still needed, but this is my logs

{"msg":"CURRENT-STATE","time":"2020-05-01T18:55:11.000Z","mode-reason":"LAPP","state-reason":"MODE","rssi":"-48","channel":"64","fqhp":"97224","fghp":"65872","product-state":{"fpwr":"ON","auto":"OFF","oscs":"ON","oson":"ON","nmod":"OFF","rhtm":"OFF","fnst":"FAN","ercd":"NONE","wacd":"NONE","nmdv":"0004","fnsp":"0002","bril":"0002","corf":"ON","cflr":"INV","hflr":"0100","cflt":"NONE","hflt":"GCOM","sltm":"OFF","osal":"0180","osau":"0180","ancp":"BRZE","hume":"HUMD","haut":"OFF","humt":"0060","rect":"0045","msta":"HUMD","clcr":"CLNO","cdrr":"0060","cltr":"0670","wath":"0675","psta":"OFF","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-05-01T18:55:11.000Z","data":{"tact":"2959","hact":"0052","pm25":"0000","pm10":"0000","va10":"0009","noxl":"0000","p25r":"0001","p10r":"0001","sltm":"OFF"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-05-01T18:55:11.000Z","data":{"tact":"2959","hact":"0052","pm25":"0000","pm10":"0000","va10":"0009","noxl":"0000","p25r":"0001","p10r":"0001","sltm":"OFF"}}
{"msg":"CURRENT-STATE","time":"2020-05-01T18:55:12.000Z","mode-reason":"LAPP","state-reason":"MODE","rssi":"-47","channel":"64","fqhp":"97344","fghp":"65872","product-state":{"fpwr":"ON","auto":"OFF","oscs":"ON","oson":"ON","nmod":"OFF","rhtm":"OFF","fnst":"FAN","ercd":"NONE","wacd":"NONE","nmdv":"0004","fnsp":"0002","bril":"0002","corf":"ON","cflr":"INV","hflr":"0100","cflt":"NONE","hflt":"GCOM","sltm":"OFF","osal":"0180","osau":"0180","ancp":"BRZE","hume":"HUMD","haut":"OFF","humt":"0060","rect":"0045","msta":"HUMD","clcr":"CLNO","cdrr":"0060","cltr":"0670","wath":"0675","psta":"OFF","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
{"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-05-01T18:55:13.000Z","data":{"tact":"2959","hact":"0052","pm25":"0000","pm10":"0000","va10":"0009","noxl":"0000","p25r":"0001","p10r":"0001","sltm":"OFF"}}
{"msg":"STATE-CHANGE","time":"2020-05-01T18:55:16.000Z","mode-reason":"LAPP","state-reason":"MODE","product-state":{"fpwr":["ON","ON"],"auto":["OFF","OFF"],"oscs":["ON","ON"],"oson":["ON","ON"],"nmod":["OFF","OFF"],"rhtm":["OFF","OFF"],"fnst":["FAN","FAN"],"ercd":["NONE","NONE"],"wacd":["NONE","NONE"],"nmdv":["0004","0004"],"fnsp":["0002","0002"],"bril":["0002","0002"],"corf":["ON","ON"],"cflr":["INV","INV"],"hflr":["0100","0100"],"cflt":["NONE","NONE"],"hflt":["GCOM","GCOM"],"sltm":["OFF","OFF"],"osal":["0180","0180"],"osau":["0180","0180"],"ancp":["BRZE","BRZE"],"hume":["HUMD","HUMD"],"haut":["OFF","ON"],"humt":["0060","0060"],"rect":["0045","0045"],"msta":["HUMD","OFF"],"clcr":["CLNO","CLNO"],"cdrr":["0060","0060"],"cltr":["0670","0670"],"wath":["0675","0675"],"psta":["OFF","OFF"],"fdir":["ON","ON"]},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
{"msg":"STATE-CHANGE","time":"2020-05-01T18:55:24.000Z","mode-reason":"LAPP","state-reason":"MODE","product-state":{"fpwr":["ON","ON"],"auto":["OFF","OFF"],"oscs":["ON","ON"],"oson":["ON","ON"],"nmod":["OFF","OFF"],"rhtm":["OFF","OFF"],"fnst":["FAN","FAN"],"ercd":["NONE","NONE"],"wacd":["NONE","NONE"],"nmdv":["0004","0004"],"fnsp":["0002","0002"],"bril":["0002","0002"],"corf":["ON","ON"],"cflr":["INV","INV"],"hflr":["0100","0100"],"cflt":["NONE","NONE"],"hflt":["GCOM","GCOM"],"sltm":["OFF","OFF"],"osal":["0180","0180"],"osau":["0180","0180"],"ancp":["BRZE","BRZE"],"hume":["HUMD","HUMD"],"haut":["ON","OFF"],"humt":["0060","0060"],"rect":["0045","0045"],"msta":["OFF","HUMD"],"clcr":["CLNO","CLNO"],"cdrr":["0060","0060"],"cltr":["0670","0670"],"wath":["0675","0675"],"psta":["OFF","OFF"],"fdir":["ON","ON"]},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}

Last two state changes are humidity setting changes from 60 to AUTO and back to 60. App screenshots:

dyson_auto dyson60

Let me know if there's anything I can do to help. offtop: I'm new into this topic, how do you install integration to Home Assistant directly from branch (I mean not official release)? Could you please point me out where I can find some documentation about it?

alexbussa commented 4 years ago

It occurred to me that there is another "filter" in this model. It's not replaced, but instead cleaned during the deep clean cycle. Looks like the HEPA/Charcoal is referred to as "Combi". I'm not sure what the orange colored filter is called, but I've included app screenshots for both. IMG_8852 IMG_8853

alexbussa commented 4 years ago

For the filters, I have the TP04 model which reports the hepa and carbon filter state separately, but they always have the same value, you can't even buy a replacement carbon of hepa filter for them separately. I guess that the dyson devs figured out that it's pointless to have two properties with the same value and they changed the carbon filter state to 'INV' to all the new models, starting with the first cryptomic one. I'll leave it as it is for now. We fixed it for the DP06 model in home assistant, so that it shouldn't throw an error when the carbon filter state is not an integer.

I have the DP04 also, which uses the same filters as the TP04 you have. I know what you're referring to. It's physically two filters, but their usage metrics increment at the same rate. The filter in the HP01 is physically one combined filter. It's HEPA on the outside, charcoal on the inside, in a single form factor.

etheralm commented 4 years ago

Thanks for the screenshots, this with the deep clean cycle looks different than the cryptomic one, we have to figure out which message contains the value for the hours left.

I was quite busy the last few days, but I think I’ll have some time to look into the logs you posted tomorrow. I’ll let you know if managed to find it there.

etheralm commented 4 years ago

Ok I just had a look at the logs you posted and this is what I found:

The following new fields were added to the state message:

"hume": "OFF",
"haut": "OFF",
"humt": "0050",
"rect": "0035",
"msta": "OFF",
"clcr": "CLNO",
"cdrr": "0060",
"cltr": "1948",
"wath": "2025",
"psta": "OFF",

From the state change messages you posted I can assume that the humidity button shows OFF when the field "hume" is "OFF"and and the number from "humt" when "hume" is set to "HUMD".

This should be enough to add support for the humidity control. I'll let you know here when I add it so that you can test it.

@alexbussa From the other fields the one closest to the value shown on the deep clean cycle screenshot is "cltr": "1948", can you please run the script again and try to verify that the value of cltr in the "CURRENT-STATE" message is the same as what you see in the maintenance screen for the deep clean cycle hours left.

I'll try to find why the environment state is not updating next.

etheralm commented 4 years ago

ok just had a look at the "ENVIRONMENTAL-CURRENT-SENSOR-DATA" message from the logs you posted and its absolutely identical to the one from the previous models. @alexbussa may I ask how you are testing the air quality data update, in home-assistant or directly with the lib?

etheralm commented 4 years ago

OK I just added support for the humidifier functions to the branch. I did it quite quickly today and everything probably won't work on the first try, but let's give it a shot.

I added the following methods:

enable_humidifier
disable_humidifier
enable_humidifier_auto
disable_humidifier_auto
set_humidity_target

I also updated the test.py script with some tests for the new functions. Can you please pull the latest changes from the branch, replace the user and pass in test.py and run it. It should pause for 10 seconds after calling each method. Can you verify in the app that it is actually doing what the method is supposed to do. You can also play around with the methods (passing different values to set_target_humidity, running the others from different states, etc.), let me know if you find any issues (or if it works at all).

Also one question, what are the minimum and maximum values for the target humidity that you can set in the app? I assumed that the range is between 0 and 100, but I can be wrong.

Cheers.

alexbussa commented 4 years ago

Downloaded the latest, ran test.py. I'm not seeing any logging output, Just a blinking cursor.

The humidity settings in the app are off, 30, 40, 50, 60, 70. The app doesn't allow for smaller than 10% increments. Not sure if smaller than 10% increments are accepted programmatically.

The air quality metrics not updating were noticed in Home Assistant, not directly within the lib. I seem to be getting updates in Home Assistant now. They're much less frequent on the HP01 than my DP04, but perhaps that's due to air quality remaining consistent in that room.

alexbussa commented 4 years ago

I pulled down the previous commit to look into the other values you mentioned.

The value within CURRENT-STATE for cltr matches the value in the app under "deep clean cycle".

The value for hume looks to be inline with your observation. It's set to OFF when humidity is off, and HUMD when humidity is on. The value for humt matches the humidity percentage as I change it in the app.

Also searched for the corresponding number for the "actual humidity" and that looks to be hact within ENVIRONMENTAL-CURRENT-SENSOR-DATA.

etheralm commented 4 years ago

Thanks for testing.

Hmm you don't even see the first print Running tests... ? I guess I messed something up during the initialization of the new class. I added some debug print statements throughout the code. Can you please pull again and run test.py.

Let's get the new class running first and then you can test if the fan will accept other values for target humidity, it could be quite possible that it does, for example the app has only a few settings for the oscillation angle, but you can set the exact angle through the lib.

Good to hear that it's updating for you, otherwise I have no idea why it wouldn't. The environment message is exactly the same as with previous models.

etheralm commented 4 years ago

The value within CURRENT-STATE for cltr matches the value in the app under "deep clean cycle".

Awesome. I'll add this one too to the state tomorrow.

Also searched for the corresponding number for the "actual humidity" and that looks to be hact within ENVIRONMENTAL-CURRENT-SENSOR-DATA.

Temperature and humidity should be available in the environment state already since nothing changed in the message from the previous models. Thanks for verifying.

alexbussa commented 4 years ago

Pulled the latest. This is the error it's giving.

# python test.py
Traceback (most recent call last):
  File "test.py", line 21, in <module>
    devices = dyson_account.devices()
  File "/config/python/libpurecool/libpurecool/dyson.py", line 96, in devices
    print("In device for loop: " + device_v2)
TypeError: can only concatenate str (not "dict") to str
etheralm commented 4 years ago

oops, my bad I need some sleep. Can you pull and try again?

alexbussa commented 4 years ago

For oscillation angle in the app, here's a screenshot. Before this fan, I hadn't seen breeze before. IMG_8913

alexbussa commented 4 years ago

I'm getting the "In device for loop" output, but it's hanging without an error after that.

# python test.py
In device for loop:
{'Serial': 'xxxxxxxxxxxx', 'Name': 'Bedroom', 'Version': 'ECG2PF.46.00.007.0003', 'LocalCredentials': 'xxxxxxxxxxxxxx', 'AutoUpdate': True, 'NewVersionAvailable': False, 'ProductType': '358', 'ConnectionType': 'wss'}
In is_dyson_pure_humidifycool_device if statement
In device for loop:
{'Serial': 'xxxxxxxxxxxx', 'Name': 'Kitchen', 'Version': 'ECG2PF.02.06.003.0002', 'LocalCredentials': 'xxxxxxxxxxxxxx', 'AutoUpdate': True, 'NewVersionAvailable': False, 'ProductType': '520', 'ConnectionType': 'wss'}
etheralm commented 4 years ago

Ok as I suspected its hanging when initializing the new object for some reason, I'll have a fresh look at it tomorrow, probably something stupid that I did. I'll let you know when I find it.

This option with the breeze is definitely new. Can you please post the the state message using the previous commit when it is turned on, I'll try to add it to the lib. Also what is it actually doing when you turn it on?

etheralm commented 4 years ago

Ok I added 2 more debug prints at a lower level, can you please pull again and run it when you have the time, I'll have a look at it tomorrow.

etheralm commented 4 years ago

Nevermind I managed to reproduce the issue with my fan too, I'll let you know when I get it fixed.

alexbussa commented 4 years ago

Snagged the CURRENT-STATE for oscillation in Off, 45º, and Breeze. Not sure what the difference is between oscs and oson. They're both OFF when oscillation is off, both ON when oscillation is on regardless of the mode. Looks like the differences is in ancp. When set to breeze, ancp is BRZE.

The Breeze oscillation mode is a non-synchronous oscillation movement where both vents are pointing in different directions, and appear to move at different speeds. I believe the intent is to have a more constant airflow that mimics a breeze.

// OFF
# python test.py
{"msg":"CURRENT-STATE","time":"2020-05-10T22:36:26.000Z","mode-reason":"NONE","state-reason":"MODE","rssi":"-42","channel":"1","fqhp":"100736","fghp":"73104","product-state":{"fpwr":"ON","auto":"OFF","oscs":"OFF","oson":"OFF","nmod":"OFF","rhtm":"ON","fnst":"FAN","ercd":"31U2","wacd":"NONE","nmdv":"0004","fnsp":"0005","bril":"0002","corf":"OFF","cflr":"INV","hflr":"0090","cflt":"NONE","hflt":"GCOM","sltm":"OFF","osal":"0148","osau":"0148","ancp":"0090","hume":"OFF","haut":"OFF","humt":"0050","rect":"0035","msta":"OFF","clcr":"CLNO","cdrr":"0060","cltr":"1819","wath":"2025","psta":"OFF","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}

// 45º
{"msg":"CURRENT-STATE","time":"2020-05-10T22:39:10.000Z","mode-reason":"LAPP","state-reason":"MODE","rssi":"-40","channel":"1","fqhp":"100752","fghp":"73104","product-state":{"fpwr":"ON","auto":"OFF","oscs":"ON","oson":"ON","nmod":"OFF","rhtm":"ON","fnst":"FAN","ercd":"31U2","wacd":"NONE","nmdv":"0004","fnsp":"0005","bril":"0002","corf":"OFF","cflr":"INV","hflr":"0090","cflt":"NONE","hflt":"GCOM","sltm":"OFF","osal":"0148","osau":"0148","ancp":"0045","hume":"OFF","haut":"OFF","humt":"0050","rect":"0035","msta":"OFF","clcr":"CLNO","cdrr":"0060","cltr":"1819","wath":"2025","psta":"OFF","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}

// Breeze
{"msg":"CURRENT-STATE","time":"2020-05-10T22:38:13.000Z","mode-reason":"LAPP","state-reason":"MODE","rssi":"-41","channel":"1","fqhp":"100752","fghp":"73104","product-state":{"fpwr":"ON","auto":"OFF","oscs":"ON","oson":"ON","nmod":"OFF","rhtm":"ON","fnst":"FAN","ercd":"31U2","wacd":"NONE","nmdv":"0004","fnsp":"0005","bril":"0002","corf":"OFF","cflr":"INV","hflr":"0090","cflt":"NONE","hflt":"GCOM","sltm":"OFF","osal":"0148","osau":"0148","ancp":"BRZE","hume":"OFF","haut":"OFF","humt":"0050","rect":"0035","msta":"OFF","clcr":"CLNO","cdrr":"0060","cltr":"1819","wath":"2025","psta":"OFF","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
etheralm commented 4 years ago

ok I think I found the issue (or at least one of them).

It was a really stupid mistake on my part, passed the model number instead of the state message payload to the state object, because fat fingers copy-pasting... The test script should work now.

Can you please pull the latest changes and run it again.

About the breeze option: great I should be able to add it to the enable_oscillation method for this model.

alexbussa commented 4 years ago

Running the latest code. I have a blinking cursor, no errors, nothing printed to the screen.

etheralm commented 4 years ago

damn thanks for testing and sorry for wasting your time. I'll have a better look later and I'll let you know when I find something.

liudger commented 4 years ago

Hi @etheralm , I can also help around (also an owner of the Dyson Pure Humidify+Cool). Let me know if I could do some testing and coding. I'll have time later this week.

etheralm commented 4 years ago

Hi @liudger, sorry I've been quite busy last few days, haven't done anything for this. I'll have some free time off at the end of week too. I'll let you know when I have something.

bachya commented 4 years ago

I am a new owner, as well, and am excited to see this in Home Assistant (where I'm one of the core developers). Let me know how I can assist!

rudgr commented 4 years ago

Same here, tried home assistant but keep getting message that device could not be found in my Dyson account.

https://github.com/home-assistant/core/issues/36565

Anyway, also happy to help testing etc

qdel commented 4 years ago

Hi,

Using the latest commit 337412585e3f5e3269a2388135d9e2b255e2f062 on branch pure_humidify_cool, the code deadlock on the device.connect() method:

In this method: https://github.com/etheralm/libpurecool/blob/pure_humidify_cool/libpurecool/dyson_pure_state.py#L102 There is no security on field presence in state. So an exception is thrown.

Note that this happens because the sensors are:

But here is the payload from my pure / humidify / cool: {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2020-06-20T11:54:44.000Z","data":{"tact":"2995","hact":"0059","pm25":"0000","pm10":"0000","va10":"0008","noxl":"0000","p25r":"0000","p10r":"0001","sltm":"OFF"}}

Firmware is: ECG2PF.46.00.006.0005

I connect correctly using a simple: if field not in state: return '0'

I will play a bit more with the library and the device as soon as i can! (tonight, France time!)

etheralm commented 4 years ago

Hi @qdel

Thanks for having a look at it, I've been quite busy lately and didn't have the time to check this.

You actually pointed me to the reason for the deadlock. The code is trying to init the environment state object object using the DysonEnvironmentalSensorState class from the dyson_pure_state.py file, which is the wrong class, because it's for the old models. The correct env state class for this one is DysonEnvironmentalSensorV2State from dyson_pure_state_v2.py.

The reason that this happens is that, where the code parses the env message (on_message method in dyson_pure_cool_link.py) it uses the is_pure_cool_v2 utility method which does not include the model of this fan and this was causing it try to create the env message object using the old version class.

I just added the model to the util method. Can you please pull the latest commit and run the test.py to see if all the fan functions are running correctly.

qdel commented 4 years ago

Hello,

Connection works correctly,

But it seems the test do not pass:

Running tests...
Humidifier state: OFF
Humidifier auto mode: OFF
Humidity target: 0070
Enabling humidifier
Humidifier state: OFF
Humidifier auto mode: OFF
Humidity target: 0070
Waiting for 10 seconds...

Disabling humidifier
Humidifier state: HUMD
Humidifier auto mode: OFF
Humidity target: 0070
Waiting for 10 seconds...
Enabling humidifier auto mode
Humidifier state: OFF
Humidifier auto mode: OFF
Humidity target: 0070
Waiting for 10 seconds...
Disabling humidifier auto mode
Humidifier state: OFF
Humidifier auto mode: OFF
Humidity target: 0070
Waiting for 10 seconds...
Setting humidity target
Humidifier state: OFF
Humidifier auto mode: OFF
Humidity target: 0070

Note that the test script never ends.

qdel commented 4 years ago

I updated the test script for more functionality testing.

from what i can check:

logs.txt test.py.txt

WilldabeastHA commented 3 years ago

I have a HP02 (Dyson Pure Humidify Cool Cryptomic) and I get a error message of Unable to find device xxx-xx-xxxxxxxx in Dyson account. I see on the documentation page "Dyson Cool+Hot devices (HP02 and HP04)" so I'm curious if this is an issue with my Dyson account or something else? Thanks!

bachya commented 3 years ago

I'm getting really itchy to add this to Home Assistant. What help is needed to push this across the finish line? Someone to put together a PR? I have this device and enough device integration experience to take a stab if it's helpful.

oxc commented 3 years ago

I'm getting really itchy to add this to Home Assistant. What help is needed to push this across the finish line? Someone to put together a PR? I have this device and enough device integration experience to take a stab if it's helpful.

Same here, I'm happy to provide more information or assist with debugging/integration.

WilldabeastHA commented 3 years ago

I'm getting really itchy to add this to Home Assistant. What help is needed to push this across the finish line? Someone to put together a PR? I have this device and enough device integration experience to take a stab if it's helpful.

Same here, I'm happy to provide more information or assist with debugging/integration.

I’m happy to help out how ever I can as well! Would love to see this working.

rudgr commented 3 years ago

on a side note: HA seems to have added a humidifier integration since v0.112: https://www.home-assistant.io/integrations/humidifier/

WilldabeastHA commented 3 years ago

on a side note: HA seems to have added a humidifier integration since v0.112: https://www.home-assistant.io/integrations/humidifier/

Yes there is a dyson integration with this library but this integration doesn’t work correctly.

cyleo commented 3 years ago

I have a HP02 (Dyson Pure Humidify Cool Cryptomic) and I get a error message of Unable to find device xxx-xx-xxxxxxxx in Dyson account. I see on the documentation page "Dyson Cool+Hot devices (HP02 and HP04)" so I'm curious if this is an issue with my Dyson account or something else? Thanks!

Same issue on my end with the Pure Humidify + Cool, so I don’t think it’s related to your account.

bachya commented 3 years ago

My Pure Humidify+Cool somehow shows up in Home Assistant and can be controlled. I did want to report a Home Assistant stacktrace that I received today:

Logger: root
Source: /usr/src/homeassistant/homeassistant/bootstrap.py:315
First occurred: 7:09:23 PM (1 occurrences)
Last logged: 7:09:23 PM

Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3452, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1779, in loop_forever
    rc = self.loop(timeout, max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1181, in loop
    rc = self.loop_read(max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1572, in loop_read
    rc = self._packet_read()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2310, in _packet_read
    rc = self._packet_handle()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2936, in _packet_handle
    return self._handle_publish()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3216, in _handle_publish
    self._handle_on_message(message)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3444, in _handle_on_message
    self.on_message(self, self._userdata, message)
  File "/usr/local/lib/python3.8/site-packages/libpurecool/dyson_pure_cool_link.py", line 104, in on_message
    device_msg = DysonEnvironmentalSensorV2State(payload)
  File "/usr/local/lib/python3.8/site-packages/libpurecool/dyson_pure_state_v2.py", line 157, in __init__
    else int(particulate_matter_25)
ValueError: invalid literal for int() with base 10: 'FAIL'