Sinope Line Voltage Thermostats

Is the version that connects directly to the gt125 still working?
I can switch version if i can control the lights and get info from the thermostats.

Yes, the direct connection to GT125 is working for all Sinopé devices. All my automations are done via that custom component. You can install it via HACS

My home assistant was installed on my pi using Hassio, is there a trick to run the device.py file on that build? Is there another way to get the api key and device id?

The commands “sudo”, “python3” or “python3.7” do not exists.

So far no reply today from Sinope support. Did they by chance contact you?

So far nothing from Sinopé. They must be buzzy since yesterday.

Normally you can ssh to your pi then cd to the directory where are located the custom components.
With ssh you have a shell where you can run any python program

Their API has changed. The way we connect to neviweb and get data from every devices is not the same than before. I’m currently making some changes in the code and will be back to you soon.

Config dir in hass.io is in /config I think.
create a sub folder «custom_components» under it and install claudegel/sinope-gt125 under a subfolder «sinope».

cd to /config/custom_components/sinope and run the command sudo python3 or 3.7 device.py
the file «sinope_devices.json» should be install under /config/.storage/
It is possible that you will need to edit device.py to put the wright config dir:
CONFIG = "/config/.storage/

same edit for climate.py, light.py and switch.py
with open('/config/.storage/sinope_devices.json') as f:

I don’t know if HACS is working nder Hass.io. if yes it’s your better choice
Don’t forget to fix files permission correctly.

I just sent a PR to @claudegel with a working version of the neviweb custom component. Once it will be merge, you’ll be able to update it through HACS. There are still some cleanup to do and some attributes may not be present at this time for some devices.

IMPORTANT NOTE: SinopĂ© has changed the unique id they used to give to our device. So, for HA, they will be seen as completely new devices and will appear in your “Unused entities” page. If you want to prevent this, before updating the custom component, go to Configuration / Entity Registry and delete all devices starting with “neviweb_”. Then update HACS, then reboot.

I’ve merged the PR. For Hassbian you will need to edit .storage/core.entity_registry to remove all «neviweb_» devices before reboot.

There seems to be a shorter session time with this new API. So the default SCAN_INTERVAL of 900 (15 min) is too long and session expire before the next update. In the log, you will see an error “SESSEXP” or something like that.
So before I make some corrections in the code, you can set a custom scan_interval: 480 (8 minutes seems to be working for me) under your neviweb: configuration entry.

In my Neviweb config I already had scan_interval: 300 (5 minutes)
There is also a login counter that will lock your account if you pass 10000 login in one day. I hit that yesterday when playing with the code.

I’m getting this error upon reboot:

[custom_components.neviweb] Received gateway data: {'error': {'code': 'VALINVLD', 'data': {'value': None, 'name': 'location$id'}}}
2019-08-22 07:55:15 ERROR (MainThread) [homeassistant.setup] Error during setup of component neviweb
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/setup.py", line 168, in _async_setup_component
    hass, processed_config
  File "/home/homeassistant/.homeassistant/custom_components/neviweb/__init__.py", line 43, in async_setup
    data = NeviwebData(hass_config[DOMAIN])
  File "/home/homeassistant/.homeassistant/custom_components/neviweb/__init__.py", line 65, in __init__
    self.neviweb_client = NeviwebClient(username, password, network)
  File "/home/homeassistant/.homeassistant/custom_components/neviweb/__init__.py", line 103, in __init__
    self.__get_gateway_data()
  File "/home/homeassistant/.homeassistant/custom_components/neviweb/__init__.py", line 171, in __get_gateway_data
    data = self.get_device_attributes(device["id"], [ATTR_SIGNATURE])
TypeError: string indices must be integers

Maybe it’s more a requests counter rather than a login counter. And at a 5 min scan interval, that would allow up to 34 devices (34 * 12 requests/hour * 24 hours = 9792 requests/day). With more devices, you’ll need to increase scan interval. Fair enough!

HACS does work under Hass.io the issue is that you cannot run commands like sudo or python from the hasio command line.
I do see all the files in the directory that you specified in the installation steps but i cannot run device.py.

Updated the component using HACS, removed all neviweb in the registry using “Configuration/Entry Registry” in the UI, restarted HA and i got the items with the new ids and everything is back to normal apparently.

I will still try to figure out how to set the gt125 version with Hassio, i’ll let you know what i find.

I got further this time.
To run “device.py”

  1. SSH in the pi that is running hassio.
  2. Install python with the command “apk add --no-cache python3”. You do not need “sudo” as you are already in admin mode when you login.
  3. Run device.py with the command “python3 device.py”.
  4. Entered the requested info.
  5. Pressed the “Web” button on the GT125

I get the id on screen but this is where it crashes, the script tries to write to a file that doesn’t exists and i get this error:

Writing config to file /home/homeassistant/.homeassistant/.storage/sinope_devices.json ... Traceback (most recent call last): File "device.py", line 192, in <module> write_config(SERVER,Api_Key,Api_ID,PORT) File "device.py", line 123, in write_config with open(CONFIG+'sinope_devices.json', 'w', encoding='utf8') as outfile: FileNotFoundError: [Errno 2] No such file or directory: '/home/homeassistant/.homeassistant/.storage/sinope_devices.json'

In the first run section of the installation procedure, it says that the file should be in “config/.storage/sinope_devices.json” but even that file doesn’t exists.

Any pointers on where to go next?

This error is because device.py cannot wright the config file in the location specified on line 13 of device.py. That location is for Hassbian. The configuration for Hass.io is under /config If it is the case you should change line 13 to something like this
CONFIG = "/config/.storage/"
if .storage does not exist just put
CONFIG = "/config/"if it work you will need to update climate.py, switch.py and light.py accordingly so they can read the config file.

check under /usr/share/hassio/homeassistant maybe better gonfiguration location.

About the error I get it look like I receive wrong data from Neviweb ??
In my log I have

Selecting 12799 network among: [{'id': 12799, 'location$id': None, 'name': 'Gestion_ici', 'postalCode': 'J3X1J6', 'mode': 'home', 'icon': 3, 'kwhCost': 0.0871, 'deviceListUpdate': '2019-08-21 02:36:33', 'modified': '2019-08-21 01:57:51', 'created': '2019-08-20 17:23:25'}] 

location$id’: None, is what I get and is what give the error for the next step:

Received gateway data: {'error': {'code': 'VALINVLD', 'data': {'value': None, 'name': 'location$id'}}}

Any Idea ?

Ok found it. When playing with my code I did some test with some parameter in config and just forget to set them back. :frowning:
Now it work