Revert "Use EntityFeature in modbus"

This reverts commit 56cf9d900d.
This commit is contained in:
epenet 2022-04-06 13:37:59 +00:00
parent b285e9d057
commit 916a612a60
2 changed files with 8 additions and 7 deletions

View file

@ -5,8 +5,11 @@ from datetime import datetime
import struct
from typing import Any
from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature
from homeassistant.components.climate.const import HVAC_MODE_AUTO
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO,
SUPPORT_TARGET_TEMPERATURE,
)
from homeassistant.const import (
ATTR_TEMPERATURE,
CONF_NAME,
@ -60,8 +63,6 @@ async def async_setup_platform(
class ModbusThermostat(BaseStructPlatform, RestoreEntity, ClimateEntity):
"""Representation of a Modbus Thermostat."""
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
def __init__(
self,
hub: ModbusHub,
@ -72,6 +73,7 @@ class ModbusThermostat(BaseStructPlatform, RestoreEntity, ClimateEntity):
self._target_temperature_register = config[CONF_TARGET_TEMP]
self._unit = config[CONF_TEMPERATURE_UNIT]
self._attr_supported_features = SUPPORT_TARGET_TEMPERATURE
self._attr_hvac_mode = HVAC_MODE_AUTO
self._attr_hvac_modes = [HVAC_MODE_AUTO]
self._attr_current_temperature = None

View file

@ -4,7 +4,7 @@ from __future__ import annotations
from datetime import datetime
from typing import Any
from homeassistant.components.cover import CoverEntity, CoverEntityFeature
from homeassistant.components.cover import SUPPORT_CLOSE, SUPPORT_OPEN, CoverEntity
from homeassistant.const import (
CONF_COVERS,
CONF_NAME,
@ -59,8 +59,6 @@ async def async_setup_platform(
class ModbusCover(BasePlatform, CoverEntity, RestoreEntity):
"""Representation of a Modbus cover."""
_attr_supported_features = CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE
def __init__(
self,
hub: ModbusHub,
@ -75,6 +73,7 @@ class ModbusCover(BasePlatform, CoverEntity, RestoreEntity):
self._status_register = config.get(CONF_STATUS_REGISTER)
self._status_register_type = config[CONF_STATUS_REGISTER_TYPE]
self._attr_supported_features = SUPPORT_OPEN | SUPPORT_CLOSE
self._attr_is_closed = False
# If we read cover status from coil, and not from optional status register,