pyimaprotect - Python IMA Protect Alarm UNOFFICIAL
This work is originally developed for use with Home Assistant and the custom component imaprotect.
- Free software: MIT license
- Documentation: https://pyimaprotect.readthedocs.io.
Since the last update of IMAProtect "API" (05/2021), this plugin allows you to:
- get the status of your alarm:
from pyimaprotect import IMAProtect, STATUS_NUM_TO_TEXT
ima = IMAProtect('myusername','mysuperpassword')
# Use contract_number if you have multiple contracts, headless if you want to run in headless mode, timeout if you want to set a custom timeout and remote_webdriver if you use a remote webdriver for selenium, see https://hub.docker.com/r/selenium/standalone-firefox
# ima = IMAProtect(username='myusername', password='mysuperpassword', contract_number='contractid', headless=True, timeout=30, remote_webdriver='http://localhost:4444')
print("# Get Status")
imastatus = ima.status
print("Current Alarm Status: %d (%s)" % (imastatus,STATUS_NUM_TO_TEXT[imastatus]))- set the status of your alarm:
from pyimaprotect import IMAProtect
ima = IMAProtect('myusername','mysuperpassword')
print("# Set Status")
ima.status = 0 # 0 to OFF, 1 to PARTIAL and 2 to On- get the list and information of your registered contacts:
from pyimaprotect import IMAProtect
ima = IMAProtect('myusername','mysuperpassword')
print("# Get Contact List")
contact_list = ima.get_contact_list()
for contact in contact_list:
print(contact)- download the images/photos taken with your connected elements:
from pyimaprotect import IMAProtect
ima = IMAProtect('myusername','mysuperpassword')
print("# Download Images")
ima.download_images() # Download images to 'Images/' folder. One subfolder per camera.
ima.download_images("MyImages/") # Download images to a defined directory 'MyImages/' folder.- username: Username used to connect to https://www.imaprotect.com/
- password: Password used to connect to https://www.imaprotect.com/
- contract_number (optional): Contract number if you have multiple contracts.
- remote_webdriver (optional): URL of the remote webdriver server if you use one (e.g. http://localhost:4444).
Using the remote_webdriver parameter is useful if you are using a selenium server like the selenium/standalone-firefox docker image. .. note:: Example docker-compose to run a Selenium standalone-firefox server (use as remote_webdriver)
services:
firefox:
image: selenium/standalone-firefox:130.0-20251025
shm_size: 2g
ports:
- "4444:4444"
- "7900:7900"# Usage: - 1. Save this as docker-compose.yml in the project folder. - 2. Start with: docker-compose up -d - 3. Use remote_webdriver='http://localhost:4444' when creating IMAProtect.
- login(): open a session with the IMA Protect Alarm website
- logout(): close the session with the IMA Protect Alarm website
- status: property to get or set the status of your IMA Protect Alarm. See the next table to understand the values.
- get_contact_list(): get a JSON with the list and information about your registered contacts.
- download_images(): download the images/photos taken with your connected elements.
| Alarm Value | State |
|---|---|
| -1 | UNKNOWN |
| 0 | OFF |
| 1 | PARTIAL |
| 2 | ON |