Giter Club home page Giter Club logo

home-assistant-miele's Introduction

Home Assistant support for Miele@home connected appliances

Introduction

This project exposes Miele state information of appliances connected to a Miele user account. This is achieved by communicating with the Miele Cloud Service, which exposes both applicances connected to a Miele@home Gateway XGW3000, as well as those devices connected via WiFi Con@ct.

Prerequisite

  • A running version of Home Assistant. While earlier versions may work, the custom component has been developed and tested with version 0.76.x.
  • The requests_oauthlib library as part of your HA installation. Please install via pip3 install requests_oauthlib. For Hassbian you need to install this via :
cd /srv/
sudo chown homeassistant:homeassistant homeassistant
sudo su -s /bin/bash homeassistant
cd /srv/homeassistant
source bin/activate
pip3 install requests_oauthlib

Installation of the custom component

  • Copy the content of this repository into your custom_components folder, which is a subdirectory of your Home Assistant configuration directory. By default, this directory is located under ~/.home-assistant. The structure of the custom_components directory should look like this afterwards:
- miele
    - __init__.py
    - miele_at_home.py
    - binary_sensor.py
    - light.py
    - sensor.py
  • Enabled the new platform in your configuration.yaml:
miele:
    client_id: <your Miele ClientID>
    client_secret: <your Miele ClientSecret>
    lang: <optional. en=english, de=german>
    cache_path: <optional. where to store the cached access token>
  • Restart Home Assistant.
  • The Home Assistant Web UI will show you a UI to configure the Miele platform. Follow the instructions to log into the Miele Cloud Service. This will communicate back an authentication token that will be cached to communicate with the Cloud Service.

Done. If you follow all the instructions, the Miele integration should be up and running. All Miele devices that you can see in your Mobile application should now be also visible in Home Assistant (miele.*). In addition, there will be a number of binary_sensors and sensors that can be used for automation.

Questions

Please see the Miele@home, miele@mobile component discussion thread on the Home Assistant community site.

home-assistant-miele's People

Contributors

docbobo avatar kloknibor avatar n3pf avatar renenulschde avatar roemer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

home-assistant-miele's Issues

Support HACS

Is it possible to support the new community store that will replace/is replacing the custom updater? This will make your work better available and give users a easy solution to update when things change.

More information:
https://github.com/custom-components/hacs

Error during setup of component miele

Hello docbobo,

since a few days the component it not longer working.
After the Home Assistant Start i get following Error.
he authentication token is recived successfully.

019-05-02 13:00:08 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for miele which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant. 2019-05-02 13:00:11 ERROR (MainThread) [custom_components.miele.miele_at_home] Failed to retrieve devices: 401 2019-05-02 13:00:11 ERROR (MainThread) [homeassistant.setup] Error during setup of component miele Traceback (most recent call last): File "/opt/homeassistant/lib/python3.6/site-packages/homeassistant/setup.py", line 153, in _async_setup_component hass, processed_config) File "/home/homeassistant/.homeassistant/custom_components/miele/__init__.py", line 130, in async_setup hass.data[DOMAIN][DATA_DEVICES] = _to_dict(client.get_devices(lang)) File "/home/homeassistant/.homeassistant/custom_components/miele/__init__.py", line 98, in _to_dict for item in items: TypeError: 'NoneType' object is not iterable

Regards Tobias

Unable to find services.yaml for the miele integration

getting this error: Unable to find services.yaml for the miele integration

image

Home Assistant 0.102.3

arch armv7l
dev false
docker true
hassio true
os_name Linux
python_version 3.7.4
timezone Europe/London
version 0.102.3
virtualenv false

System | HassOS 3.5

error during setup of miele

I finally got my credentials; linked the dev keys to my account and I get the following errors:

019-05-30 00:18:19 ERROR (MainThread) [custom_components.miele.miele_at_home] Failed to retrieve devices: 504
2019-05-30 00:18:19 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1776223152] 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1141, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1163, in _execute_service
    await handler.func(service_call)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/configurator/__init__.py", line 221, in async_handle_service_call
    call.data.get(ATTR_FIELDS, {}))
  File "/config/custom_components/miele/__init__.py", line 79, in miele_configuration_callback
    await async_setup(hass, config)
  File "/config/custom_components/miele/__init__.py", line 130, in async_setup
    hass.data[DOMAIN][DATA_DEVICES] = _to_dict(client.get_devices(lang))
  File "/config/custom_components/miele/__init__.py", line 98, in _to_dict
    for item in items:
TypeError: 'NoneType' object is not iterable

requests_oauthlib library already installed

Not so much as an issue but more to help others: I was just trying HA Docker version 0.98.2 and it turns out the requests_oauthlib library is already installed so no additional work is required to set this up.

I can provide a PR to reflect this in the documentation but I'm not sure if this applies to more versions/distributions.

[BUG] Unstability warning in HA logs

After restart HA I got this in HA logs:

Logger: homeassistant.util.async_
Source: util/async_.py:120
First occurred: 23:23:37 (8 occurrences)
Last logged: 23:23:38

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for miele doing I/O at custom_components/miele/miele_at_home.py, line 128: refresh_token=self._token['refresh_token'])
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for miele doing I/O at custom_components/miele/miele_at_home.py, line 21: devices = self._session._session.get(MieleClient.DEVICES_URL, params={'language':lang})

state attributes lack spinning speed + finishTime slightly incorrect

Over in the file sensor.py the spinning speed is missing within the state attributes.
Further the calculated finishTime seems to be incorrect, whenever a startTime (offset) is set.
I'd like to contribute with the necessary changes - is this a welcome contribution right now?

Error Linking to Miele

I think Miele is expecting an additional variable to be passed. IF you follow instructions on Mieles site you get.....

"Something went wrong when attempting authenticating with Miele@home. The error encountered was (missing_token) Missing access token parameter.. Please try again!"

cache token gives error when restart of HA after proper configuration

Without a .miele-token-cache file. The configuration is straight forward and setting up the miele devices works great. However, if I have never need to restart HA, I get a notification in HA, stating the miele integration and platform cannot be setup, please check config. If I delete the token cache file, restart HA, and go through the Oauth grant flow, everything works fine until the next restart of HA and this process needs to completed again.

Spam of errors in the log?

I get ALOT of errors in my log, about 1800 lines in 3 hours, from this integration.
my washing machine is still visible and updating in hass.
But my logs is rather hard to read for errors with all these entries.

LOGS

Any idea @docbobo

Thx for a great integration, it has increased the WAF a lot.

Assertion error

unning the miele integration with HA 115 gives:
Logger: homeassistant
Source: helpers/entity.py:438
First occurred: 12:26:14 (7 occurrences)
Last logged: 12:26:44

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/custom_components/miele/init.py", line 148, in refresh_devices
platform.update_device_state()
File "/home/homeassistant/.homeassistant/custom_components/miele/sensor.py", line 72, in update_device_state
device.async_schedule_update_ha_state(True)
File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 438, in async_schedule_update_ha_state
assert self.hass is not None
AssertionError

several times per second.

Component doesn't work anymore since a few days

Since a few days the component isn't working anymore:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token
    raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 193, in _async_setup_component
    result = await asyncio.wait_for(task, SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/miele/__init__.py", line 127, in async_setup
    data_get_devices = await client.get_devices(lang)
  File "/config/custom_components/miele/miele_at_home.py", line 41, in get_devices
    home_devices = await self._get_devices_raw(lang)
  File "/config/custom_components/miele/miele_at_home.py", line 24, in _get_devices_raw
    devices = await self.hass.async_add_executor_job(func)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 497, in request
    self.auto_refresh_url, auth=auth, **kwargs
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 446, in refresh_token
    self.token = self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in validate_token_parameters
    raise MissingTokenError(description="Missing access token parameter.")
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.

As the error is "token_expired" I created a new token but run into the same error.

Component suddenly stopped working

My component was working great until it just stopped working. You can find my error log below. I didn't change any settings.

Using Hass.io 0.96.5 on a RBP 3 model B+

2019-08-05 18:17:07 ERROR (MainThread) [homeassistant.setup] Error during setup of component miele Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 153, in _async_setup_component hass, processed_config) File "/config/custom_components/miele/__init__.py", line 116, in async_setup cache_path=cache) File "/config/custom_components/miele/miele_at_home.py", line 103, in __init__ self.refresh_token() File "/config/custom_components/miele/miele_at_home.py", line 128, in refresh_token refresh_token=self._token['refresh_token']) File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 374, in refresh_token self.token = self._client.parse_request_body_response(r.text, scope=self.scope) File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 415, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 425, in parse_token_response validate_token_parameters(params) File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 435, in validate_token_parameters raise MissingTokenError(description="Missing access token parameter.") oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.