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. It only allows to get status, not to change the status. This work is originally developed for use with Home Assistant and the custom component imaprotect. This work is based on the work of lplancke for Jeedom.
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 |
OFF |
1 |
PARTIAL |
2 |
ON |
-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.2.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for pyimaprotect-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 627f216f63b703b12d0fb5f26c0cd44c66d36043de1e43c41f470d91e828c9f7 |
|
MD5 | 5d53f506b959bf95066cef75f96aca94 |
|
BLAKE2b-256 | 5f10e3e103a16f5fdc15be934e52c14c8986df1d59d20c1e724d1521f97d2cc2 |