Add unique_id support for eq3btsmart (#57603)

This commit is contained in:
Lukas Kempf 2021-10-13 15:33:37 +02:00 committed by GitHub
parent c470a03a4e
commit 3b1938d5ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,7 @@ from homeassistant.const import (
TEMP_CELSIUS, TEMP_CELSIUS,
) )
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.device_registry import format_mac
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -82,6 +83,7 @@ class EQ3BTSmartThermostat(ClimateEntity):
"""Initialize the thermostat.""" """Initialize the thermostat."""
# We want to avoid name clash with this module. # We want to avoid name clash with this module.
self._name = _name self._name = _name
self._mac = _mac
self._thermostat = eq3.Thermostat(_mac) self._thermostat = eq3.Thermostat(_mac)
@property @property
@ -183,6 +185,11 @@ class EQ3BTSmartThermostat(ClimateEntity):
""" """
return list(HA_TO_EQ_PRESET) return list(HA_TO_EQ_PRESET)
@property
def unique_id(self) -> str:
"""Return the MAC address of the thermostat."""
return format_mac(self._mac)
def set_preset_mode(self, preset_mode): def set_preset_mode(self, preset_mode):
"""Set new preset mode.""" """Set new preset mode."""
if preset_mode == PRESET_NONE: if preset_mode == PRESET_NONE: