Closed palazzem closed 4 years ago
[{'Active': True,
'ActivePartial': False,
'Max': False,
'Activable': True,
'ActivablePartial': False,
'InUse': True,
'Id': 466,
'Index': 0,
'Element': 1,
'CommandId': 0,
'InProgress': False}, ...]
[{'Alarm': False,
'MemoryAlarm': False,
'Excluded': False,
'InUse': True,
'IsVideo': False,
'Id': 1010,
'Index': 0,
'Element': 1,
'CommandId': 0,
'InProgress': False}, ...]
Unfortunately APIs don't provide the name of the area or the item in alerted state. To grab the actual name, we can use beautifulsoup4
and do scraping on main pages:
Extraction:
from bs4 import BeautifulSoup
page = client._session.get("https://connect.elmospa.com/vendor/Areas") # or Inputs
tree = BeautifulSoup(page.text, "html.parser")
rows = tree.select('tbody > tr')
areas = [x.getText().split('\n')[1] for x in rows]
# Output: ['Entryway', 'Kitchen', 'Bathroom', 'Something', 'Perimeter']
# Output: ['Door', 'Window']
status = client.check()
print(status)
# Output:
{
"areas_armed": [{"id": 0, "name": "Entryway"}, ...],
"areas_disarmed": [{"id": 1, "name": "Kitchen"}, ...],
"inputs_alerted": [{"id": 0, "name": "Door"}, ...],
"inputs_wait": [{"id": 1, "name": "Window"}, ...],
}
Overview
At the moment is not possible to retrieve the status of the system, that is important to have a
read
capability on the system.ElmoClient
should: