Sinope Line Voltage Thermostats

Hi Everybody

I currently have a few THT from sinope and I would like to have access to neviweb through a python or other script to read the values. Can someone help me…

Thanks

I’ve added the fix to my fork of the repo. I’ve also added code for the light components.

I’m still getting a large number of errors in the log related to getting or setting the information. It’s not erroring out all the time but enough to pollute the logs. Here is an example:

Update for climate.sinope_living_room fails
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 204, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/climate/sinope.py", line 90, in update
    self._target_temp  = float(self.sinope_data.data[self.device_id]["data"]["setpoint"])
KeyError: 'setpoint'

Hi,
Since the last update, it seems something is broken. Any similar experience?

Here’s the error:

Log Details (ERROR)
Sun Mar 11 2018 12:47:07 GMT-0400 (EDT)

Error while setting up platform sinope
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3.6/site-packages/urllib3/util/connection.py", line 60, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 850, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 284, in connect
    conn = self._new_conn()
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x73bdd830>: Failed to establish a new connection: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='neviweb.com', port=443): Max retries exceeded with url: /api/login (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x73bdd830>: Failed to establish a new connection: [Errno -3] Try again',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/climate/sinope.py", line 189, in _post_login_page
    raw_res = requests.post(LOGIN_URL, data=data, cookies=self._cookies, allow_redirects=False, timeout=self._timeout)
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='neviweb.com', port=443): Max retries exceeded with url: /api/login (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x73bdd830>: Failed to establish a new connection: [Errno -3] Try again',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/climate/sinope.py", line 46, in setup_platform
    sinope_data = SinopeData(username, password, gateway)
  File "/config/custom_components/climate/sinope.py", line 152, in __init__
    self.client = SinopeClient(username, password, gateway, REQUESTS_TIMEOUT)
  File "/config/custom_components/climate/sinope.py", line 182, in __init__
    self._post_login_page()
  File "/config/custom_components/climate/sinope.py", line 191, in _post_login_page
    raise PySinopeError("Can not submit login form")
custom_components.climate.sinope.PySinopeError: Can not submit login form

Thanks a lot

I’m on 0.65.2 and don’t have this issue.

Updated to 0.65.5 and still no issue, are you using the latest code from my repo that I posted above? @Maxime_Meunier

Yes @dj21d, I still have error msg when I boot HA

Do you have an idea?

Here it is:

Error while setting up platform sinope
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/climate/sinope.py", line 47, in setup_platform
    sinope_data.update()
  File "/config/custom_components/climate/sinope.py", line 158, in update
    self.client.fetch_data()
  File "/config/custom_components/climate/sinope.py", line 240, in fetch_data
    sinope_data.update({ device["id"] : { "info" : device, "data" : self._get_data_device(device["id"]) }})
TypeError: string indices must be integers

Oh, I finally found the problem. The gateway name has changed :-/

Now it works :slightly_smiling_face:

Hi, i am having trouble with the Sinope components. The climate one works but very often i have some errors about it in the logs, and the one for the light is not working. Do you have any ideas ? here’s the log :

Blockquote
2018-03-31 17:31:10 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.sinope_cuisine__salon fails
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 204, in async_update_ha_state
yield from self.async_device_update()
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 327, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/climate/sinope.py”, line 89, in update
self._target_temp = float(self.sinope_data.data[self.device_id][“data”][“setpoint”])
KeyError: ‘setpoint’
2018-03-31 17:32:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.sinope_chambre_maitres fails
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 204, in async_update_ha_state
yield from self.async_device_update()
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 327, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/climate/sinope.py”, line 89, in update
self._target_temp = float(self.sinope_data.data[self.device_id][“data”][“setpoint”])
KeyError: ‘setpoint’
2018-03-31 17:32:14 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.sinope_cuisine__salon fails
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 204, in async_update_ha_state
yield from self.async_device_update()
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 327, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/climate/sinope.py”, line 89, in update
self._target_temp = float(self.sinope_data.data[self.device_id][“data”][“setpoint”])
KeyError: ‘setpoint’
2018-03-31 17:34:17 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.sinope_cuisine__salon fails
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 204, in async_update_ha_state
yield from self.async_device_update()
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 327, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/climate/sinope.py”, line 89, in update
self._target_temp = float(self.sinope_data.data[self.device_id][“data”][“setpoint”])
KeyError: ‘setpoint’
2018-03-31 17:35:17 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.sinope_chambre_maitres fails
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 204, in async_update_ha_state
yield from self.async_device_update()
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 327, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/climate/sinope.py”, line 89, in update
self._target_temp = float(self.sinope_data.data[self.device_id][“data”][“setpoint”])
KeyError: ‘setpoint’
2018-03-31 17:41:38 ERROR (Thread-5) [homeassistant.loader] Unable to find component light.sinope
2018-03-31 17:41:46 ERROR (Thread-21) [homeassistant.loader] Unable to find component light.sinope
2018-03-31 17:42:10 WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from nmap_tracker took longer than the scheduled scan interval 0:00:12
2018-03-31 17:42:42 ERROR (Thread-16) [homeassistant.loader] Unable to find component light.sinope
2018-03-31 17:42:42 ERROR (MainThread) [homeassistant.components] Platform not found: light.sinope

Thanks ,

I’ve uploaded code for sinope dimmer, light and power switch to my git. It’s based on dj21d and irogoff code. See https://github.com/claudegel/sinope-1

Hi claudegel,

I did copied all the files from github and configured them in my config file ;

climate:

  • platform: sinope
    username: !secret user_sinope
    password: !secret pass_sinope
    gateway: !secret gateway_sinope

light:

  • platform: sinope
    username: !secret user_sinope
    password: !secret pass_sinope
    gateway: !secret gateway_sinope

But i am still getting an error for the light component only :

2018-04-02 10:25:30 ERROR (MainThread) [homeassistant.loader] Unable to find component light.sinope

Can you help me with that please ?
Thanks,

Hi you should put the name of the file which is sinope_light.py (without the .py)

ex.
light:

  • platform: sinope_light
    username: !secret climate_username
    password: !secret climate_password
    gateway: !secret climate_gateway
  • platform: sinope_dimmer
    username: !secret climate_username
    password: !secret climate_password
    gateway: !secret climate_gateway

also the file sinope_light.py should be placed under custom_components/light/ for the light and dimmer. For the power switch it is under custom_components/switch/
switch:
- platform: sinope_switch
username: !secret climate_username
password: !secret climate_password
gateway: !secret climate_gateway

or if you want you can change the name of the files to sinope.py in each directory but this can make some confusion in the log file. That’s why I’ve put a different name for each

see my other post

Thank you very much,

Merci Beaucoup ca fonctionne très bien maintenant !!

It work !!! You made my day.

Is there any way to show support for your developpement ? I would like to buy you a beer or 2.

Also, I say some error in the log. See below :

Update for light.sinope_dimmer_table__cuisine fails
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 204, in async_update_ha_state
yield from self.async_device_update()
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 327, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/light/sinope_dimmer.py”, line 80, in update
self._brightness = brightness_from_percentage(int(self.sinope_data.data[self.device_id][“data”][“intensity”]))
KeyError: 'intensit

That error appear if you poll neviweb too often. You don’t receive response and intensity is not set. I need to add a retry loop to avoid that error. I’m also working on a direct access to the web interface so we won’t need neviweb.

Since upgrade to 0.77.3 my custom_components sinopé for thermostat, dimmer, light and power switch don’t load anymore. In the log there is a specific message:

You are using a custom component for light.sinope_dimmer 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.

nothing else and those component do not appear anymore. Anybody have the same issue ?

Same version here and mine are working fine. I’ve noticed that message for a few months now but it doesn’t affect anything.

Only thing I’ve found in log is:

File “/home/homeassistant/.homeassistant/custom_components/climate/sinope.py”, line 196, in _post_login_page
self._headers = {“Session-Id”: raw_res.json()[“session”]}
KeyError: ‘session’

I’m using version 0.77.3 without any problem.

Are you sure your credentials are correct? Try to login at neviweb.com with what you have in your configuration. In case of a bad password, response will be {"error":{"code":1002}} that may explain why the “session” key is not found.

Stupid mistake. I did reset my password on my cellphone app and forgot to update my HA password
I’ll try to set up more then one account at neviweb.com so the HA password won’t be changed by mistake