Wooooorrkkingg …I should have see that !
Thank @claudegel
So it was the Api_ID ?
yes, that was it. Sorry!
Don’t be sorry… I should improve device.py to detect that and flag failed login
I’ve updated device.py to detect bad Api_ID and login fail. This should help others
I try to setup on HA and all my thermostat get following error
2019-04-09 05:48:52 ERROR (MainThread) [homeassistant.components.climate] sinope: Error on device update!
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py”, line 261, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py”, line 379, in async_device_update
await self.hass.async_add_executor_job(self.update)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/sinope/climate.py”, line 108, in update
device_data = self._client.get_climate_device_data(self._id)
File “/config/custom_components/sinope/init.py”, line 501, in get_climate_device_data
temperature = get_temperature(bytearray(send_request(self, data_read_request(data_read_command,device_id,data_temperature))).hex())
TypeError: ‘NoneType’ object is not iterable
Any idea ?
When you get None for temperature it’s because you didn’t get response from your gt125.
Did you copied over your Api_key, Api_id, IP to configuration.yaml
Did you copied over your login_answer to init.py
Tonight I’m gonna get rid of that login_answer. It won’t be needed anymore.
You’re right ! My bad again the id should be in reverse too, would make sense to change.
id: ‘<ID written on the back of your GT125>’
to
id: '<ID written on the back of your GT125 but you need to write it reversely> ’
But thank it’s working!!
@claudegel I’m interested in trying your local version to see if it works with my setup(I’m not using Rasp Pi anymore). Once you start the setup does it prevent you from using the neviweb version of the component or are they both compatible at the same time?
The two component are completely separated. I run both at the same time on raspbian. Just be carefull that your automation do not conflict because they act one same devices😀
I’ll try to fix that tonight so it will make intall more easy
Ok I’ve removed the need to reverse your ID. Just write it as it appear on the back of your GT125, no spaces. It will be the same in configuration.yaml.
We don’t need any more to write the login_answer. Device.py will test for login fail and let you know
Now I’m going to change init.py to have the same for the Api_ID and login-answer.
ok init.py is updated for the api_id. no more need to reverse it
Nice! Just test it! it’s working.
Thank you!
PS: If we want to make it cleaner, we can remove the line 16.
You can have both neviweb and sinope at the same time
Clean up done. let me know if we need to remove something else.
Now I’ll see if I can ask for device name once we get the ID to fill devices.json with more data at once.
I’ve added to device.py the possibility to add device name, type and watt load as you discover a new device. You can add data or leave it blank if you don’t have device type or watt load available at this moment. I’ve added a loop to go through each device discovery with a single run of the program.It is still possible to edit devices.json to complete the missing data.
Just test it, that way easier now @claudegel !
Just for the best user experience, maybe replace this ?
Add device type, or leave empty
to
Add device type (see climate.py, light.py or switch.py), or leave empty
Because new user will only know where to find the type at the end of execution.
Or maybe print the type from the file something like
$ cat switch.py climate.py light.py | grep "^type "
You may need to add a unique TAG for the best grep like filter.
(…ok ok to munch first option is easier )
Added.
I’ll see if we can list device type somewhere. Maybe in one small file that list all of them ?
Should be easier to open one file then opening three different file to get the info.
Sound good, that mean climate.py, light.py and switch.py should point to that one small file in documentation. In case a new type coming.
The best way would be, if that possible in python, having import devices_type.py and put everything about the device type, even IMPLEMENTED_DEVICE_TYPES_*.
That way you can just have a method getDevicesTypeDescription() inside of reading a file.