kidde-homesafe
A slim python wrapper of the Kidde HomeSafe private API. If you're new to python, poke around [the code][kidde_homesafe.py]; it's simple, and you may understand more than you expect.
Basic Usage
Importing and asyncio
The following code snippets assume you have imported the following:
from kidde_homesafe import KiddeClient, KiddeCommand
import asyncio
import json
They should be run in an asyncio loop, like this (see asyncio for details):
async def main() -> None:
# Kidde functions
if __name__ == "__main__":
asyncio.run(main())
Login
Use the from_login class method to create your first client:
client = await KiddeClient.from_login("test@example.com", "KiddeCloudPassword")
Reuse Cookies
You may save a client's cookies to a file:
with open("kidde_cookies.json", "w") as file:
json.dump(client.cookies, file)
And reuse them later:
with open("kidde_cookies.json") as file:
cookies = json.load(file)
client = KiddeClient(cookies)
Get Data
client.get_data returns a KiddeDataset object with locations, devices, and events. You can skip pulling devices with the get_devices=False parameter and the same with events. For example,
dataset = await client.get_data(get_events=False)
print(dataset.devices)
should print something like:
{
"918281": {
"id": 918281,
"serial_number": "00123456789Z",
"model": "wifidetector",
"notify": true,
"location_id": 018271,
"label": "Kithen",
"lost": false,
"hwrev": "WD-ESP32",
"ptt_state": "idle",
"locate_active": false,
"instance_id": "29ba9019ca",
"notify_contact": true,
"last_test_time": "2023-11-10T18:56:02Z",
"motion_active": false,
"weather_active": false,
"capabilities": [
"smoke",
"co"
],
"errors": [],
"smoke_alarm": false,
"co_alarm": false,
"smoke_level": 0,
"smoke_comp": -5,
"too_much_smoke": false,
"smoke_hushed": false,
"co_level": 0,
"fwrev": {
"wm": "2.5",
"net": "4.4.1",
"alarm": "1.10"
},
"life": 535,
"batt_volt": 0,
"battery_state": "ok",
"ptt_active": false,
"identifying": false,
"announcement": "Kitchen",
"notify_eol": true,
"diag_params": {
"ap_rssi": -47
},
"mb_model": 39,
"last_seen": "2023-11-10T18:59:02.932375951Z",
"ssid": "YourHomeWiFi",
"ap_rssi": -47,
"country_code": "US",
"longitude": 0,
"latitude": 0,
"altitude": 0,
"accuracy": 0,
"end_of_life_status": 1
}
}
Sending Device Commands
You can send API commands to your device using the KiddeCommand enum:
await client.device_command(location_id=018271, device_id=918281, KiddeCommand.IDENTIFY)
IDENTIFY is labeled "ping" in the app.
Release files for kidde-homesafe 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kidde-homesafe-0.0.3.tar.gz | 16.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kidde_homesafe-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.7 kB
Release files / kidde-homesafe-0.0.3.tar.gz
| Download URL | kidde-homesafe-0.0.3.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6dc491af45bff31c5645de825257a88339053ad9db9f3f64dd0ed488fd8a60e
|
|
BLAKE2b-256 checksum How to use checksums |
a8b3aca5e4d014d05dd28e1a8956fb3d9eaa58d4913672996d4738294d39dd0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / kidde_homesafe-0.0.3-py3-none-any.whl
| Download URL | kidde_homesafe-0.0.3-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7110774ef75269e6e3819ac3894b87f219b7bbeb3a11f18097de31168b676a72
|
|
BLAKE2b-256 checksum How to use checksums |
c8d6ae7a8882608b0122dba6f26e758f4551a25e4fa17bf94e63ec246709f5a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|