Sensibo thermostat components & Displaying information on Apple Watch

I have a few custom components setup that I wanted to share with the community, uploaded to a dedicated repository on github:

  • Sendibo components for my “smart” thermostat - based on the API they provide I created a switch component for on/off only, sensor component to present the measured temperature and humidity and a couple of versions for climate component.
  • A notification platform based on pushover – but rather than using the original API for push notifications, this one is using the “Glances” API which is meant to seamlessly push information to Apple Watch placeholders on the watch face

My repository is at: https://github.com/Amir974/home-assistant-custom-components

If anyone would like to take it further and incorporate them as built-in components I would love to assist as much as I can.

Let me know what you think, if the instructions are clear or if you spot anything that would require further attention… working on these components made me appreciate even more the wonderful work the various contributors here have done :thumbsup:

1 Like

looking forward to trying the notify component. will report back when i have tried it…

any problems ? thoughts ?

Great work, my Sensibo arrived today and thanks to your efforts is already integrated with HA.

I’m having an intermittent issue with connection to the sensibo api, :

17-01-10 23:38:01 homeassistant.core: Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 138, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py", line 98, in create_connection
    raise err
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py", line 88, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 350, in _make_request
    self._validate_conn(conn)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 835, in _validate_conn
    conn.connect()
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 281, in connect
    conn = self._new_conn()
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 147, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x69ec10b0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 643, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/retry.py", line 363, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='home.sensibo.com', port=443): Max retries exceeded with url: /api/v2/users/me/pods?fields=id%2Croom&apiKey=myapikeyhere (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x69ec10b0>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 386, in _update_entity_states
    yield from update_coro
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 216, in async_update_ha_state
    yield from self.hass.loop.run_in_executor(None, self.update)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/climate/sensibosettingsonly.py", line 137, in update
    devices = client.devices()
  File "/home/homeassistant/.homeassistant/custom_components/climate/sensibosettingsonly.py", line 37, in devices
    result = self._get("/users/me/pods", fields="id,room")
  File "/home/homeassistant/.homeassistant/custom_components/climate/sensibosettingsonly.py", line 26, in _get
    response = requests.get(_SERVER + path, params = params)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/adapters.py", line 487, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='home.sensibo.com', port=443): Max retries exceeded with url: /api/v2/users/me/pods?fields=id%2Croom&apiKey=myapikeyhere (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x69ec10b0>: Failed to establish a new connection: [Errno 111] Connection refused',))
17-01-10 23:38:02 homeassistant.components.media_player.onkyo: Resetting connection to AVReceiver.
17-01-10 23:38:02 custom_components.switch.sensiboswitch: Sensibo uid =ZV4XJxEU
17-01-10 23:38:02 homeassistant.core: Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 138, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py", line 98, in create_connection
    raise err
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py", line 88, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 350, in _make_request
    self._validate_conn(conn)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 835, in _validate_conn
    conn.connect()
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 281, in connect
    conn = self._new_conn()
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 147, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x6e0ee8d0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 643, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/packages/urllib3/util/retry.py", line 363, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='home.sensibo.com', port=443): Max retries exceeded with url: /api/v2/pods/ZV4XJxEU/acStates?fields=status%2Creason%2CacState&apiKey=myapikeyhere&limit=1 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x6e0ee8d0>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 386, in _update_entity_states
    yield from update_coro
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 216, in async_update_ha_state
    yield from self.hass.loop.run_in_executor(None, self.update)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/switch/sensiboswitch.py", line 103, in update
    current_settings = client.pod_ac_state(uid)
  File "/home/homeassistant/.homeassistant/custom_components/switch/sensiboswitch.py", line 44, in pod_ac_state
    result = self._get("/pods/%s/acStates" % podUid, limit = 1, fields="status,reason,acState")
  File "/home/homeassistant/.homeassistant/custom_components/switch/sensiboswitch.py", line 25, in _get
    response = requests.get(_SERVER + path, params = params)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/requests/adapters.py", line 487, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='home.sensibo.com', port=443): Max retries exceeded with url: /api/v2/pods/ZV4XJxEU/acStates?fields=status%2Creason%2CacState&apiKey=myapikeyhere&limit=1 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x6e0ee8d0>: Failed to establish a new connection: [Errno 111] Connection refused',))

Any help appreciated.

Glad to hear someone is benefiting for this effort :smile:

a few questions for you so I can see if this is happening on my end as well:

  • What is the logger setting you have in the configuration ?

  • Do you see the climate settings update? does changing settings in the climate component / switch component effect the pod?

  • Out of curiosity, how many pods do you have? (I wrote the code for a single pod, so more may pose an issue)

a couple of notes to consider

  • I saw errors from time to time in my log, but all in all the code works, info appears and updates regularly, also commands effect my pod with no significant lag without a fault.
  • I checked with Sensibo support, they have no limits on api calls and don’t see any problems with my user account in terms of API usage
  • You might consider sending [email protected] the specific error (not the whole log) and ask them what it means / if it’s from their end / can they check the specific operation log on their end for your account around the same time… they are super friendly :slight_smile:
  • Since you are using 2 components that are basically using the same API, it’s possible some calls are made too close to one another and so some of them falls through but overall does not effect the operation ? (that’s just a guess)

Is this inside hass now?

Unfortunately no, I am not a part of the active dev ppl, don’t have the environment / time to do this and also since I only have 1 pod - I am not sure I would do a good job adapting this to multiple :slight_frown:

I would love it if someone picked this up and integrate to the platform, but for now it’s served as a custom component that anyone can add fairly simply I hope.

(maybe you can add a feature request and it’ll get done in a future version)

1 Like

Hello, Thank you a lot for the code!
I’m intrested by the Sensibo part but I’m new to HA.
Can you let me know how you integrate the custom_components in the config.yaml file?
I get the arror below when I do a config check before restart:
Platform error climate.sensibosettingsonly - Integration ‘sensibosettingsonly’ not found.
Component error: customize - Integration ‘customize’ not found.
Platform error switch.sensiboswitch - Integration ‘sensiboswitch’ not found.

This is a real blast from the past @PierreCa :slight_smile:

Sensibo got official support a few months after I wrote that post so that code is not maintained or relevant these days.

Please check the formal integration https://www.home-assistant.io/integrations/sensibo/

good luck!