mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Use HassKey in greeneye_monitor (#144878)
This commit is contained in:
parent
fb9be3da79
commit
10dd11f257
@ -1,5 +1,14 @@
|
||||
"""Shared constants for the greeneye_monitor integration."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from homeassistant.util.hass_dict import HassKey
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from greeneye import Monitors
|
||||
|
||||
CONF_CHANNELS = "channels"
|
||||
CONF_COUNTED_QUANTITY = "counted_quantity"
|
||||
CONF_COUNTED_QUANTITY_PER_PULSE = "counted_quantity_per_pulse"
|
||||
@ -13,8 +22,8 @@ CONF_TEMPERATURE_SENSORS = "temperature_sensors"
|
||||
CONF_TIME_UNIT = "time_unit"
|
||||
CONF_VOLTAGE_SENSORS = "voltage"
|
||||
|
||||
DATA_GREENEYE_MONITOR = "greeneye_monitor"
|
||||
DOMAIN = "greeneye_monitor"
|
||||
DATA_GREENEYE_MONITOR: HassKey[Monitors] = HassKey(DOMAIN)
|
||||
|
||||
SENSOR_TYPE_CURRENT = "current_sensor"
|
||||
SENSOR_TYPE_PULSE_COUNTER = "pulse_counter"
|
||||
|
@ -109,7 +109,7 @@ async def async_setup_platform(
|
||||
if len(monitor_configs) == 0:
|
||||
monitors.remove_listener(on_new_monitor)
|
||||
|
||||
monitors: greeneye.Monitors = hass.data[DATA_GREENEYE_MONITOR]
|
||||
monitors = hass.data[DATA_GREENEYE_MONITOR]
|
||||
monitors.add_listener(on_new_monitor)
|
||||
for monitor in monitors.monitors.values():
|
||||
on_new_monitor(monitor)
|
||||
|
Loading…
x
Reference in New Issue
Block a user