From f2fbe657c4d7f2fc71dd4551fcc96771d3baef4a Mon Sep 17 00:00:00 2001 From: Kris Bennett <1435262+i00@users.noreply.github.com> Date: Fri, 10 Apr 2020 03:37:55 +1000 Subject: [PATCH] Add tradfri cover model to the cover entity attributes (#33674) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Ikea Blind Battery * Ikea Blind Battery * Ikea Blind Battery * Ikea Blind Battery * IKEA Blinds Battery * IKEA Blinds Battery * Update cover.py * Clean up * Remove unused import Co-authored-by: Martin Hjelmare Co-authored-by: Joakim Sørensen --- homeassistant/components/tradfri/const.py | 1 + homeassistant/components/tradfri/cover.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/tradfri/const.py b/homeassistant/components/tradfri/const.py index 88225d3282a..ffb5d64f6d7 100644 --- a/homeassistant/components/tradfri/const.py +++ b/homeassistant/components/tradfri/const.py @@ -9,6 +9,7 @@ ATTR_TRADFRI_GATEWAY = "Gateway" ATTR_TRADFRI_GATEWAY_MODEL = "E1526" ATTR_TRADFRI_MANUFACTURER = "IKEA of Sweden" ATTR_TRANSITION_TIME = "transition_time" +ATTR_MODEL = "model" CONF_ALLOW_TRADFRI_GROUPS = "allow_tradfri_groups" CONF_IDENTITY = "identity" CONF_IMPORT_GROUPS = "import_groups" diff --git a/homeassistant/components/tradfri/cover.py b/homeassistant/components/tradfri/cover.py index d978e512920..744ba2e13b1 100644 --- a/homeassistant/components/tradfri/cover.py +++ b/homeassistant/components/tradfri/cover.py @@ -3,7 +3,7 @@ from homeassistant.components.cover import ATTR_POSITION, CoverDevice from .base_class import TradfriBaseDevice -from .const import CONF_GATEWAY_ID, KEY_API, KEY_GATEWAY +from .const import ATTR_MODEL, CONF_GATEWAY_ID, KEY_API, KEY_GATEWAY async def async_setup_entry(hass, config_entry, async_add_entities): @@ -29,6 +29,12 @@ class TradfriCover(TradfriBaseDevice, CoverDevice): self._refresh(device) + @property + def device_state_attributes(self): + """Return the state attributes.""" + attr = {ATTR_MODEL: self._device.device_info.model_number} + return attr + @property def current_cover_position(self): """Return current position of cover.