-
-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Firstly, this is a great piece of code that allows me to view and alter states of Homebridge accessories from a command line and within my python scripts. Perfect for my needs.
The code looks dormant, I don't know if there is a newer alternative to homescript for this purpose but it still mostly works for me.
I'm having an issue with a new accessory. This has spaces in the attribute name, which may be the issue?
I list my accessories
python3 hs.py -l aid
8 Christmas_tree
9 shelf_light
19 Downstairs
I look at the attributes for my Nest Thermostat - "Downstairs"
python3 hs.py -g Downstairs
Downstairs [
{'iid': 12, 'description': 'Current Heating Cooling State', 'value': 0},
{'iid': 17, 'description': 'Cooling Threshold Temperature', 'value': 18},
{'iid': 18, 'description': 'Heating Threshold Temperature', 'value': 18},
{'iid': 19, 'description': 'Status Active', 'value': 1},
{'iid': 13, 'description': 'Target Heating Cooling State', 'value': 1},
{'iid': 14, 'description': 'Current Temperature', 'value': 21},
{'iid': 15, 'description': 'Target Temperature', 'value': 18},
{'iid': 16, 'description': 'Temperature Display Units', 'value': 0}]
I try to set 'Target Temperature' to 20.
python3 hs.py -s Downstairs --'Target Temperature' 20
<Response [207]>
Downstairs Error: -70404
I try an alternative syntax in the command line
python3 hs.py -s Downstairs --t 20
<Response [207]>
Downstairs Error: -70404
To help me understand what is happening, I added a comment line in SetStates to print the value of setData just before it is trying to set the value . This prints:
{'aid': 19, 'iid': 12, 'value': 20}
This shows it is trying to set iid 12 ('Current Heating Cooling State') rather than iid 15 ('Target Temperature')
To test my theory, I added a nasty line of code just before setData is used:
setData1 = str(setData.replace("'iid': 12","'iid': 15}
print(setData1)
And then I get the next line code to use setData1 instead of setData. It prints:
{'aid': 19, 'iid': 12, 'value': 20}
{'aid': 19, 'iid': 15, 'value': 20}
And it sets the target temperature perfectly.
As I have a very simple setup and only want to control one attribute of one accessory this solution works for me.
However, if this code is still active please can you add this issue to your backlog. If it is not active and others are having a similar issue, my hacking of the code in setData seems to force the correct attribute to be set. A very ugly solution, but it gets the job done.
Many thanks
M