mirror of
https://github.com/nymea/nymea-plugins.git
synced 2026-07-19 00:54:53 +02:00
WIP: Philips air purifier
This commit is contained in:
parent
6eaa507bbc
commit
ffbc668abb
@ -42,6 +42,7 @@ PLUGIN_DIRS = \
|
||||
openuv \
|
||||
openweathermap \
|
||||
osdomotics \
|
||||
philipsaircontrol \
|
||||
philipshue \
|
||||
pushbullet \
|
||||
pushnotifications \
|
||||
|
||||
1
philipsaircontrol/README.md
Normal file
1
philipsaircontrol/README.md
Normal file
@ -0,0 +1 @@
|
||||
# TODO
|
||||
29
philipsaircontrol/integrationpluginphilipsaircontrol.json
Normal file
29
philipsaircontrol/integrationpluginphilipsaircontrol.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "philipsAirControl",
|
||||
"displayName": "Philips air control",
|
||||
"id": "c9e1b63a-d140-4a6e-9897-b3f21ce4620b",
|
||||
"vendors": [
|
||||
{
|
||||
"id": "0ae1e001-2aa6-47ed-b8c0-334c3728a68f",
|
||||
"name": "philips",
|
||||
"displayName": "Philips",
|
||||
"thingClasses": [
|
||||
{
|
||||
"id": "65b70505-6500-43ed-b4b8-2d011c5f3594",
|
||||
"name": "purifier",
|
||||
"displayName": "Air purifier",
|
||||
"createMethods": ["Discovery"],
|
||||
"paramTypes": [
|
||||
{
|
||||
"id": "870c2920-b829-46db-8196-fbd4d8e93885",
|
||||
"name": "ip",
|
||||
"displayName": "IP Address",
|
||||
"defaultValue": "",
|
||||
"type": "QString"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
40
philipsaircontrol/integrationpluginphilipsaircontrol.py
Normal file
40
philipsaircontrol/integrationpluginphilipsaircontrol.py
Normal file
@ -0,0 +1,40 @@
|
||||
import nymea
|
||||
from pyairctrl.http_client import HTTPAirClient
|
||||
|
||||
# py-air-control library: https://github.com/rgerganov/py-air-control/blob/master/pyairctrl/airctrl.py
|
||||
|
||||
# Map nymea things to library devices
|
||||
purifiersMap = {}
|
||||
|
||||
|
||||
def discoverThings(info):
|
||||
logger.log("Discovering Philips air purifiers...")
|
||||
try:
|
||||
devices = HTTPAirClient.ssdp(timeout=1, repeats=3)
|
||||
except Exception as e:
|
||||
logger.warn("Discovery failed:", str(e))
|
||||
info.finish(nymea.ThingErrorHardwareNotAvailable, "No air purifiers found. Make sure it is connected to your WiFi.");
|
||||
return
|
||||
|
||||
for device in devices:
|
||||
logger.log("Found Philips air purifier:", device["ip"])
|
||||
thingDescriptor = nymea.ThingDescriptor(purifierThingClassId, device["modelName"], device["modelNumber"], device["friendlyName"])
|
||||
# TODO: Store serial number instead of IP in params and re-discover in setupThing
|
||||
thingDescriptor.params = [
|
||||
nymea.Param(purifierThingIpParamTypeId, device["ip"])
|
||||
]
|
||||
|
||||
info.addDescriptor(thingDescriptor)
|
||||
|
||||
logger.log("Discovery finished.")
|
||||
info.finish(nymea.ThingErrorNoError)
|
||||
|
||||
|
||||
def setupThing(info):
|
||||
ip = info.paramValue(purifierThingIpParamTypeId)
|
||||
purifier = HTTPAirClient(ip, debug=True)
|
||||
purifiersMap[info.thing] = purifier
|
||||
info.finish(nymea.ThingErrorNoError)
|
||||
return
|
||||
|
||||
|
||||
5
philipsaircontrol/philipsaircontrol.pro
Normal file
5
philipsaircontrol/philipsaircontrol.pro
Normal file
@ -0,0 +1,5 @@
|
||||
TEMPLATE = aux
|
||||
|
||||
OTHER_FILES = integrationpluginphilipsaircontrol.json \
|
||||
integrationpluginphilipsaircontrol.py
|
||||
|
||||
36
philipsaircontrol/requirements.txt
Normal file
36
philipsaircontrol/requirements.txt
Normal file
@ -0,0 +1,36 @@
|
||||
py-air-control==2.2.0 \
|
||||
--hash=sha256:5cb77caac375d015525ab57d8d9da80b4e7a4f1039a0b2a266e0bb5fcace8d9d \
|
||||
--hash=sha256:ad49e170573f07648c6d5da96f0ffc60dac077e1ce297a6a5b5497745a2967a7
|
||||
pycryptodomex==3.10.1 \
|
||||
--hash=sha256:00a584ee52bf5e27d540129ca9bf7c4a7e7447f24ff4a220faa1304ad0c09bcd \
|
||||
--hash=sha256:04265a7a84ae002001249bd1de2823bcf46832bd4b58f6965567cb8a07cf4f00 \
|
||||
--hash=sha256:0bd35af6a18b724c689e56f2dbbdd8e409288be71952d271ba3d9614b31d188c \
|
||||
--hash=sha256:20c45a30f3389148f94edb77f3b216c677a277942f62a2b81a1cc0b6b2dde7fc \
|
||||
--hash=sha256:2959304d1ce31ab303d9fb5db2b294814278b35154d9b30bf7facc52d6088d0a \
|
||||
--hash=sha256:36dab7f506948056ceba2d57c1ade74e898401960de697cefc02f3519bd26c1b \
|
||||
--hash=sha256:37ec1b407ec032c7a0c1fdd2da12813f560bad38ae61ad9c7ce3c0573b3e5e30 \
|
||||
--hash=sha256:3b8eb85b3cc7f083d87978c264d10ff9de3b4bfc46f1c6fdc2792e7d7ebc87bb \
|
||||
--hash=sha256:3dfce70c4e425607ae87b8eae67c9c7dbba59a33b62d70f79417aef0bc5c735b \
|
||||
--hash=sha256:418f51c61eab52d9920f4ef468d22c89dab1be5ac796f71cf3802f6a6e667df0 \
|
||||
--hash=sha256:4195604f75cdc1db9bccdb9e44d783add3c817319c30aaff011670c9ed167690 \
|
||||
--hash=sha256:4344ab16faf6c2d9df2b6772995623698fb2d5f114dace4ab2ff335550cf71d5 \
|
||||
--hash=sha256:541cd3e3e252fb19a7b48f420b798b53483302b7fe4d9954c947605d0a263d62 \
|
||||
--hash=sha256:564063e3782474c92cbb333effd06e6eb718471783c6e67f28c63f0fc3ac7b23 \
|
||||
--hash=sha256:72f44b5be46faef2a1bf2a85902511b31f4dd7b01ce0c3978e92edb2cc812a82 \
|
||||
--hash=sha256:8a98e02cbf8f624add45deff444539bf26345b479fc04fa0937b23cd84078d91 \
|
||||
--hash=sha256:940db96449d7b2ebb2c7bf190be1514f3d67914bd37e54e8d30a182bd375a1a9 \
|
||||
--hash=sha256:961333e7ee896651f02d4692242aa36b787b8e8e0baa2256717b2b9d55ae0a3c \
|
||||
--hash=sha256:9f713ffb4e27b5575bd917c70bbc3f7b348241a351015dbbc514c01b7061ff7e \
|
||||
--hash=sha256:a6584ae58001d17bb4dc0faa8a426919c2c028ef4d90ceb4191802ca6edb8204 \
|
||||
--hash=sha256:c2b680987f418858e89dbb4f09c8c919ece62811780a27051ace72b2f69fb1be \
|
||||
--hash=sha256:d8fae5ba3d34c868ae43614e0bd6fb61114b2687ac3255798791ce075d95aece \
|
||||
--hash=sha256:dbd2c361db939a4252589baa94da4404d45e3fc70da1a31e541644cdf354336e \
|
||||
--hash=sha256:e090a8609e2095aa86978559b140cf8968af99ee54b8791b29ff804838f29f10 \
|
||||
--hash=sha256:e4a1245e7b846e88ba63e7543483bda61b9acbaee61eadbead5a1ce479d94740 \
|
||||
--hash=sha256:ec9901d19cadb80d9235ee41cc58983f18660314a0eb3fc7b11b0522ac3b6c4a \
|
||||
--hash=sha256:f2abeb4c4ce7584912f4d637b2c57f23720d35dd2892bfeb1b2c84b6fb7a8c88 \
|
||||
--hash=sha256:f3bb267df679f70a9f40f17d62d22fe12e8b75e490f41807e7560de4d3e6bf9f \
|
||||
--hash=sha256:f933ecf4cb736c7af60a6a533db2bf569717f2318b265f92907acff1db43bc34 \
|
||||
--hash=sha256:fc9c55dc1ed57db76595f2d19a479fc1c3a1be2c9da8de798a93d286c5f65f38
|
||||
CoAPthon3==1.0.1 \
|
||||
--hash=sha256:ddd290fda41ccb2c9a98ebbfae89dbafdd8e797af829a61d59e44a3c1ae7cbf0
|
||||
Loading…
x
Reference in New Issue
Block a user