|
136 | 136 | # Default sleep between sending messages |
137 | 137 | SLEEP_TIME = 150 / 1000 |
138 | 138 |
|
| 139 | +# Message priority levels |
| 140 | +PRIORITY_HIGH = 1 |
| 141 | +PRIORITY_LOW = 3 |
| 142 | +PRIORITY_MEDIUM = 2 |
| 143 | + |
139 | 144 | # Max seconds the internal clock of plugwise nodes |
140 | 145 | # are allowed to drift in seconds |
141 | 146 | MAX_TIME_DRIFT = 30 |
|
220 | 225 | CB_NEW_NODE = "NEW_NODE" |
221 | 226 | CB_JOIN_REQUEST = "JOIN_REQUEST" |
222 | 227 |
|
223 | | -# Sensors |
224 | | -SENSOR_AVAILABLE = { |
| 228 | +# Stick device features |
| 229 | +FEATURE_AVAILABLE = { |
225 | 230 | "id": "available", |
226 | 231 | "name": "Available", |
227 | | - "state": "get_available", |
| 232 | + "state": "available", |
228 | 233 | "unit": "state", |
229 | 234 | } |
230 | | -SENSOR_HUMIDITY = { |
| 235 | +FEATURE_HUMIDITY = { |
231 | 236 | "id": "humidity", |
232 | 237 | "name": "Humidity", |
233 | | - "state": "get_humidity", |
| 238 | + "state": "humidity", |
234 | 239 | "unit": "%", |
235 | 240 | } |
236 | | -SENSOR_MOTION = { |
| 241 | +FEATURE_MOTION = { |
237 | 242 | "id": "motion", |
238 | 243 | "name": "Motion", |
239 | | - "state": "get_motion", |
| 244 | + "state": "motion", |
240 | 245 | "unit": "state", |
241 | 246 | } |
242 | | -SENSOR_PING = { |
| 247 | +FEATURE_PING = { |
243 | 248 | "id": "ping", |
244 | 249 | "name": "Ping roundtrip", |
245 | | - "state": "get_ping", |
| 250 | + "state": "ping", |
246 | 251 | "unit": TIME_MILLISECONDS, |
247 | 252 | } |
248 | | -SENSOR_POWER_USE = { |
| 253 | +FEATURE_POWER_USE = { |
249 | 254 | "id": "power_1s", |
250 | 255 | "name": "Power usage", |
251 | | - "state": "get_power_usage", |
| 256 | + "state": "current_power_usage", |
252 | 257 | "unit": POWER_WATT, |
253 | 258 | } |
254 | | -SENSOR_POWER_USE_LAST_8_SEC = { |
| 259 | +FEATURE_POWER_USE_LAST_8_SEC = { |
255 | 260 | "id": "power_8s", |
256 | 261 | "name": "Power usage 8 seconds", |
257 | | - "state": "get_power_usage_8_sec", |
| 262 | + "state": "current_power_usage_8_sec", |
258 | 263 | "unit": POWER_WATT, |
259 | 264 | } |
260 | | -SENSOR_POWER_CONSUMPTION_CURRENT_HOUR = { |
| 265 | +FEATURE_POWER_CONSUMPTION_CURRENT_HOUR = { |
261 | 266 | "id": "power_con_cur_hour", |
262 | 267 | "name": "Power consumption current hour", |
263 | | - "state": "get_power_consumption_current_hour", |
| 268 | + "state": "power_consumption_current_hour", |
264 | 269 | "unit": ENERGY_KILO_WATT_HOUR, |
265 | 270 | } |
266 | | -SENSOR_POWER_CONSUMPTION_PREVIOUS_HOUR = { |
| 271 | +FEATURE_POWER_CONSUMPTION_PREVIOUS_HOUR = { |
267 | 272 | "id": "power_con_prev_hour", |
268 | 273 | "name": "Power consumption previous hour", |
269 | | - "state": "get_power_consumption_previous_hour", |
| 274 | + "state": "power_consumption_previous_hour", |
270 | 275 | "unit": ENERGY_KILO_WATT_HOUR, |
271 | 276 | } |
272 | | -SENSOR_POWER_CONSUMPTION_TODAY = { |
| 277 | +FEATURE_POWER_CONSUMPTION_TODAY = { |
273 | 278 | "id": "power_con_today", |
274 | 279 | "name": "Power consumption today", |
275 | | - "state": "get_power_consumption_today", |
| 280 | + "state": "power_consumption_today", |
276 | 281 | "unit": ENERGY_KILO_WATT_HOUR, |
277 | 282 | } |
278 | | -SENSOR_POWER_CONSUMPTION_YESTERDAY = { |
| 283 | +FEATURE_POWER_CONSUMPTION_YESTERDAY = { |
279 | 284 | "id": "power_con_yesterday", |
280 | 285 | "name": "Power consumption yesterday", |
281 | | - "state": "get_power_consumption_yesterday", |
| 286 | + "state": "power_consumption_yesterday", |
282 | 287 | "unit": ENERGY_KILO_WATT_HOUR, |
283 | 288 | } |
284 | | -SENSOR_POWER_PRODUCTION_CURRENT_HOUR = { |
| 289 | +FEATURE_POWER_PRODUCTION_CURRENT_HOUR = { |
285 | 290 | "id": "power_prod_cur_hour", |
286 | 291 | "name": "Power production current hour", |
287 | | - "state": "get_power_production_current_hour", |
| 292 | + "state": "power_production_current_hour", |
288 | 293 | "unit": ENERGY_KILO_WATT_HOUR, |
289 | 294 | } |
290 | | -SENSOR_POWER_PRODUCTION_PREVIOUS_HOUR = { |
| 295 | +FEATURE_POWER_PRODUCTION_PREVIOUS_HOUR = { |
291 | 296 | "id": "power_prod_prev_hour", |
292 | 297 | "name": "Power production previous hour", |
293 | | - "state": "get_power_production_previous_hour", |
| 298 | + "state": "power_production_previous_hour", |
294 | 299 | "unit": ENERGY_KILO_WATT_HOUR, |
295 | 300 | } |
296 | | -SENSOR_SWITCH = { |
| 301 | +FEATURE_RELAY = { |
| 302 | + "id": "relay", |
| 303 | + "name": "Relay state", |
| 304 | + "state": "relay_state", |
| 305 | + "unit": "state", |
| 306 | +} |
| 307 | +FEATURE_SWITCH = { |
297 | 308 | "id": "switch", |
298 | | - "name": "switch", |
299 | | - "state": "get_switch_state", |
| 309 | + "name": "Switch state", |
| 310 | + "state": "switch_state", |
300 | 311 | "unit": "state", |
301 | 312 | } |
302 | | -SENSOR_TEMPERATURE = { |
| 313 | +FEATURE_TEMPERATURE = { |
303 | 314 | "id": "temperature", |
304 | 315 | "name": "Temperature", |
305 | | - "state": "get_temperature", |
| 316 | + "state": "temperature", |
306 | 317 | "unit": TEMP_CELSIUS, |
307 | 318 | } |
308 | 319 |
|
309 | 320 | # TODO: Need to validate RSSI sensors |
310 | | -SENSOR_RSSI_IN = { |
| 321 | +FEATURE_RSSI_IN = { |
311 | 322 | "id": "RSSI_in", |
312 | 323 | "name": "RSSI in", |
313 | | - "state": "get_rssi_in", |
| 324 | + "state": "rssi_in", |
314 | 325 | "unit": "Unknown", |
315 | 326 | } |
316 | | -SENSOR_RSSI_OUT = { |
| 327 | +FEATURE_RSSI_OUT = { |
317 | 328 | "id": "RSSI_out", |
318 | 329 | "name": "RSSI out", |
319 | | - "state": "get_rssi_out", |
| 330 | + "state": "rssi_out", |
320 | 331 | "unit": "Unknown", |
321 | 332 | } |
322 | 333 |
|
323 | | -# Switches |
324 | | -SWITCH_RELAY = { |
325 | | - "id": "relay", |
326 | | - "name": "Relay state", |
327 | | - "state": "get_relay_state", |
328 | | - "switch": "set_relay_state", |
329 | | -} |
330 | | - |
331 | | -# Home Assistant entities |
332 | | -HA_SWITCH = "switch" |
333 | | -HA_SENSOR = "sensor" |
334 | | -HA_BINARY_SENSOR = "binary_sensor" |
335 | | - |
336 | | - |
337 | 334 | ### Smile constants ### |
338 | 335 |
|
339 | 336 | APPLIANCES = "/core/appliances" |
|
0 commit comments