Git Product home page Git Product logo

homescript's Issues

Homescript and homebridge are not communicating correctly

[EDIT] I had posted an issue, but I had a corrupted version of hs.py and re-installed it, and the problem changed to this:

python3 ./hs.py -s Crafting_Tables 1
Traceback (most recent call last):
File "/home/bsb/HomeScript-master/./hs.py", line 91, in
hs.setStates(sys.argv[argumentLength-1] or None)
File "/home/bsb/HomeScript-master/homescript/init.py", line 122, in setStates
item['value'][0]['value'] = int(value)
IndexError: list index out of range

Error 207 on Ring set value (alarm)

Hello

I'm using ring plugin under hombridge i'ts ok

Now I want to automate my alarm mode via script and i'm using homescript

It is correctly installed because when I run python3 hs.py -l I get all my accessories :
pi@domoticz:~$ python3 hs.py -l
Accessory/Group not found.
Here are a list of accessories:

Alarm security-panel
Base_Station hub.redsky
Baie_vitree sensor.contact
Pavé_numérique_entree security-keypad
Salle_à_manger sensor.motion
Salon Indoor Cam (stickup_cam_mini)

Now I can get the mode for Alarm :
pi@domoticz:~$ python3 hs.py -g Alarm
Alarm [{'iid': 10, 'description': 'Security System Current State', 'value': 3}, {'iid': 11, 'description': 'Security System Target State', 'value': 3}]

But now i don't now how to set the value for alarm mode (target state i believe)
I get the value for each mode :
Disarm : 3
Home: 0
Away : 1

I tried multiple things but I get every time this

<Response [207]>
Alarm Error: -70404

thans for all

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Whenever I try to run py homeScript.py -l or any other command, I get the error json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0). More specifically, the error is:

DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.42:8581
DEBUG:urllib3.connectionpool:http://192.168.2.42:8581 "GET /accessories HTTP/1.1" 200 1608
ERROR:root:<class 'Exception'>
Traceback (most recent call last):
  File "homeScript.py", line 40, in getAccessories
    getAcc = getAcc.json()
  File "C:\Users\USER\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python38\lib\json\__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\USER\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Error when running homescript to toggle wemo switch

D:\bin\HomeScript\HomeScript-master>py hs.py -s Food
Traceback (most recent call last):
File "D:\bin\HomeScript\HomeScript-master\hs.py", line 91, in
hs.setStates(sys.argv[argumentLength-1] or None)
File "D:\bin\HomeScript\HomeScript-master\homescript_init_.py", line 123, in setStates
elif item['value'][0]['value'] == 0 or item['value'][0]['value'] == False:
IndexError: list index out of range

[Error] IndexError: list index out of range

getting an index out of range error with my homebridge configuration.

Traceback (most recent call last):
File "./homeScriptO.py", line 40, in getAccessories
accessories.update({str(item['services'][1]['characteristics'][0]['value'] or item['services'][0]['characteristics'][2]['value']).replace(' ','_') : {'aid':item['aid'],'iid':item['services'][1]['characteristics'][1]['iid'],'type':item['services'][0]['characteristics'][2]['value'],'value':item['services'][1]['characteristics'][1]['value']}})
IndexError: list index out of range

got around it by adding another try/except block in getAccessories:

def getAccessories():
global getAcc
try:
getAcc = requests.get(url + 'accessories', headers=headers)
for item in getAcc.json()['accessories']:
try:
accessories.update({str(item['services'][1]['characteristics'][0]['value'] or item['services'][0]['characteristics'][2]['value']).replace(' ','_') : {'aid':item['aid'],'iid':item['services'][1]['characteristics'][1]['iid'],'type':item['services'][0]['characteristics'][2]['value'],'value':item['services'][1]['characteristics'][1]['value']}})
except:
print '!accessory exception!'
except:
# print(sys.exc_info()[0])
if sys.argv[1] == '-d' or sys.argv[1] == '--debug':
# debugHandler(str(sys.exc_info()[0]))
logging.error(Exception, exc_info=True)
print 'Exception logged: ' + exceptionFile
return accessories

homescript_debug_2020.07.18.log
homescript_exception_2020.07.18.log

[Error] Unable to set wemo smart plug

When I use hs.py to set wemo smart plug on/off, I got this exception
Traceback (most recent call last):
File "/root/hs.py", line 91, in
hs.setStates(sys.argv[argumentLength-1] or None)
File "/usr/local/lib/python3.9/dist-packages/homescript/init.py", line 124, in setStates
item['value'][0]['value'] = int(value)
IndexError: list index out of range.

I try to debug the problem, and I found if I make minor change to "/usr/local/lib/python3.9/dist-packages/homescript/init.py" file, it fixes the issue. See attached modified init.py, I am not sure if there is any other place that need to modify.

homescript_debug_2022.03.09.log
init.py.gz

installation issues

Hi, I'm trying to install this on an ubuntu VM but pip won't install complaining that "Could not find a version that satisfies the requirements."

My setup:
Ubuntu 18.04.6
pip 9.0.1
python 3.6.9

Any ideas?
Thank you.

Feature Request: Brightness Up / Down

I've written a pretty terrible bash script that gets the current brightness and then adjusts it up / down depending on the script I run:

#!/bin/bash

CURRENT=$(~/homeScript/homeScript.py -g desk | awk '{print $19}' | tr -d "},")
NEW=$(expr $CURRENT - 10)

~/homeScript/homeScript.py -s desk -b $NEW

I was wondering if there was a more elegant way to do this directly with the -b option ?
My use case in case you're curious is having them mapped to F keys on my keyboard for brightness up / down.

thanks again for a fantastic script :)

.selectGroup() seems to be required. Is it?

First, thank you for this excellent thing! :)

If I run...

hs.selectAccessory('Floor_Light')
hs.printSelectedItems()
hs.setStates("0")

No Accessories are returned and the setStates() does not work (logs attached), even though the accessory name provided comes straight out of "printAccessories()".

If I add in selectGroup('lights') as follows, two lights are returned and the action is properly executed on both...

hs.selectAccessory('Floor_Light')
hs.selectGroup('lights')
hs.printSelectedItems()
hs.setStates("0")

I've also included the super simple test python file ("Homebridge_ctl.txt").

Can't quite figure what I'm doing wrong here. THANKS for any help!

Alex

homescript_debug_2022.01.20.log
homescript_exception_2022.01.20.log
Homebridge_ctl.txt

object has no attribute 'debug'

Can you tell me what is wrong? Port and pin are correct from hb setting.

opiz:~:# python3 hs.py -l
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/homescript/init.py", line 45, in getAccessories
interfaces.append({'iid':i['iid'],'description': i['description'],'maxValue': i['maxValue'],'minValue': i['minValue'],'minStep': i['minStep'], 'value': i['value']})
KeyError: 'minStep'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "hs.py", line 56, in
hs = homescript.HomeScript(HOSTNAME,PORT,AUTH, args.debug, sys.argv)
File "/usr/local/lib/python3.7/dist-packages/homescript/init.py", line 24, in init
self.getAccessories()
File "/usr/local/lib/python3.7/dist-packages/homescript/init.py", line 51, in getAccessories
if self.debug:
AttributeError: 'HomeScript' object has no attribute 'debug'
opiz:~:#
`

Error executing script

Hi, I'm executing your script but I'm receiving some errors.

following the setting in the script:

**url = 'http://homebridgea.local:51827/'

headers = {'Content-Type': 'Application/json','authorization': '031-45-154',}**

(fyi I can ping "homebridgea")

and following the first lines in config.json:

**"bridge": {

"name": "Homebridgea",

"username": "xx:xx:xx:xx:xx:xx",

"port": 51827,

"pin": "031-45-154"

},**

I'm receiving the following error also executing the script with the "list" parameter:
pi@homebridgea:~ $ python homescript.py list
Traceback (most recent call last):
File "homescript.py", line 88, in
getAccessories()
File "homescript.py", line 24, in getAccessories
accessories.update({str(item['services'][1]['characteristics'][0]['value']) : {'aid':item['aid'],'iid':item['services'][1]['characteristics'][1]['iid'],'type':item['services'][0]['characteristics'][2]['value'],'value':item['services'][1]['characteristics'][1]['value']}})
IndexError: list index out of range

Please, let me know.

Thanks

PS: I'm executing HB in insecure mode:
HOMEBRIDGE_OPTS=-I -U /var/homebridge

AttributeError: 'HomeScript' object has no attribute 'debug'

No matter what I do, whenever I run hs.py or us the API I get this error:

Traceback (most recent call last):
  File "/home/pi/Desktop/hs.py", line 56, in <module>
    hs = homescript.HomeScript(__HOSTNAME__,__PORT__,__AUTH__, args.debug, sys.argv)
  File "/home/pi/.local/lib/python3.9/site-packages/homescript/__init__.py", line 24, in __init__
    self.getAccessories()
  File "/home/pi/.local/lib/python3.9/site-packages/homescript/__init__.py", line 51, in getAccessories
    if self.debug:
AttributeError: 'HomeScript' object has no attribute 'debug'

Incomplete list of Accessories?

First of all, thank you very much for this project!

I am a new user of Homebridge and Homescript. I have recently installed a Nest thermostat and I'm working on a way of automating the hot water activation by way of readings received from a wireless temperature sensor attached to my hot water cylinder.

My Homebridge installation, with Homebridge-nest plugin, displays four Accessories in the web interface: the thermostat itself, Eco Mode, Hot Water and Home Occupied. However, when I run hs.py -l, only the thermostat and the Home Occupied Accessories are listed. I don't really care about Eco Mode, but I need to be able to see the Hot Water Accessory.

Any ideas why that one is not appearing through Homescript?

EDIT:

So I have done some more digging. I think the reason the Eco Mode and Hot Water are not showing up is because they are not their own Accessories as defined within Homebridge-nest. Rather, they are added as services to the thermostat Accessory if the appropriate booleans are set.

Within Homescript, in the getAccessories function it only parses "item['services'][1]' whereas in my installation, Eco mode appears to be item['services'][2] and hot water appears to be item['services'][2].

(Separately, I noticed when parsing from ['characteristics'][1] onward, it misses out ['characteristics'][0] (by definition) which is the current thermostat heating/cooling state. is it necessary to skip that for any reason?)

AttributeError: 'HomeScript' object has no attribute 'debug'

Hello,

I am facing the below issue:

$python3 hs.py -s Tapo Lamp 0

Traceback (most recent call last):
File "/Users/HomeScript/homescript/init.py", line 45, in getAccessories
interfaces.append({'iid':i['iid'],'description': #i['description'],'maxValue': i['maxValue'],'minValue': i['minValue'],'minStep': i['minStep'], 'value': i['value']})
KeyError: 'maxValue'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/HomeScript/hs.py", line 56, in
hs = homescript.HomeScript(HOSTNAME,PORT,AUTH, args.debug, sys.argv)
File "/Users/HomeScript/homescript/init.py", line 24, in init
self.getAccessories()
File "/Users/HomeScript/homescript/init.py", line 51, in getAccessories
if self.debug:
AttributeError: 'HomeScript' object has no attribute 'debug'

Any ideas?
Thanks :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.