Closed ghost closed 4 years ago
Actually I just optimized and adjusted the code from gkreitz that was originally just for the dryer. I don't know how to let this become an official HA integration. of course would be nice ;-) I'll have to check this out...
Hey you can get "official" via this page. You have allready written code, so maybe it's ticking some extra boxes and more people can benefit from home connect. :-) I'd love to see my Diswasher, Coffemachine and Oven officialy supported and integrated, that gives some extra benefits in ease of use, and support frome site-developers in coupling all things together. https://developers.home-assistant.io/
It seems this integration works :-) "the other integration from https://github.com/DavidMStraub/homeassistant-homeconnect does require a rather difficult authentication proces. Couldnt get that one working yet. :) Anyway is there a way to turn the devices on and off? And is there a way to add the coffee machine to this integration? Can I do it myself somehow?
Thanks for your feedback YRRK :-) It could try to add the coffee machine with you as beta tester ;-) Actually it should be possible to turn on the devices too... but then the whole thing becomes more complex, as the possibilities explode and sadly, the "allow remote control" permission for the HOME CONNECT devices automatically disables after a few hours... I did complain about this already, perhaps you could do the same... What is the use of that function when i locally have to allow remote control as I want to use it from on the road... (turn on, start oven (f.e. with prepared freezed lasagne) when I drive home)... you could of course try to adjust it by yourself... it's pretty easy python. or give me some time so adjust ;-)
Think I can beta test if I can handle it in just a few moments a week. (I cannot give you the passcode of my devices if you mean that) I'm unexperienced in coding. Think I would start copy pasting code and try changing parts and see what happens haha. I actually don't know what i'm doing. The fun thing about turning it off and on is that I can make buttons, and "activate" the machines like all other devices in the house. For example when breakfast is done, I want coffee. Then I can allready start up the machine, before walking to it. It takes a while when the machine becomes ready, so it's a time saver. Also then I can see if a machine is left on (like oven) and then I can turn it off. There is not much more too wish. Just basic functionality and i'm happy to have everything in one system. :-)
By the way. Isn’t that a function that the remote on/start function disables after a while? I remembered that the remote start goes 2 or 3 levels deep. And the deepest level is that you enable remote start always, overruling their “safety” advise. I’ve mine set that the remote app always can start. If that is what you mean...
Ok, I see... with the coffee machine it makes quite sense. I'll check that out, just adding the state of the coffee machine should be no problem. I do not need (and do no want your passcode) of course, I'll just update the script and you can test it.
Do you know how to check the HA log and edit config on system level, when HA isn't starting up? Are you using HASSIO or what system?
I can download the log for errors. But not on system level? Is there another log? No sorry don't know yet. I use the standard HomeAssistant package from the homeassistant.io getting started page. Raspberry Pi4b 32bit. I keep up with the lastest updates, since there is a lot still to be fixed.
I mean are you able to edit the sensor.yaml when HA doesn't start up anymore? An error can prevent HA from starting up, so I do not want to cause you any problems...
I'll create an updated sensor.py for home_connect in the next hours.
!!! Check if you can access the sensor.yaml file if HA isn't working. You won't be able to use the HA file-editor or the HA-SSH Server. So either directly over console or system level SSH, SFTP, Samba-share or whatever you got configured... !!!
Beta-Test for HOME CONNECT CoffeeMaker & cooling devices...
Rename your sensor.py to sensor.working (or something else to be able to easily switch back if the new file is causing errors) and copy this file to your custom_component/home_connect folder: https://github.com/cotwild/home_connect/blob/cotwild-patch-coffeeandfridge/sensor_beta1.py Rename the file to "sensor.py" and add the following to your configuration.yaml to enable debug information for testing. This enables full debug logging to your homeassistant.log file for the module:
logger: default: info logs: custom_components.home_connect: debug
I tested it and my HA came up normally... but as I do not have a coffeeMaker nor a cooling device this doesn't help. Please give it a try and let me know if and what states you are getting... (probably only the device status and on the cooling devices only door state?)
No I can't find the sensor.yaml "directly over console or system level" difficult too. But I can put the microSD in my computer and just acces the card, think I can find the file then if needed. So that's solved.
I only have the coffee maker, so I can't test the cooler. I hope to have the washing machine in the far future. :-)
I've just cloned my working config, so I can mess around with this new version before going live. So don't worry about that.
Enabled log an start testing now...
Think we have some errors. I included, the relevant parts, of the log.
Aldough the sensors are responding! (The cooking thing on the picture is a non-home-connect device (i'm not that rich to affort it :) it's using the DSMR ampere meter integration sensor)
Here is my log after a second day with a fresh boot. I condensed the log to the relevant parts and stripped other private info. Also turned all devices on and off for once, just to see what happends in de log. I think you have enough to read. So i'm entering wait mode :-)
By the way, the program values remain different with each device when turning the device off. On one device it's the last message, on the other unknow. The most logic would be when a device is off, the program is none or inactive. And the layout of the values walk out of alignment, they drift over the picture-elements card depending of the text, making it impossible to align them above eachother. I don't know if this can be fixed in the code? Maybe I need to find a way to align the text always to the left using CSS, I don't know if that is possible need to figure that out. Thanks for reading! :-)
UPDATE: Yes, the alignment of the value can be fixed wit CSS: text-align: left
Thank you for your testing and feedback. I fixed the error and rewrote a big part of the component. Now you should see only relevant entities per device - I added more sensors (water tank, bean quantity, drip tray for your coffee maker) as well as a warning entity (water tank empty, drip tray full, no beans for coffee maker and door and temperature alarms for the refrigerator)...
Please delete the siemens entries in your homeassistant/.storage/core.entity_registry file before restarting HA with the updated sensor.py in custom_components/home_connect with this content: https://github.com/cotwild/home_connect/blob/cotwild-patch-coffeeandfridge/sensor_beta2.py
I tested it shortly... HA did come up and the new sensor entities were created. Test with running devices is coming up in the next days... Let me know how it looks for the coffee maker.
I'll start testing! By the way, do you know ioBroker? It's a kind of German/English HomeAssistant. Pretty cool, but not so "lively" as the HomeAssistant ecosystem. Anyway they have also one of the few HomeConnect services and a pretty nice system to recieve the secret homeconnect key via the UI. Maybe worth looking for some inspiration ;-) It's also opensource. https://www.iobroker.net/#en/adapters/adapterref/iobroker.homeconnect/README.md
Thanks for all the new options :-) The "operation state" is not yet a switch but a sensor right?
I changed something. I made a seperate test-system in my network. So did a clean install on an older Pi3b + lastest Hass.io 32bit image, just for testing this and excluding all other factors. Also to avoid annoying my running system. This makes everything easy-er, also to hand over my, almost complete, log Here's my log: home-assistant.log
What do you think, does it look stable to you? If you later think it's good, i'll also put it on my running system (Pi4b 32bit latest hassio).
Yes, still a sensor. Want to get the sensors working fine first... but the bean, water tank and drip tray sensor isn't working?
Nope no information there, I have never seen this info in the official app either by the way. An overview of what is working if I turn everything on at once:
Oh... good to know. I found those values on the HC developer website... probably for an other coffee maker. what a shame ;-)
Am Do., 27. Feb. 2020 um 18:23 Uhr schrieb MrUser <notifications@github.com
:
Nope no information there, I have never seen this info in the official app either by the way. An overview of what is working if I turn everything on at once:
[image: Schermafbeelding 2020-02-27 om 18 17 46] https://user-images.githubusercontent.com/48710822/75468803-20dffe00-598e-11ea-8942-a002094503cc.png
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cotwild/home_connect/issues/1?email_source=notifications&email_token=ACAT4TAMR6LDZDYROMCUSQTRE7ZKDA5CNFSM4KSDMDX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENFGMPQ#issuecomment-592078398, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAT4THQR5G4433IDDNO3G3RE7ZKDANCNFSM4KSDMDXQ .
Sudden error:
2020-02-28 15:05:53 DEBUG (MainThread) [custom_components.home_connect.sensor] Received event: MessageEvent(type='CONNECTED', message='CONNECTED', data='', origin='https://api.home-connect.com', last_event_id='SIEMENS-CT836LEB6-68A40E32203C') 2020-02-28 15:05:53 DEBUG (MainThread) [custom_components.home_connect.sensor] Fetching initial state 2020-02-28 15:05:53 DEBUG (MainThread) [custom_components.home_connect.sensor] Making http get request to https://api.home-connect.com/api/homeappliances/SIEMENS-CT836LEB6-68A40E32203C, headers {'Accept': 'application/vnd.bsh.sdk.v1+json'} 2020-02-28 15:05:54 DEBUG (MainThread) [custom_components.home_connect.sensor] Http get request to https://api.home-connect.com/api/homeappliances/SIEMENS-CT836LEB6-68A40E32203C got response 200 2020-02-28 15:05:54 DEBUG (MainThread) [custom_components.home_connect.sensor] Making http get request to https://api.home-connect.com/api/homeappliances/SIEMENS-CT836LEB6-68A40E32203C/status, headers {'Accept': 'application/vnd.bsh.sdk.v1+json'} 2020-02-28 15:05:55 DEBUG (MainThread) [custom_components.home_connect.sensor] Http get request to https://api.home-connect.com/api/homeappliances/SIEMENS-CT836LEB6-68A40E32203C/status got response 200 2020-02-28 15:05:55 DEBUG (MainThread) [custom_components.home_connect.sensor] Ignored key-value pair: BSH.Common.Status.LocalControlActive,False 2020-02-28 15:05:55 DEBUG (MainThread) [custom_components.home_connect.sensor] Ignored key-value pair: BSH.Common.Status.RemoteControlStartAllowed,True 2020-02-28 15:05:55 DEBUG (MainThread) [custom_components.home_connect.sensor] Actual state: unknown 2020-02-28 15:05:55 DEBUG (MainThread) [custom_components.home_connect.sensor] Making http get request to https://api.home-connect.com/api/homeappliances/SIEMENS-CT836LEB6-68A40E32203C/programs/active, headers {'Accept': 'application/vnd.bsh.sdk.v1+json'} 2020-02-28 15:05:55 DEBUG (MainThread) [custom_components.home_connect.sensor] Http get request to https://api.home-connect.com/api/homeappliances/SIEMENS-CT836LEB6-68A40E32203C/programs/active got response 404
Yesterday until today.
Error 404 istn't actually a problem as it states "No program is currently active", but 401 means "Unauthorized - No or invalid access token" - Did you change or test anything else? Are you still using same access token?
Error 504 is a gateway timeout... Perhaps HomeConnect (Server side) was down for a while? What is the actual status? Is it working again?
These errors popped up, but everyhing is still the same and working (With some status staying "onbekend"=unknown like i posted earlyer)
So what's your status? Still writing? Shall I test it also on a Pi4b?
Sorry to let you wait, didn't have time to try coding the power toggle.
The "unknown" status is normal, when the device isn't actually on and the values cannot be read. It would be possible to replace it with no value that it would look better in HA. The 401 and 504 really seemed to be a HOME CONNECT Server problem.
Thanks for this integration. Today, I tried this with my washing machine. It run quite nice but I notice some issues:
BTW: have you need the integration from David: https://github.com/DavidMStraub/homeassistant-homeconnect. May be it make sense to combine both activities. E.g. David already implemented a nice authorization procedure. The upper four entities are Davids, the lower once are from you.
Sorry to let you wait, didn't have time to try coding the power toggle.
The "unknown" status is normal, when the device isn't actually on and the values cannot be read. It would be possible to replace it with no value that it would look better in HA. The 401 and 504 really seemed to be a HOME CONNECT Server problem.
You're doing it all for the good so no worries, i'll wait :-)
Unknown would look better with ... or no value indeed.
Would it be possible to suppress the warnings until a cascading/exponential retry (1 sec, 10sec, 30sec, 1min) fails, so really turns out there is no server connection, and then post a warning? Or is that a lot of programming? Since it's a know issue caused by HomeConnect, to keep the log clear with real issues. :-)
Have a nice day!
Current state of working entities:
Oh we have a new, stand alone, error: First occured: 2:11:39 PM (1 occurences) ` 2020-03-08 14:11:08 DEBUG (MainThread) [custom_components.home_connect.sensor] SSE reader failed parsing {"items":[{"timestamp":1583673068,"handling":"none","uri":"/api/homeappliances/SIEMENS-CT836LEB6-68A40E32203C/programs/active","key":"BSH.Common.Root.ActiveProgram","value":null,"level":"hint"}],"haId":"SIEMENS-CT836LEB6-68A40E32203C"}
2020-03-08 14:11:39 ERROR (MainThread) [aiohttp_sse_client.client] fetch https://api.home-connect.com/api/homeappliances/SIEMENS-SN558S06TE-68A40E0E5288/events failed with wrong Content-Type: text/plain
2020-03-08 14:11:39 DEBUG (MainThread) [custom_components.home_connect.sensor] SSE reader caught connection error: fetch https://api.home-connect.com/api/homeappliances/SIEMENS-SN558S06TE-68A40E0E5288/events failed with wrong Content-Type: text/plain `
@FlavorFx
Hey If I may give my opinion on this. I really value David's work, but the authentication he use's you need to configure your pi with SSL, duck DNS and so on wich is kind of difficult, rules out non-https use in lovelace and so has consequences only for getting this one integration started. I tried it without, but your really need to do all that SSL stuff. I really like the authenticion cotwild uses since it's less intrusive on your working config (Wich is a delicate balance since HomeAssistant is still in development). But on the other hand, the cotwild authenticion could be more user friendly, I'm also not that technical to get the terminal stuff working, so on that one I agree. To be honst, I obtained my authentication key via an HomeConnect integration/adapter from iobroker.net (not using iobroker anymore). To use with cotwild's integration. It works :-)
A agree Davids authentication is more complex but even fully integrated in HA. Cotwild's is more straight forward and works for me as well. However, I just want to give a hint that it may make sense to combine the work to get more progress on it. David's integration shows more features but still struggle with random freezing of the integration.
Dear @cotwild , your'e probably very busy. All answers are good. What's your estimate for a new version? Hours, days, weeks, months, years? ;-) I Would like to port this integration to my "production" system for daily use, fix the graphic representation of the sensors. But it would be a pitty if a new version comes out a few days later :-)
Hey Cotwild,
Is this going to be an official integration? Would be nice... Kind regards!