Get alarm status and informations from the IMA Protect API.
Project description
pyimaprotect - Python IMA Protect Alarm UNOFFICIAL
Get information from your IMA Protect Alarm.
Parameters
username
: Username used to connect to https://pilotageadistance.imateleassistance.compassword
: Password used to connect to https://pilotageadistance.imateleassistance.com
Properties
first_name
: Firstname used in your contractlast_name
: Lastname used in your contractemail
: Email used in your contractoffer
: Offercurrently defined in your contract. Example:tout-inclus
contract_number
: Reference number of your contractalerts_enabled
: Indicates whether the alarm is currently triggered (Boolean).
You can add properties using jsonpath, see method ``
Methods
get_all_info
: return the full JSON from the IMA Protect API "me" endpoint.add_property
: allow to add a property to your object. This property will be stored the first time the API is called and each time you callget_all_info
.get_status
: return the current status of your IMA Protect Alarm. See next table to understand the values returned.
Alarm Value | State |
---|---|
0 |
ON |
1 |
PARTIAL |
2 |
OFF |
-1 |
UNKNOWN |
Example
from pyimaprotect import IMAProtect, STATUS_NUM_TO_TEXT
ima = IMAProtect('myusername','mysuperpassword')
print("# Get Status")
imastatus = ima.get_status()
print("Current Alarm Status: %d (%s)" % (imastatus,STATUS_NUM_TO_TEXT[imastatus]))
print("# Get All Info and print a subpart of the json.")
jsoninfo = ima.get_all_info()
print(jsoninfo[0]["model"])
print("# Get some existing properties (Your IDE may give you an error since the properties ar dynamically loaded)")
print("Firstname: ",ima.first_name)
print("Lastname: ",ima.last_name)
print("Email: ",ima.email)
print("Current offer: ",ima.offer)
print("Contract number: ",ima.contract_number)
print("Alarm currently triggerd: ",ima.alerts_enabled)
print("# Add a new property using jsonpath on the 'get_all_info' json.")
ima.add_property("instructions_enabled","$..instructions_enabled")
ima.get_all_info() # To update the properties and so load the new one.
print("Instruction: ",ima.instructions_enabled)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyimaprotect-1.0.1.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for pyimaprotect-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8df734f76bf440e0c3042df9a2dd77d3f15288b04317e0d71df85d91b5e1d5d |
|
MD5 | d03f17ff0e523389b1733684337fa8b7 |
|
BLAKE2b-256 | 890c286aa1b44f57a18fe955d991bed07f1e78cad34ec3f230290047a5e62d23 |