Sinope Line Voltage Thermostats

I’m getting an error for the indent of line 168. I remove it and added back 4 spaces and it works after (there were 5 spaces).

Here was the error log:

Testing configuration at /config
ERROR:homeassistant.scripts.check_config:BURB
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/scripts/check_config.py", line 207, in check
    res['components'] = check_ha_config_file(hass)
  File "/usr/src/app/homeassistant/scripts/check_config.py", line 367, in check_ha_config_file
    platform = loader.get_platform(hass, domain, p_name)
  File "/usr/src/app/homeassistant/loader.py", line 60, in get_platform
    return get_component(hass, PLATFORM_FORMAT.format(domain, platform))
  File "/usr/src/app/homeassistant/loader.py", line 92, in get_component
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 781, in get_code
  File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/climate/sinope_climate.py", line 168
    def set_operation_mode(self, operation_mode):
                                                ^
IndentationError: unindent does not match any outer indentation level
Fatal error while loading config: unindent does not match any outer indentation level (sinope_climate.py, line 168)
Failed config
  General Errors: 
    - unindent does not match any outer indentation level (sinope_climate.py, line 168)

Thanks I’ll update my git

Just an update. I’m able to connect with the GT125 directly with a python script from my HA pi and send a key request and receive the key. This is the first step.
I can ask data to the GT125 about devices and get answer.
for now it’s a manual process but I’m trying to make my script write automatically the request binary data.

Need to improve my python :grinning:

1 Like

I’ve used custom UI to make some customisation using the icon to show the heat level of the thermostat

icon_view2

I can add this to my git if someone want to try or improve it

1 Like

Great news Claude ! It will be a great improvement when HA will be able to communicate locally with the GT125.

we also need to switch climate component to assync.io because some function are not supported in regular mode like on/off and away mode for climate component. I’m working on that and hope to have something soon.
I’ll update my git this weekend

Hi everyone,

Happy to hear that local connectivity to gateway is progressing. This is clearly the way to go, bypassing Neviweb API!

But I’ve been working for the past few days in upgrading the current solution. I ran into some problems with this custom component that lead me to take a closer look at the code.

Here are some problems I experienced:

  • I have around 25 Sinopé devices in my home (thermostats, switches and load controller). The home-assistant.log file was always telling me errors about the Sinopé platform taking over 10 seconds to setup or just to update a single device.
  • Sending command to a device was taking a long time to complete (same with Google Home which was spinning a lot before confirming me that a specific light was turned on).
  • When a device was unavailable (lost connection), there was a crash in the logs and all my devices stop working.
  • Home Assistant restart was really long.

What I discover from examining the code was shocking! To update a single device state, we were querying all other devices that are managed by the gateway. Each device was asking for every devices information instead of only its own (even my thermostats were asking for my lights status, there was no isolation between device types).
In my case, every 15 minutes, HA was calling an update for my 25 devices and for each of them, there was 25 queries to the Neviweb API. If you do the math, that was 625 calls to Neviweb each time I wanted to update my 25 devices. That represents 60 000 queries per day for me.

That explains why Sinopé blocked our accounts back in september 2018 and were asking to increasing polling interval to 15 minutes. Now that I’ve corrected this, I only need 25 queries if I want to update my 25 devices. That represents only 2400 queries per day.
Knowing that there will be way less queries to their servers, maybe Sinopé would be willing to accept a 5 minutes interval between polling, but I haven’t ask them… mofify this interval at your own risk!

So I’ve forked @claudegel git repository to correct this. I read a lot of code and documentation about HA component/platform development. I’ve found that defining a “main” component (representing the hub) with multiples platforms (light, switch, climate) was suiting perfectly for Neviweb (central hub/gateway, communicating with multiple kind of devices). This simplifies the way you setup the component in the configuration.yaml file. It also simplifies the code behind since we now have no code duplication between platforms. Eventually, following HA recommendations, the code interacting with the API should be integrated in a separate pypi project, but for now I’ve kept it in the component.

Here is a list of upgrades / improvements I’ve made:

  • HA restart is now faster if you have multiple devices. You also get a quicker feedback after sending a command to a device (also applies to Google Home)
  • Every device now share the same Neviweb client instance to communicate with the API (instead of instanciating a new client + login for each device)
  • Each device only knows about itself and query Neviweb API only to get its own state.
  • Light and dimmer are combined in the same ‘light’ platform. Supported features (dimmable or not) are setup dynamically
  • An unavailable device won’t cause other devices to crash, but I still need work to manage this properly (you may get a stack trace in the logs)
  • Added some debug log messages to get more details in case of problems.
  • Added force=1 parameter in the URL when calling Neviweb. I guess this will force gateway to query device directly instead of returning last known value from gateway cache (Neviweb website use this parameter all the time).
  • I tried to follow Pylint rules and HA best practices for writing code
  • Away mode now use the built-in way in HA and is now separated from the operation mode, so you don’t loose your previous mode when you toggle away mode (@claudegel: I don’t understand why you would need async stuff to set away mode…)
  • Added turn_off and turn_on services in climate platform.
  • Added some attributes in the switch component to monitor current power watts and today energy kWh.
  • No need to add your gateway name in the configuration if you only have one network. It will take the first one by default.

BREAKING CHANGE: treat this as a completely new custom component. If you want to reuse your automations, you will have to change the name of your devices in all your configuration files / automations / scripts / Node-Red / … If you want to completely remove all references to the sinope component, with the new HA 0.87 you can now manage the Entity Registry in the configuration menu and delete unused entites.
All devices will now be called: neviweb_[light|switch|climate]_<name of your device>

Reasons why I decided to change from sinope to neviweb:
When you look at Neviweb website, there’s no mention of Sinopé anywhere, except in your device properties page where you can see the device model. Neviweb seems to have been created to be vendor agnostic so they could integrate differents products from differents manufacturers.
Of course, actually it’s mainly used for Sinopé products, but I’ve found some Ouellet thermostats that are compatible with Neviweb.
So, using a more generic name seems logical to me. Whatever device Neviweb will integrate in the future, this new component will be ready to accept it.

I strongly encourage everyone to use this new custom component since it will reduce the load on Neviweb servers. Sinopé may be more inclined to help us if we are doing it the right way.

Everything has been merged into @claudegel repository:


If you only want to test this new component, you can configure it in parallel with the actual sinope component without changing anything else. You’ll then be able to compare response time between the two components. If you have a few devices, you may see a noticeable difference.

I understand that communicating with Neviweb API is not the best (long-term) way of doing home automation. But with this new component, the API part is now completely separate from the HA device related code. So we could theorically remove this part and replace it by local communication with the gateway. Of course, it will need some refactoring, but I think this is a great step toward this goal. Btw, @claudegel let me know if I can be of any help with your local implementation.

N.B.: don’t expect this new component to be free of bugs!! It still needs work and proper API documentation to manage every situations.

Have fun!

1 Like

Thank you for the reformatting. Great job, we should merge to work on same code. I also have around 25 devices and splitting the code as you did will help to setup a unique direct access to the GT125.
With the GT125 we are allowed to have only one access at the same time so we cannot have each light, dimmer, swith or thermostat component that try to talk to the GT125 at the same time. Every request should go through one master connection.

About away mode I was getting NotImplementedError() when playing with turn_away_mode_on so I presume that I needed to try the assync.io way

I trying out the new component but got an error using option scan_interval is that not implemented anymore? Is there another way to set the scan_interval? I’ll test out the functionality and let you know. Thank you @zetvio and @claudegel for all the work!

@claudegel report me the same issue, we are investigating…

Scan_interval is already set in the neviweb.py. We don’t use the climate component so scan_interval is not defined. Leave it out for now we are working to fix it.

Ok no more error when setting scan_interval in configuration.yaml. Will post the fix in few minutes. Need to test if it actually follow that interval…

Tested with Sinopetech we can now reduce to 5 minutes interval between each polling to neviweb. Just change :

scan_interval: 900
to
scan_interval: 300

in configuration.yaml

1 Like

For those who are updating to HA 0.88, a new file structure has been imposed for custom components. See @claudegel github to get the new files.

Could you check your thermostat mode to see if ‘freeze protect’ mode is available on your’s. If yes which type of thermostat. Thank you

Claude, I only got this mode on my TH1300RF, which is for my heat floor.

OK so I’ll add bypass mode for freeze protect and auto (hold mode) to avoid getting problem with automation.

Hi all,
First of all i would like to thank you for the work done for this component, really helpful.

I updated to 0.89 last night and since then the thermostat stopped working. The lights are ok but i get an “Entity not available: climate.neviweb_climate_xxx” for the 2 thermostats. (xxx is a placeholder for the actual name of the unit)

I have this error in the log.

ERROR (MainThread) [homeassistant.loader] Error loading custom_components.neviweb.climate. Make sure all dependencies are installed
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/loader.py”, line 166, in _load_file
module = importlib.import_module(path)
File “/usr/local/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1006, in _gcd_import
File “”, line 983, in _find_and_load
File “”, line 967, in _find_and_load_unlocked
File “”, line 677, in _load_unlocked
File “”, line 728, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/config/custom_components/neviweb/climate.py”, line 16, in
from homeassistant.components.climate import (ClimateDevice, STATE_HEAT,
ImportError: cannot import name ‘STATE_HEAT’ from ‘homeassistant.components.climate’ (/usr/local/lib/python3.7/site-packages/homeassistant/components/climate/init.py)

HA changed the location of constants for their climate entity. We already have a fix for this, waiting to be merge in the git repo.

1 Like