diff --git a/custom_components/mega/sensor.py b/custom_components/mega/sensor.py index 9881a8c..3a2a1cf 100644 --- a/custom_components/mega/sensor.py +++ b/custom_components/mega/sensor.py @@ -165,6 +165,14 @@ class MegaI2C(FilterBadValues): def customize(self): return super().customize.get(self.id_suffix, {}) or {} + @property + def extra_state_attributes(self): + attrs = super().extra_state_attributes or {} + attrs.update({ + 'i2c_id': self.id_suffix, + }) + return attrs + @property def device_class(self): return self._device_class diff --git a/docs/yaml.md b/docs/yaml.md index c35a3c0..e1e4a17 100644 --- a/docs/yaml.md +++ b/docs/yaml.md @@ -189,10 +189,10 @@ some_led2: # конфиг ``` #### i2c {: #i2c} -Для сенсоров i2c адресация конфига такая: +Для сенсоров i2c нужно так же указать id сенсора, который можно посмотреть в атрибутах объекта на [странице разработчика](https://my.home-assistant.io/redirect/developer_states/). ```yaml 36: - htu21d_humidity: # entity_id сенсора без приставки sensor., видно в интерфейсе HA + htu21d_humidity: # i2c_id # конфиг ``` [Подробнее про i2c](i2c.md)