petterl / python-sectoralarm Goto Github PK
View Code? Open in Web Editor NEWA python module for reading and changing status of sector alarm devices through their app api.
License: MIT License
A python module for reading and changing status of sector alarm devices through their app api.
License: MIT License
hej,
får det inte riktigt att fungera, några exempel:
pi@raspberry:~ $ sudo sectoralarm "[email protected]" "xxxxx" "0000000" armstate
ger
Traceback (most recent call last):
File "/usr/local/bin/sectoralarm", line 11, in <module>
load_entry_point('sectoralarm==1.1.0', 'console_scripts', 'sectoralarm')()
File "/usr/local/lib/python3.4/dist-packages/sectoralarm/__main__.py", line 130, in main
print_result(session.get_arm_state())
File "/usr/local/lib/python3.4/dist-packages/sectoralarm/session.py", line 87, in get_arm_state
res['timeex'] = fix_date_short(res['timeex'])
File "/usr/local/lib/python3.4/dist-packages/sectoralarm/session.py", line 33, in fix_date_short
return result.isoformat()
UnboundLocalError: local variable 'result' referenced before assignment
pi@raspberry:~ $ sudo sectoralarm "[email protected]" "xxxxx" "00000" temperature
ger
Traceback (most recent call last):
File "/usr/local/bin/sectoralarm", line 11, in <module>
load_entry_point('sectoralarm==1.1.0', 'console_scripts', 'sectoralarm')()
File "/usr/local/lib/python3.4/dist-packages/sectoralarm/__main__.py", line 132, in main
print_result(session.get_temperature(args.device_label))
File "/usr/local/lib/python3.4/dist-packages/sectoralarm/session.py", line 98, in get_temperature
_validate_response(response)
File "/usr/local/lib/python3.4/dist-packages/sectoralarm/session.py", line 15, in _validate_response
raise ResponseError(response.status_code, response.text)
File "/usr/local/lib/python3.4/dist-packages/sectoralarm/session.py", line 60, in __init__
self.text = json.loads(text)
File "/usr/lib/python3.4/json/__init__.py", line 318, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.4/json/decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)
pi@raspberry:~ $ sudo sectoralarm "[email protected]" "xxxxx" "00000" set alarm "000000"
ger
Traceback (most recent call last):
File "/usr/local/bin/sectoralarm", line 11, in <module>
load_entry_point('sectoralarm==1.1.0', 'console_scripts', 'sectoralarm')()
File "/usr/local/lib/python3.4/dist-packages/sectoralarm/__main__.py", line 147, in main
args.new_status))
File "/usr/local/lib/python3.4/dist-packages/sectoralarm/session.py", line 158, in set_arm_state
urls.set_armstate(self._giid),
AttributeError: 'module' object has no attribute 'set_armstate'
Jag är fullt medveten om att det kan vara jag som inte får det rätt, testat både python 2.7 och 3.4
tips för att få det funka mottages tacksamt
Thanks for making this! Will save me a ton of time.
Running the following command should set the alarm state to partial activated:
python /usr/local/bin/sectoralarm user@name password panelId set alarm code ARMED_AWAY
Instead I get this output:
Traceback (most recent call last):
File "/usr/local/bin/sectoralarm", line 9, in
load_entry_point('sectoralarm==1.1.0', 'console_scripts', 'sectoralarm')()
File "/usr/local/lib/python2.7/dist-packages/sectoralarm/main.py", line 147, in main
args.new_status))
File "/usr/local/lib/python2.7/dist-packages/sectoralarm/session.py", line 158, in set_arm_state
urls.set_armstate(self._giid),
AttributeError: 'module' object has no attribute 'set_armstate'
It seems like set_alarm is not implemented in urls.py. Inspecting urls.py confirms that the method is not there.
I'll make a stab at implementing it and I'll give you a PR if I succeed.
Perhaps this is common knowledge for anyone who does web development, but as I hinted in #3 it was not easy to do this and I could not find any help using search engines. How did you even know that the base URL existed to begin with?
Anyways, in case it is not too much trouble or involves some shady stuff I guess it would be easier for others update in case they change urls if some methodology on how to figure out the URLs was added to the readme.
Again, thanks alot for making this!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.