Skip to content

Quick n' dirty home assistant component for Bosch Dryer (probably works with other Home Connect dryers too)

Notifications You must be signed in to change notification settings

gkreitz/homeassistant-bosch_dryer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

homeassistant-bosch_dryer

This is a quick n' dirty component for Home Assistant to read the state of a Bosch Dryer using Home Connect. It likely works with other Home Connect dryers too.

This will give you four sensors for each Home Connect dryer you have:

If the dryer is off/not connected to wifi, you'll get a state of `unavailableand the rest asunknown``.

Automation ideas

My plan for this is to add a task to empty the dryer in Todoist when the dryer is finished. When the door opens, that task is automatically completed.

In addition, when the dryer is running, Magic Mirror displays the time remaining.

Installation

  • Ensure your dryer is set up and working in the Home Connect app.
  • Copy this folder to <config_dir>/custom_components/bosch_dryer/.
  • Create an account on https://developer.home-connect.com/.
  • Register an application. Pick Device flow for OAuth flow.
  • Once you start this sequence, you have 5 minutes to complete it (or you'll have to restart from here):
    • export CLIENT_ID="YOUR_CLIENT_ID"
    • curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "client_id=${CLIENT_ID}" https://api.home-connect.com/security/oauth/device_authorization | tee tmp.json
    • Go to verification_uri in a browser, type in user_code. Log in using your (end user, not developer) Home Connect account and approve.
    • export DEVICE_CODE=$(jq -r .device_code tmp.json)
    • curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=urn:ietf:params:oauth:grant-type:device_code&device_code=${DEVICE_CODE}&client_id=${CLIENT_ID}" https://api.home-connect.com/security/oauth/token | tee access_token.json
    • jq .refresh_token access_token.json

Put the following in your home assistant config:

sensor:
  - platform: bosch_dryer
    refresh_token: "YOUR_REFRESH_TOKEN"

Remarks on the API

This is built using the Home Connect API, documented on https://developer.home-connect.com/. There is plenty in the API that is not exposed via this component. Using the API, one can also remote control the dryer, but I haven't figured out a use case for that yet. The API is a straightforward REST API with Oauth authentication. There's also a server-side event feed giving pretty quick updates. Originally, this module was just polling, but I figured it'd be fun to test out asyncio, so I rewrote the module to be async and cloud-push.

The API is a bit flakey, and tends to time out/return 504 during European evenings. Currently, this module retries forever, with an exponential backoff. I'll fix to something a tad better if/when I get sufficiently annoyed.

About

Quick n' dirty home assistant component for Bosch Dryer (probably works with other Home Connect dryers too)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages