Package: homeconnect-watcher
homeconnect-watcherPython service that listens to HomeConnect event and logs them.UsageBefore you start, create a developer account athttps://developer.home-connect.com/and
register an application with the "Authorization Code Grant Flow" as OAuth Flow
andhttp://localhost:8000/code/as redirect URL.Next, set the following environment variables with the values of your application:HOMECONNECT_CLIENT_IDHOMECONNECT_CLIENT_SECRETHOMECONNECT_REDIRECT_URIAuthorizationThe watcher requires a token, which will be automatically refreshed once obtained. To obtain the first token runhomeconnect-watcher authorizeand follow the instructions.If the watcher is used regularly, this only needs to be done once.WatchingNext up, runhomeconnect-watcher watchExposing Metrics to PrometheusThe watcher can expose its metrics to Prometheus. This requires theprometheus-clientto be installed;pipinstall"homeconnect-watcher[prometheus]"Then, when starting the watcher, pass the port you want to expose the metrics to. For example:homeconnect-watcherwatch--metrics-port8000EventsEvents are received as multi-line byte-strings, and always end with a double newline (\n\n). They (may) contain the
following keys:event: Event type. One of the types listed below.data: Contains a JSON dictionary. For Keep-Alive events, this field is present, but empty.id: Contains the appliance id. For Keep-Alive events, this field is missing.Events come in the following flavours:Keep-AlivePeriodic keep-alive message (interval: every 55 seconds)event:KEEP-ALIVE
data:StatusStatus changes (e.g. "DoorState")event:STATUS
data:{"haId":"SIEMENS-WM14T6H9NL-AB1234567890","items":[{"handling":"none","key":"BSH.Common.Status.LocalControlActive","level":"hint","timestamp":1676897835,"uri":"/api/homeappliances/SIEMENS-WM14T6H9NL-68A40E2B0549/status/BSH.Common.Status.LocalControlActive","value":true},{"handling":"none","key":"BSH.Common.Status.RemoteControlActive","level":"hint","timestamp":1676897835,"uri":"/api/homeappliances/SIEMENS-WM14T6H9NL-AB1234567890/status/BSH.Common.Status.RemoteControlActive","value":false}]}
id:SIEMENS-WM14T6H9NL-AB1234567890EventEvent (e.g. "Preheat finished")event:EVENT
data:{"items":[{"timestamp":1642001123,"handling":"none","key":"BSH.Common.Event.ProgramFinished","value":"BSH.Common.EnumType.EventPresentState.Present","level":"hint"}],"haId":"SIEMENS-WM14T6H9NL-AB1234567890"}
id:SIEMENS-WM14T6H9NL-AB1234567890NotifyValue changesevent:NOTIFY
data:{"haId":"SIEMENS-WM14T6H9NL-AB1234567890","items":[{"handling":"none","key":"BSH.Common.Root.SelectedProgram","level":"hint","timestamp":1676897836,"uri":"/api/homeappliances/SIEMENS-WM14T6H9NL-AB1234567890/programs/selected","value":"LaundryCare.Washer.Program.DelicatesSilk"}]}
id:SIEMENS-WM14T6H9NL-AB1234567890ConnectedConnection to home appliance re-establishedevent:CONNECTED
data:{"haId":"SIEMENS-WT8HXM90NL-AB1234567890","handling":"none","key":"BSH.Common.Appliance.Connected","level":"hint","timestamp":1676897865,"value":true}
id:SIEMENS-WT8HXM90NL-AB1234567890DisconnectedConnection to home appliance lost or not possibleevent:DISCONNECTED
data:{"haId":"SIEMENS-WM14T6H9NL-AB1234567890","handling":"none","key":"BSH.Common.Appliance.Disconnected","level":"hint","timestamp":1676897981,"value":true}
id:SIEMENS-WM14T6H9NL-68A40E2B0549PairedNew home appliance was added to HC account, this appliance can be directly monitored with an open event streamTODO: add exampleDepairedExisting home appliance was removed, monitoring of this appliance is no longer possibleTODO: add exampleRequestsWe can make three kinds of requests to an appliance.
These return a payload with one of the following keys:"data", containing a dictionary with the result, or"error", in case something went wrong.StatusStatus information{"data":{"status":[{"key":"BSH.Common.Status.RemoteControlActive","value":true},{"key":"BSH.Common.Status.RemoteControlStartAllowed","value":false},{"key":"BSH.Common.Status.OperationState","value":"BSH.Common.EnumType.OperationState.Run"},{"key":"BSH.Common.Status.DoorState","value":"BSH.Common.EnumType.DoorState.Closed"}]}}SettingsSettings information{"data":{"settings":[{"key":"BSH.Common.Setting.PowerState","value":"BSH.Common.EnumType.PowerState.On"}]}}Programs Active{"data":{"key":"LaundryCare.Dryer.Program.Cotton","options":[{"key":"LaundryCare.Dryer.Option.DryingTarget","value":"LaundryCare.Dryer.EnumType.DryingTarget.CupboardDry","unit":"enum"},{"key":"BSH.Common.Option.ProgramProgress","value":3,"unit":"%"},{"key":"BSH.Common.Option.RemainingProgramTime","value":348,"unit":"seconds"},{"key":"BSH.Common.Option.ElapsedProgramTime","value":12,"unit":"seconds"},{"key":"BSH.Common.Option.Duration","value":360,"unit":"seconds"}]}}Changelog0.0.6 Postgres exporter and sessionization0.0.5 Clean up0.0.4 Add timestamp to events0.0.3 Expose Prometheus metrics