| 1 |
from .button import GateBoxSecondOutput, TvLift |
| 2 |
from .cover import Gate, GateBox, GateBoxB, Shutter |
| 3 |
from typing import Union, Any |
| 4 |
|
| 5 |
|
| 6 |
_DEFAULT_API_LEVEL = 20151206 |
| 7 |
|
| 8 |
|
| 9 |
def get_conf_set(product_type: str) -> dict: |
| 10 |
"""Get all configurations for provided product type.""" |
| 11 |
conf_set = BOX_TYPE_CONF.get(product_type, {}) |
| 12 |
return conf_set |
| 13 |
|
| 14 |
|
| 15 |
def get_conf(api_level: Union[int, str], conf_set: dict) -> dict: |
| 16 |
"""Get configuration from conf_set for provided api_level.""" |
| 17 |
for min_api_level in sorted(conf_set, reverse=True): |
| 18 |
if api_level >= min_api_level: |
| 19 |
return conf_set[min_api_level] |
| 20 |
|
| 21 |
return {} |
| 22 |
|
| 23 |
|
| 24 |
def get_latest_conf(product_type: str) -> dict: |
| 25 |
"""Get latest configuration for provided product type.""" |
| 26 |
conf_set = get_conf_set(product_type) |
| 27 |
if conf_set: |
| 28 |
latest_min_api_level = sorted(conf_set, reverse=True)[0] |
| 29 |
return conf_set[latest_min_api_level] |
| 30 |
|
| 31 |
return conf_set |
| 32 |
|
| 33 |
|
| 34 |
def get_latest_api_level(product_type: str) -> Union[dict, int]: |
| 35 |
"""Get latest supported api_level for provided product type.""" |
| 36 |
conf_set = get_conf_set(product_type) |
| 37 |
if conf_set: |
| 38 |
return sorted(conf_set, reverse=True)[0] |
| 39 |
return 0 |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
BOX_TYPE_CONF: dict[str, dict[int, dict[str, Any]]] = { |
| 45 |
|
| 46 |
"tvLiftBox": { |
| 47 |
20200518: { |
| 48 |
"api_path": "/api/device/state", |
| 49 |
"extended_state_path": "/state/extended", |
| 50 |
"api": { |
| 51 |
"set": lambda command: ("GET", f"/s/c/{command}") |
| 52 |
}, |
| 53 |
"buttons": [ |
| 54 |
["tvLift", {}, TvLift], |
| 55 |
], |
| 56 |
} |
| 57 |
}, |
| 58 |
|
| 59 |
"airSensor": { |
| 60 |
20180403: { |
| 61 |
"api_path": "/api/air/state", |
| 62 |
"sensors": [ |
| 63 |
[ |
| 64 |
"0.air", |
| 65 |
{ |
| 66 |
"pm1.value": "air.sensors[?type == 'pm1']|[0]|value", |
| 67 |
"pm1.state": "air.sensors[?type == 'pm1']|[0]|state", |
| 68 |
"pm2_5.value": "air.sensors[?type == 'pm2.5']|[0]|value", |
| 69 |
"pm2_5.state": "air.sensors[?type == 'pm2.5']|[0]|state", |
| 70 |
"pm10.value": "air.sensors[?type == 'pm10']|[0]|value", |
| 71 |
"pm10.state": "air.sensors[?type == 'pm10']|[0]|state", |
| 72 |
}, |
| 73 |
] |
| 74 |
], |
| 75 |
} |
| 76 |
}, |
| 77 |
|
| 78 |
"dimmerBox": { |
| 79 |
|
| 80 |
20151206: { |
| 81 |
"api_path": "/api/dimmer/state", |
| 82 |
"api": { |
| 83 |
"set": lambda x: ( |
| 84 |
"POST", |
| 85 |
"/api/dimmer/set", |
| 86 |
'{"dimmer":{"desiredBrightness": ' + str(x) + "}}", |
| 87 |
), |
| 88 |
}, |
| 89 |
"lights": [["brightness", {"desired": "dimmer.desiredBrightness"}]], |
| 90 |
}, |
| 91 |
20170829: { |
| 92 |
"api_path": "/api/dimmer/state", |
| 93 |
"api": { |
| 94 |
"set": lambda x: ( |
| 95 |
"POST", |
| 96 |
"/api/dimmer/set", |
| 97 |
'{"dimmer":{"desiredBrightness": ' + str(x) + "}}", |
| 98 |
), |
| 99 |
}, |
| 100 |
"lights": [["brightness", {"desired": "dimmer.desiredBrightness"}]], |
| 101 |
}, |
| 102 |
}, |
| 103 |
|
| 104 |
"gateBox": { |
| 105 |
|
| 106 |
20151206: { |
| 107 |
"api_path": "/api/gate/state", |
| 108 |
"api": { |
| 109 |
"primary": lambda x=None: ("GET", "/s/p", None), |
| 110 |
"secondary": lambda x=None: ("GET", "/s/s", None), |
| 111 |
}, |
| 112 |
"covers": [ |
| 113 |
[ |
| 114 |
"position", |
| 115 |
{ |
| 116 |
"position": "currentPos", |
| 117 |
"desired": "desiredPos", |
| 118 |
"extraButtonType": "extraButtonType", |
| 119 |
}, |
| 120 |
"gatebox", |
| 121 |
GateBox, |
| 122 |
] |
| 123 |
], |
| 124 |
}, |
| 125 |
20200831: { |
| 126 |
"api_path": "/state/extended", |
| 127 |
"extended_state_path": "/state/extended", |
| 128 |
"api": { |
| 129 |
"primary": lambda x=None: ("GET", "/s/p", None), |
| 130 |
"secondary": lambda x=None: ("GET", "/s/s", None), |
| 131 |
}, |
| 132 |
"covers": [ |
| 133 |
[ |
| 134 |
"position", |
| 135 |
{ |
| 136 |
"position": "gate.currentPos", |
| 137 |
"gate_type": "gate.gateType", |
| 138 |
"extra_button_type": "gate.extraButtonType", |
| 139 |
}, |
| 140 |
"gatebox", |
| 141 |
GateBoxB, |
| 142 |
] |
| 143 |
], |
| 144 |
"buttons": [ |
| 145 |
["second_output", {}, GateBoxSecondOutput], |
| 146 |
], |
| 147 |
}, |
| 148 |
}, |
| 149 |
|
| 150 |
"gateController": { |
| 151 |
20180604: { |
| 152 |
"api_path": "/api/gatecontroller/state", |
| 153 |
"extended_state_path": "/api/gatecontroller/extended/state", |
| 154 |
"api": { |
| 155 |
"open": lambda x=None: ("GET", "/s/o", None), |
| 156 |
"close": lambda x=None: ("GET", "/s/c", None), |
| 157 |
"position": lambda x: ("GET", "/s/p/" + str(x), None), |
| 158 |
"stop": lambda x=None: ("GET", "/s/s", None), |
| 159 |
|
| 160 |
|
| 161 |
}, |
| 162 |
"covers": [ |
| 163 |
[ |
| 164 |
"position", |
| 165 |
{ |
| 166 |
"desired": "gateController.desiredPos.positions|[0]", |
| 167 |
|
| 168 |
"state": "gateController.state", |
| 169 |
}, |
| 170 |
"gate", |
| 171 |
Gate, |
| 172 |
] |
| 173 |
], |
| 174 |
} |
| 175 |
}, |
| 176 |
|
| 177 |
"thermoBox": { |
| 178 |
20200229: { |
| 179 |
"api_path": "/state/extended", |
| 180 |
"extended_state_path": "/state/extended", |
| 181 |
"api": { |
| 182 |
"on": lambda x=None: ("GET", "/s/1", None), |
| 183 |
"off": lambda x=None: ("GET", "/s/0", None), |
| 184 |
"set": lambda x=None: ("GET", "/s/t/" + str(x), None), |
| 185 |
}, |
| 186 |
"climates": [ |
| 187 |
[ |
| 188 |
"thermostat", |
| 189 |
{ |
| 190 |
"desired": "thermo.desiredTemp", |
| 191 |
"minimum": "thermo.minimumTemp", |
| 192 |
"maximum": "thermo.maximumTemp", |
| 193 |
"temperature": lambda x: f"sensors[?id == `{x}`]|[0]|value", |
| 194 |
"temperature.state": lambda x: f"sensors[?id == `{x}`]|[0]|state", |
| 195 |
"state": "thermo.state", |
| 196 |
"mode": "thermo.mode", |
| 197 |
"safetySensorId": "thermo.safetyTempSensor.sensorId", |
| 198 |
"operatingState": "thermo.operatingState", |
| 199 |
}, |
| 200 |
] |
| 201 |
], |
| 202 |
"sensors": [ |
| 203 |
[ |
| 204 |
"temperature", |
| 205 |
{ |
| 206 |
"temperature": lambda x: f"sensors[?id == `{x}`]|[0]|value", |
| 207 |
"temperature.state": lambda x: f"sensors[?id == `{x}`]|[0]|state", |
| 208 |
}, |
| 209 |
] |
| 210 |
], |
| 211 |
} |
| 212 |
}, |
| 213 |
|
| 214 |
"saunaBox": { |
| 215 |
20180604: { |
| 216 |
|
| 217 |
"api_path": "/api/heat/extended/state", |
| 218 |
"extended_state_path": "/api/heat/extended/state", |
| 219 |
|
| 220 |
"api": { |
| 221 |
"on": lambda x=None: ("GET", "/s/1", None), |
| 222 |
"off": lambda x=None: ("GET", "/s/0", None), |
| 223 |
"set": lambda x=None: ("GET", "/s/t/" + str(x), None), |
| 224 |
}, |
| 225 |
"climates": [ |
| 226 |
[ |
| 227 |
"thermostat", |
| 228 |
{ |
| 229 |
"desired": "heat.desiredTemp", |
| 230 |
"minimum": "heat.minimumTemp", |
| 231 |
"maximum": "heat.maximumTemp", |
| 232 |
"temperature": "heat.sensors[?id == `0`]|[0]|value", |
| 233 |
"state": "heat.state", |
| 234 |
}, |
| 235 |
] |
| 236 |
], |
| 237 |
} |
| 238 |
}, |
| 239 |
|
| 240 |
"shutterBox": { |
| 241 |
20180604: { |
| 242 |
"api_path": "/api/shutter/state", |
| 243 |
"extended_state_path": "/api/shutter/extended/state", |
| 244 |
"api": { |
| 245 |
"open": lambda x=None: ("GET", "/s/u", None), |
| 246 |
"close": lambda x=None: ("GET", "/s/d", None), |
| 247 |
"position": lambda x: ("GET", "/s/p/" + str(x), None), |
| 248 |
"stop": lambda x=None: ("GET", "/s/s", None), |
| 249 |
"tilt": lambda x=None: ("GET", "/s/t/" + str(x), None), |
| 250 |
}, |
| 251 |
"covers": [ |
| 252 |
[ |
| 253 |
"position", |
| 254 |
{ |
| 255 |
"desired": "shutter.desiredPos.position", |
| 256 |
|
| 257 |
"tilt": "shutter.desiredPos.tilt", |
| 258 |
"state": "shutter.state", |
| 259 |
}, |
| 260 |
"shutter", |
| 261 |
Shutter, |
| 262 |
] |
| 263 |
], |
| 264 |
} |
| 265 |
}, |
| 266 |
|
| 267 |
"switchBox": { |
| 268 |
20180604: { |
| 269 |
"model": "switchBox", |
| 270 |
"api_path": "/api/relay/state", |
| 271 |
"extended_state_path": "/api/relay/extended/state", |
| 272 |
"api": { |
| 273 |
"on": lambda x=None: ("GET", "/s/1", None), |
| 274 |
"off": lambda x=None: ("GET", "/s/0", None), |
| 275 |
}, |
| 276 |
"switches": [["0.relay", {"state": "[?relay==`0`]|[0]|state"}, "relay"]], |
| 277 |
|
| 278 |
}, |
| 279 |
20190808: { |
| 280 |
"api_path": "/api/relay/extended/state", |
| 281 |
"extended_state_path": "/api/relay/extended/state", |
| 282 |
"api": { |
| 283 |
"on": lambda x=None: ("GET", "/s/1", None), |
| 284 |
"off": lambda x=None: ("GET", "/s/0", None), |
| 285 |
}, |
| 286 |
"switches": [ |
| 287 |
[ |
| 288 |
"0.relay", |
| 289 |
{"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"}, |
| 290 |
"relay", |
| 291 |
] |
| 292 |
], |
| 293 |
"sensors": [ |
| 294 |
[ |
| 295 |
"switchBox.energy", |
| 296 |
{ |
| 297 |
|
| 298 |
"powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value", |
| 299 |
"activePower": lambda x: "sensors[?type == 'activePower']|[0]|value", |
| 300 |
"periodS": "powerMeasuring.powerConsumption[0]|periodS", |
| 301 |
"measurement_enabled": "powerMeasuring.enabled", |
| 302 |
}, |
| 303 |
] |
| 304 |
], |
| 305 |
}, |
| 306 |
20200229: { |
| 307 |
"extended_state_path": "/state/extended", |
| 308 |
"api_path": "/state/extended", |
| 309 |
"api": { |
| 310 |
"on": lambda x=None: ("GET", "/s/1", None), |
| 311 |
"off": lambda x=None: ("GET", "/s/0", None), |
| 312 |
}, |
| 313 |
"switches": [ |
| 314 |
[ |
| 315 |
"0.relay", |
| 316 |
{"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"}, |
| 317 |
"relay", |
| 318 |
] |
| 319 |
], |
| 320 |
"sensors": [ |
| 321 |
[ |
| 322 |
"switchBox.energy", |
| 323 |
{ |
| 324 |
|
| 325 |
"powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value", |
| 326 |
"activePower": lambda x: "sensors[?type == 'activePower']|[0]|value", |
| 327 |
"periodS": "powerMeasuring.powerConsumption[0]|periodS", |
| 328 |
"measurement_enabled": "powerMeasuring.enabled", |
| 329 |
}, |
| 330 |
] |
| 331 |
], |
| 332 |
}, |
| 333 |
20200831: { |
| 334 |
"extended_state_path": "/state/extended", |
| 335 |
"api_path": "/state/extended", |
| 336 |
"api": { |
| 337 |
"on": lambda x=None: ("GET", "/s/1", None), |
| 338 |
"off": lambda x=None: ("GET", "/s/0", None), |
| 339 |
}, |
| 340 |
"switches": [ |
| 341 |
[ |
| 342 |
"0.relay", |
| 343 |
{"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"}, |
| 344 |
"relay", |
| 345 |
] |
| 346 |
], |
| 347 |
"sensors": [ |
| 348 |
[ |
| 349 |
"switchBox.energy", |
| 350 |
{ |
| 351 |
|
| 352 |
"powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value", |
| 353 |
"activePower": lambda x: "sensors[?type == 'activePower']|[0]|value", |
| 354 |
"periodS": "powerMeasuring.powerConsumption[0]|periodS", |
| 355 |
"measurement_enabled": "powerMeasuring.enabled", |
| 356 |
}, |
| 357 |
] |
| 358 |
], |
| 359 |
}, |
| 360 |
20220114: { |
| 361 |
"api_path": "/state/extended", |
| 362 |
"extended_state_path": "/state/extended", |
| 363 |
"api": { |
| 364 |
|
| 365 |
|
| 366 |
"on": lambda x=None: ("GET", f"/s/{x}/1", None), |
| 367 |
"off": lambda x=None: ("GET", f"/s/{x}/0", None), |
| 368 |
}, |
| 369 |
"switches": [ |
| 370 |
[ |
| 371 |
"relay", |
| 372 |
{"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"}, |
| 373 |
"relay", |
| 374 |
] |
| 375 |
], |
| 376 |
"sensors": [ |
| 377 |
[ |
| 378 |
"switchBox.energy", |
| 379 |
{ |
| 380 |
|
| 381 |
"powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value ", |
| 382 |
"activePower": lambda x: "sensors[?type == 'activePower']|[0]|value", |
| 383 |
"periodS": "powerMeasuring.powerConsumption[0]|periodS", |
| 384 |
"measurement_enabled": "powerMeasuring.enabled", |
| 385 |
}, |
| 386 |
] |
| 387 |
], |
| 388 |
}, |
| 389 |
20220505: { |
| 390 |
"api_path": "/state/extended", |
| 391 |
"extended_state_path": "/state/extended", |
| 392 |
"api": { |
| 393 |
|
| 394 |
|
| 395 |
"on": lambda x=None: ("GET", f"/s/{x}/1", None), |
| 396 |
"off": lambda x=None: ("GET", f"/s/{x}/0", None), |
| 397 |
}, |
| 398 |
"switches": [ |
| 399 |
[ |
| 400 |
"relay", |
| 401 |
{"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"}, |
| 402 |
"relay", |
| 403 |
] |
| 404 |
], |
| 405 |
"sensors": [ |
| 406 |
[ |
| 407 |
"switchBox.energy", |
| 408 |
{ |
| 409 |
|
| 410 |
"powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value ", |
| 411 |
"activePower": lambda x: "sensors[?type == 'activePower']|[0]|value", |
| 412 |
"voltage": lambda x: "sensors[?type == 'voltage']|[0]|value", |
| 413 |
"periodS": "powerMeasuring.powerConsumption[0]|periodS", |
| 414 |
"measurement_enabled": "powerMeasuring.enabled", |
| 415 |
}, |
| 416 |
] |
| 417 |
], |
| 418 |
}, |
| 419 |
}, |
| 420 |
|
| 421 |
"switchBoxD": { |
| 422 |
20190808: { |
| 423 |
"extended_state_path": "/api/relay/extended/state", |
| 424 |
"api_path": "/api/relay/extended/state", |
| 425 |
"api": { |
| 426 |
"on": lambda x: ("GET", f"/s/{int(x)}/1", None), |
| 427 |
"off": lambda x=None: ("GET", f"/s/{int(x)}/0", None), |
| 428 |
}, |
| 429 |
"switches": [ |
| 430 |
[ |
| 431 |
"0.relay", |
| 432 |
{"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"}, |
| 433 |
"relay", |
| 434 |
0, |
| 435 |
], |
| 436 |
[ |
| 437 |
"1.relay", |
| 438 |
{"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"}, |
| 439 |
"relay", |
| 440 |
1, |
| 441 |
], |
| 442 |
], |
| 443 |
"sensors": [ |
| 444 |
[ |
| 445 |
"switchBox.energy", |
| 446 |
{ |
| 447 |
|
| 448 |
"powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value ", |
| 449 |
"activePower": lambda x: "sensors[?type == 'activePower']|[0]|value", |
| 450 |
"periodS": "powerMeasuring.powerConsumption[0]|periodS", |
| 451 |
"measurement_enabled": "powerMeasuring.enabled", |
| 452 |
}, |
| 453 |
] |
| 454 |
], |
| 455 |
}, |
| 456 |
20200229: { |
| 457 |
"extended_state_path": "/state/extended", |
| 458 |
"api_path": "/state/extended", |
| 459 |
"api": { |
| 460 |
"on": lambda x: ("GET", f"/s/{int(x)}/1", None), |
| 461 |
"off": lambda x=None: ("GET", f"/s/{int(x)}/0", None), |
| 462 |
}, |
| 463 |
"switches": [ |
| 464 |
[ |
| 465 |
"0.relay", |
| 466 |
{"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"}, |
| 467 |
"relay", |
| 468 |
0, |
| 469 |
], |
| 470 |
[ |
| 471 |
"1.relay", |
| 472 |
{"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"}, |
| 473 |
"relay", |
| 474 |
1, |
| 475 |
], |
| 476 |
], |
| 477 |
"sensors": [ |
| 478 |
[ |
| 479 |
"switchBox.energy", |
| 480 |
{ |
| 481 |
|
| 482 |
"powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value ", |
| 483 |
"activePower": lambda x: "sensors[?type == 'activePower']|[0]|value", |
| 484 |
"periodS": "powerMeasuring.powerConsumption[0]|periodS", |
| 485 |
"measurement_enabled": "powerMeasuring.enabled", |
| 486 |
}, |
| 487 |
] |
| 488 |
], |
| 489 |
}, |
| 490 |
20200831: { |
| 491 |
"extended_state_path": "/state/extended", |
| 492 |
"api_path": "/state/extended", |
| 493 |
"api": { |
| 494 |
"on": lambda x: ("GET", f"/s/{int(x)}/1", None), |
| 495 |
"off": lambda x=None: ("GET", f"/s/{int(x)}/0", None), |
| 496 |
}, |
| 497 |
"switches": [ |
| 498 |
[ |
| 499 |
"0.relay", |
| 500 |
{"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"}, |
| 501 |
"relay", |
| 502 |
0, |
| 503 |
], |
| 504 |
[ |
| 505 |
"1.relay", |
| 506 |
{"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"}, |
| 507 |
"relay", |
| 508 |
1, |
| 509 |
], |
| 510 |
], |
| 511 |
"sensors": [ |
| 512 |
[ |
| 513 |
"switchBox.energy", |
| 514 |
{ |
| 515 |
|
| 516 |
"powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value ", |
| 517 |
"activePower": lambda x: "sensors[?type == 'activePower']|[0]|value", |
| 518 |
"periodS": "powerMeasuring.powerConsumption[0]|periodS", |
| 519 |
"measurement_enabled": "powerMeasuring.enabled", |
| 520 |
}, |
| 521 |
] |
| 522 |
], |
| 523 |
}, |
| 524 |
}, |
| 525 |
|
| 526 |
"tempSensor": { |
| 527 |
20180604: { |
| 528 |
"api_path": "/api/tempsensor/state", |
| 529 |
"sensors": [ |
| 530 |
[ |
| 531 |
"0.temperature", |
| 532 |
{ |
| 533 |
"temperature": "tempSensor.sensors[?id == `0`]|[0]|value", |
| 534 |
"trend": "tempSensor.sensors[?id == `0`]|[0]|trend", |
| 535 |
"temperature.state": "tempSensor.sensors[?id == `0`]|[0]|state", |
| 536 |
"elapsed": "tempSensor.sensors[?id == `0`]|[0]|elapsedTimeS", |
| 537 |
}, |
| 538 |
] |
| 539 |
], |
| 540 |
} |
| 541 |
}, |
| 542 |
|
| 543 |
"wLightBox": { |
| 544 |
|
| 545 |
20151206: { |
| 546 |
"api_path": "/api/device/state", |
| 547 |
"api": { |
| 548 |
"set": lambda x: ( |
| 549 |
"POST", |
| 550 |
"/api/rgbw/set", |
| 551 |
f'{{"rgbw":{{"desiredColor": "{str(x)}"}}}}', |
| 552 |
), |
| 553 |
}, |
| 554 |
"lights": [ |
| 555 |
[ |
| 556 |
"color", |
| 557 |
{ |
| 558 |
"desired": "rgbw.desiredColor", |
| 559 |
"last_color": "rgbw.lastOnColor", |
| 560 |
"currentEffect": "rgbw.effectID", |
| 561 |
"colorMode": "rgbw.colorMode", |
| 562 |
}, |
| 563 |
] |
| 564 |
], |
| 565 |
}, |
| 566 |
20190808: { |
| 567 |
"api_path": "/api/rgbw/state", |
| 568 |
"extended_state_path": "/api/rgbw/extended/state", |
| 569 |
"api": { |
| 570 |
"set": lambda x: ( |
| 571 |
"POST", |
| 572 |
"/api/rgbw/set", |
| 573 |
f'{{"rgbw":{{"desiredColor": "{str(x)}"}}}}', |
| 574 |
), |
| 575 |
"effect": lambda x: ("GET", f"/s/x/{x}", None), |
| 576 |
}, |
| 577 |
"lights": [ |
| 578 |
[ |
| 579 |
"color", |
| 580 |
{ |
| 581 |
"desired": "rgbw.desiredColor", |
| 582 |
"last_color": "rgbw.lastOnColor", |
| 583 |
"currentEffect": "rgbw.effectID", |
| 584 |
"colorMode": "rgbw.colorMode", |
| 585 |
}, |
| 586 |
] |
| 587 |
], |
| 588 |
}, |
| 589 |
20200229: { |
| 590 |
"api_path": "/api/rgbw/state", |
| 591 |
"extended_state_path": "/api/rgbw/extended/state", |
| 592 |
"api": { |
| 593 |
"set": lambda x: ( |
| 594 |
"POST", |
| 595 |
"/api/rgbw/set", |
| 596 |
f'{{"rgbw": {{"desiredColor": "{x}"}}}}', |
| 597 |
), |
| 598 |
"effect": lambda x: ("GET", f"/s/x/{x}"), |
| 599 |
}, |
| 600 |
"lights": [ |
| 601 |
[ |
| 602 |
"color", |
| 603 |
{ |
| 604 |
"desired": "rgbw.desiredColor", |
| 605 |
"last_color": "rgbw.lastOnColor", |
| 606 |
"currentEffect": "rgbw.effectID", |
| 607 |
"colorMode": "rgbw.colorMode", |
| 608 |
}, |
| 609 |
], |
| 610 |
], |
| 611 |
}, |
| 612 |
}, |
| 613 |
|
| 614 |
"wLightBoxS": { |
| 615 |
|
| 616 |
20151206: { |
| 617 |
"api_path": "/api/device/state", |
| 618 |
"api": { |
| 619 |
"set": lambda x: ( |
| 620 |
"POST", |
| 621 |
"/api/light/set", |
| 622 |
f'{{"light": {{"desiredColor": "{x}"}}}}', |
| 623 |
), |
| 624 |
}, |
| 625 |
"lights": [ |
| 626 |
[ |
| 627 |
"brightness", |
| 628 |
{ |
| 629 |
"desired": "light.desiredColor", |
| 630 |
}, |
| 631 |
] |
| 632 |
], |
| 633 |
}, |
| 634 |
20180718: { |
| 635 |
"api_path": "/api/light/state", |
| 636 |
"api": { |
| 637 |
"set": lambda x: ( |
| 638 |
"POST", |
| 639 |
"/api/light/set", |
| 640 |
f'{{"light": {{"desiredColor": "{x}"}}}}', |
| 641 |
), |
| 642 |
"effect": lambda x: ("GET", f"/s/x/{x}"), |
| 643 |
}, |
| 644 |
"lights": [ |
| 645 |
[ |
| 646 |
"brightness", |
| 647 |
{ |
| 648 |
"desired": "light.desiredColor", |
| 649 |
}, |
| 650 |
] |
| 651 |
], |
| 652 |
}, |
| 653 |
20200229: { |
| 654 |
"api_path": "/api/rgbw/state", |
| 655 |
"extended_state_path": "/api/rgbw/extended/state", |
| 656 |
"api": { |
| 657 |
"set": lambda x: ( |
| 658 |
"POST", |
| 659 |
"/api/rgbw/set", |
| 660 |
f'{{"rgbw": {{"desiredColor": "{x}"}}}}', |
| 661 |
), |
| 662 |
"effect": lambda x: ("GET", f"/s/x/{x}"), |
| 663 |
}, |
| 664 |
"lights": [ |
| 665 |
[ |
| 666 |
"brightness", |
| 667 |
{ |
| 668 |
"desired": "rgbw.desiredColor", |
| 669 |
"colorMode": "rgbw.colorMode", |
| 670 |
"currentEffect": "rgbw.effectID", |
| 671 |
"last_color": "rgbw.lastOnColor", |
| 672 |
}, |
| 673 |
] |
| 674 |
], |
| 675 |
}, |
| 676 |
}, |
| 677 |
|
| 678 |
"multiSensor": { |
| 679 |
20200831: { |
| 680 |
"api_path": "/state", |
| 681 |
"extended_state_path": "/state/extended", |
| 682 |
"sensors": [ |
| 683 |
[ |
| 684 |
"multiSensor", |
| 685 |
{ |
| 686 |
"temperature": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 687 |
"temperature.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|state", |
| 688 |
"wind": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 689 |
"wind.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|state", |
| 690 |
}, |
| 691 |
] |
| 692 |
], |
| 693 |
"binary_sensors": [ |
| 694 |
[ |
| 695 |
"multiSensor", |
| 696 |
{ |
| 697 |
"rain": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 698 |
"flood": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 699 |
}, |
| 700 |
] |
| 701 |
], |
| 702 |
}, |
| 703 |
20210413: { |
| 704 |
"api_path": "/state", |
| 705 |
"extended_state_path": "/state/extended", |
| 706 |
"sensors": [ |
| 707 |
[ |
| 708 |
"multiSensor", |
| 709 |
{ |
| 710 |
"temperature": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 711 |
"temperature.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|state", |
| 712 |
"wind": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 713 |
"wind.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|state", |
| 714 |
"humidity": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 715 |
"humidity.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|state", |
| 716 |
}, |
| 717 |
] |
| 718 |
], |
| 719 |
"binary_sensors": [ |
| 720 |
[ |
| 721 |
"multiSensor", |
| 722 |
{ |
| 723 |
"rain": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 724 |
"flood": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 725 |
}, |
| 726 |
] |
| 727 |
], |
| 728 |
}, |
| 729 |
20220114: { |
| 730 |
"api_path": "/state", |
| 731 |
"extended_state_path": "/state/extended", |
| 732 |
"sensors": [ |
| 733 |
[ |
| 734 |
"multiSensor", |
| 735 |
{ |
| 736 |
"illuminance": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 737 |
"illuminance.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|state", |
| 738 |
"temperature": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 739 |
"temperature.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|state", |
| 740 |
"wind": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'wind']|[0]|value", |
| 741 |
"wind.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'wind']|[0]|state", |
| 742 |
"humidity": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 743 |
"humidity.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|state", |
| 744 |
}, |
| 745 |
] |
| 746 |
], |
| 747 |
"binary_sensors": [ |
| 748 |
[ |
| 749 |
"multiSensor", |
| 750 |
{ |
| 751 |
"rain": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 752 |
"flood": lambda x: f"multiSensor.sensors[?id == `{x}`]|[0]|value", |
| 753 |
}, |
| 754 |
] |
| 755 |
], |
| 756 |
}, |
| 757 |
20230606: { |
| 758 |
"api_path": "/state", |
| 759 |
"extended_state_path": "/state/extended", |
| 760 |
"sensors": [ |
| 761 |
[ |
| 762 |
"multiSensor", |
| 763 |
{ |
| 764 |
"frequency": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'frequency']|[0]|value", |
| 765 |
"frequency.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'frequency']|[0]|state", |
| 766 |
"current": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'current']|[0]|value", |
| 767 |
"current.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'current']|[0]|state", |
| 768 |
"voltage": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'voltage']|[0]|value", |
| 769 |
"voltage.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'voltage']|[0]|state", |
| 770 |
"apparentPower": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'apparentPower']|[0]|value", |
| 771 |
"apparentPower.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'apparentPower']|[0]|state", |
| 772 |
"activePower": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'activePower']|[0]|value", |
| 773 |
"activePower.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'activePower']|[0]|state", |
| 774 |
"reactivePower": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'reactivePower']|[0]|value", |
| 775 |
"reactivePower.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'reactivePower']|[0]|state", |
| 776 |
"reverseActiveEnergy": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'reverseActiveEnergy']|[0]|value", |
| 777 |
"reverseActiveEnergy.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'reverseActiveEnergy']|[0]|state", |
| 778 |
"forwardActiveEnergy": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'forwardActiveEnergy']|[0]|value", |
| 779 |
"forwardActiveEnergy.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'forwardActiveEnergy']|[0]|state", |
| 780 |
"forwardReactiveEnergy": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'forwardReactiveEnergy']|[0]|value", |
| 781 |
"forwardReactiveEnergy.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'forwardReactiveEnergy']|[0]|state", |
| 782 |
"reverseReactiveEnergy": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'reverseReactiveEnergy']|[0]|value", |
| 783 |
"reverseReactiveEnergy.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'reverseReactiveEnergy']|[0]|state", |
| 784 |
"illuminance": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'illuminance']|[0]|value", |
| 785 |
"illuminance.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'illuminance']|[0]|state", |
| 786 |
"temperature": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'temperature']|[0]|value", |
| 787 |
"temperature.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'temperature']|[0]|state", |
| 788 |
"wind": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'wind']|[0]|value", |
| 789 |
"wind.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'wind']|[0]|state", |
| 790 |
"humidity": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'humidity']|[0]|value", |
| 791 |
"humidity.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'humidity']|[0]|state", |
| 792 |
"openStatus": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'openStatus']|[0]|value", |
| 793 |
"openStatus.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'openStatus']|[0]|state", |
| 794 |
"co2": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'co2']|[0]|value", |
| 795 |
"co2.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'co2']|[0]|state", |
| 796 |
"co2Definition": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'co2Definition']|[0]|value", |
| 797 |
"co2Definition.state": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'co2Definition']|[0]|state", |
| 798 |
}, |
| 799 |
] |
| 800 |
], |
| 801 |
"binary_sensors": [ |
| 802 |
[ |
| 803 |
"multiSensor", |
| 804 |
{ |
| 805 |
"rain": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'rain']|[0]|value", |
| 806 |
"flood": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'flood']|[0]|value", |
| 807 |
"openStatus": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'openStatus']|[0]|value", |
| 808 |
"binary": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'binary']|[0]|value", |
| 809 |
}, |
| 810 |
] |
| 811 |
], |
| 812 |
}, |
| 813 |
}, |
| 814 |
} |