The fix is merged. thanks to jeromebaron
Great news. Iāve uploaded to my git my work on direct connection to the GT125. Iāve started a new branch just for direct connection to the GT125.
Iāve implemented all command to the GT125. Data read request to get information from devices. Data write request to send data to devices and data report request to broadcast info to all devices like date, time, away mode etc.
It work for all device type. I already implemented all command for the thermostat and I can add what we need for switch, dimmer and power control.
It is exploratory work to find out how it work but the worst is done so we can start to code to link it to HA. Wright now it work in terminal mode (manualy) and I can get data from any devices, write data to any devices and broadcast information to any devices.
I hope you will like it. Itās just the beginning. Have fun
Today Iāve moved files for the GT125 direct connection to a new custom_component called sinope in order to avoid any interference with the neviweb custom_component during development. I should start soon to modify the file so it can be accessed from HA.
Updateā¦
Sinope custom_component with direct connect to GT125 is almost ready to be tested in HA.
If some voluntary people want to test to get all the bugs out, it will be greatly appreciated and will accelerate the final development. It is designed to be installed separately from Neviweb custom_component to not interfere with the one you already have installed on HA.
get it from my GIT:
https://github.com/claudegel/sinope-1/tree/Direct-connect-to-GT125/custom_components/sinope
Thank you for your help
Salut Claude,
Trying to install the new direct connection component this morning.
Iām getting the following error when I run the program for the first time.
pi@hassbian:/home/homeassistant/.homeassistant/custom_components/sinope $ python3 device.py
ok we can send the api_key request
push the GT125 <web> button
Traceback (most recent call last):
File "device.py", line 107, in <module>
print('Api key : ',retreive_key(binascii.hexlify(send_request(key_request(Api_ID)))))
File "device.py", line 83, in send_request
sock.sendall(login_request())
File "device.py", line 74, in login_request
login_data = "550012001001"+Api_ID+Api_Key
TypeError: Can't convert 'NoneType' object to str implicitly
I donāt have a delay to push the Web button. The error is thrown immediately.
Iāve updated the device.py
typo in def retreive_key(data). it was returning key_crc and it should be returning key
Iāve updated the file, but same error.
pi@hassbian:/home/homeassistant/.homeassistant/custom_components/sinope $ python3 device.py
ok we can send the api_key request
push the GT125 <web> button
Traceback (most recent call last):
File "device.py", line 107, in <module>
print('Api key : ',retreive_key(binascii.hexlify(send_request(key_request(Api_ID)))))
File "device.py", line 83, in send_request
sock.sendall(login_request())
File "device.py", line 74, in login_request
login_data = "550012001001"+Api_ID+Api_Key
TypeError: Can't convert 'NoneType' object to str implicitly
There is one thing I donāt understand. The first run of this file is to get the API key, isnāt it ? Why then, there is a call to ālogin_requestā at line 83 ? The ālogin_requestā function needs the API_Key !!!
Stupid me as I get further in my development Iāve changed send_request and forgot to keep it functional for Api_Key request.
Iāve updated the changes, sorry
Making progress here.
I was able to get the API Key. I added it to line 12 as indicated.
Now, I got the following error when running the program to retrieve the device id.
pi@hassbian:/home/homeassistant/.homeassistant/custom_components/sinope $ python3 device.py
Traceback (most recent call last):
File "device.py", line 100, in <module>
dev = get_device_id()
File "device.py", line 42, in get_device_id
return id
UnboundLocalError: local variable 'id' referenced before assignment
Iām failling a the login request.
This is the reply Iām getting from the login request :
reply from login= b'55000c0011010000000300008219000060'
Update: Ok, it seems that the login reply is specific for each network. I replaced your reply code with mine and it works. I can now discover my devices.
if binascii.hexlify(sock.recv(1024)) == b'55000c0011010000000300008219000060': #login ok
itās the device id of your GT125 that is different:
5500 0c00 1101 00 0000 030000 82190000 60
5500 preambule
0c00 data length
1101 login reply
00 status ok
0000 backoff to know if we will receive more data
030000 software version of your GT125
82190000 device id of your GT125. this is what is different
60 crc
Iāll update the doc and code to let other know about GT125 ID and change the device.py so it is easyer for then to pass that step
Ok Iāve changed device.py to add info for login answer. You will also need to add that answer to
init.py near line 97 for the sinope custom component.
Claude, the names that we put in the json file, are these the one that will be use by HA to name the entity ?
Yes
for example I have:
[ā5a2c0100ā, āLumiere bureauā, ā102ā, ā240ā]
and the name in HA will be:
[light.sinope_light_lumiere_bureau]
after it will be possible to you to set the name in HA to whatever you want but [light.sinope_light_lumiere_bureau] will be the name used in automation etc.
This is to simulate what we normally add to Neviweb for each device when we setup new device and what Neviweb is sending for each device (device_type for example)
Ha Ha good news, Iām now able to listen to event from my light devices and finding out which device is sending it. Let see if I can add that to HA
Hi All,
Iām testing HA, so Iām new. And i trying to setup the locale mode.
I got everything Api_Key (take like 5 min) and login_answer.
Now Iām stuck with (1 hour waitingā¦):
python3 device.py
Please push the two button on the device you want to identify
I press the tow button multiple time (LOC message show).
But nothing come.
I restart bridge/router wifi and still nothing.
Can anyone help me ?
HA is install on my mac (Temporary because I just testing HA).
So you got your Api_Key and write it on line 12. You got the login_answer and write it on line 17 of device.py.
If you got that far I presume that all setup is ok.
The next step is to get you device ID and device.py is asking for you to push on the two button of that device. You need to push both button at the same time and release rapidly. Push them only once. If you keep pushing for more then 5 sec it could reset your device. You may need to reconnect your device to the GT125 by pushing the connection button on the GT125 and after the two button on your device. After make sure you release the connection button on your GT125.
What type of device do you want to identify, thermostat, light, dimmer or power control ?
You wonāt see the device ID on the screen. The device ID are written in file devices.json, one device per line. Make sure devices.json file is present in the same directory. It should contain just one line at the beginning.
Iām trying to setup the thermostat.
I did push both button quickly, slowly and multiple time too, at the same time as well as before and after device.pyā¦event, restart the bridge/router and reset all thermostat .
And I supposed i push the buttons well, because the thermostat show āLOCā.
I also know about the devices.json, because I faked the line of
sock.recv(1024)
and that file was modified with the fake id. (Yes i revert back the device.py and devices.json after my test).
Can you detail more:
After make sure you release the connection button on your GT125
I try both button on the GT125, the web doesnāt do anything.
I then test one at the time. And I even test in offline mode (long press) .
Not at home now to test, but any other idea?
Iāve updated device.py to print the device ID on the screen. If you want to see what you get from
datarec = sock.recv(1024)
add the following line after
print(bytearray(datarec).hex())
this will print the complete message you get from your device, something like 550007001601002e32010037 where 2e320100 is your device ID. Please send me what you get so I can check the data. Also tell me what device you try to get the ID from, thermostat or light ?
if you receive nothing then it is possible that your device is not registered on your GT125.
Do you see your device when you log into the Neviweb portal ?
As you already got your Api-Key and your login_answer the communication is good with your GT125. Then if you receive nothing when you push the two buttons on your device it should be because your device didnāt got his ID from your GT125. You need to register your device on your GT125 first. Push the wifi button on the GT125 then push the two button on the device. Push again the wifi button on the GT125 to finish. Then you should be able to receive your ID with device.py
Iāve tested with an unregistered light device and I get nothing with device.py.
No answer is coming when I push the two buttons on the device.
Once I register my device on the GT125 I get the ID.