-
Notifications
You must be signed in to change notification settings - Fork 29
Home Appliance Events #42
Comments
Hi, actually I think the more challenging part is to understand what the API actually reports and how to properly represent it in HA, not the eventual coding. So if you can have a look at the logs for your devices and come up with a concrete suggestion I'd be happy to have a look. The first thing I'd like to understand better: would it make more sense to have sensors mapped to each of these events, or rather firing acutal events in HA? |
I guess firing events might be the right approach. What I would like to do is, for example, get a message when water is not turned on to the dishwasher, or iDos is empty. I'm not sure which logs you mean? When I understand what to do, I'm happy to contribute with some logs. |
HA subscribes to an SSE stream for each appliance, i.e. it does not have to poll but receives push notifications. The events look like this: {'LaundryCare.Dryer.Event.DryingProcessFinished':
{
'timestamp': 1575030757,
'handling': 'acknowledge',
'value': 'BSH.Common.EnumType.EventPresentState.Present',
'level': 'hint'
}
} The HA-HC integration keeps a dict for each appliance where the key/value pair is added to, i.e. it will contain a key {'LaundryCare.Dryer.Event.DryingProcessFinished': 'BSH.Common.EnumType.EventPresentState.Present'} This dictionary is logged for every event when you enable debug logging: So you could monitor that to understand how your device acts. Possibly all of this information is present in the API docs as well, but I'm not sure. |
By the way: for the above example the key/value pair of the event will also show as a state attribute |
Perfect I found it 👍 |
I've been sitting with postman trying to figure out the API from Home Connect simulator. The Events part is based on server-sent events, I've not been able to get postman to receive any updates or notifications from Home Connect more than It's listening to the event stream, with status 200. |
I have successfully made a Get to the events part of Home Connect API. I don't know if HA can receive Server-Sent events as a client, postman was not able to get anything from the respons, but cURL worked. Hope this helps, and thank you for all the good work. If this is possible to implement it would be awesome as the update is instantly. The cURL code is
And some responses from Home Connect Door open
When the coffee is ready
Connected and Disconnected
|
Thanks, that's useful.
Just to be clear: the Home Connect integration in Home Assistant is based on server-sent events, so the information is already there, it just has to be used. |
Hi David, Then what am I missing? I don't receive this messages in the debug log, and the remaining time is only updated in my HA every 60 second. Like its polling HomeConnect, for ex. the washing machine has still 45 seconds left when the program is finished. May by I need to convert to Python so I can read your code to understand... |
It would be great if you could look at the events returned when using the underlying Python library (and maybe compare it to what you see with your own method). Code snippet: from homeconnect import HomeConnect
import webbrowser
CLIENT_ID = ...
CLIENT_SECRET = ...
REDIRECT_URI = ...
hc = HomeConnect(CLIENT_ID, CLIENT_SECRET, REDIRECT_URI)
webbrowser.open(hc.get_authurl())
auth_result = input("Paste resulting URL here")
hc.get_token(auth_result)
def event_callback(appliance):
print(appliance.status)
appl = hc.get_appliances()
for app in appl:
app.listen_events(callback=event_callback) The only caveat is that the printed status is not the event data alone, but a dictionary ( |
I had trouble getting Oauth to work with the simulator and your code, I used the simulator to test earlier. I have no response URL to use on the machine I'm testing on. |
I get a "alarm_clock_elapsed: present" attribute on the cooktop switch and would love to have this as an event in HA. Currently, I have to use IFTTT to get it as an event. |
Hi @DavidMStraub Trying to do actions described in upper comment have some issues:
What's wrong? |
Okay. Adding https version as second redirect url seems work.
|
Hi,
Thank you for integrating HomeConnect with HA, awesom work!
I just upgraded and it works perfectly with HA 102.1.
This is a Wish and I would love to have an event sensor, if I knew more about Python and HA integrations, I would try to contribute with this myself.
So I make a wish here, guess that there are more people who would like to get status messages to HA from HomeConnect.
The part of the HomeConnect API I'm referring to is
Program Progress Events
Home Appliance Events.
The text was updated successfully, but these errors were encountered: