diff --git a/CHANGELOG.md b/CHANGELOG.md index 5880ddf..7ba67bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Forgot to update the version in manifest.json all this time +- Use extra_state_attributes instead of device_state_attributes +- Use atribute notation instead of key notation for discovery_info ## [0.5.1] - 2021-06-18 diff --git a/custom_components/weatherlink/config_flow.py b/custom_components/weatherlink/config_flow.py index 6cee73c..d9e3433 100644 --- a/custom_components/weatherlink/config_flow.py +++ b/custom_components/weatherlink/config_flow.py @@ -77,8 +77,8 @@ async def async_step_user(self, info): async def async_step_zeroconf( self, discovery_info: Dict[str, Any] ) -> Dict[str, Any]: - host: str = discovery_info["host"] - port: int = discovery_info["port"] + host: str = discovery_info.host + port: int = discovery_info.port try: self.discovery_data = await self.discover(f"http://{host}:{port}") return await self.async_step_zeroconf_confirm() diff --git a/custom_components/weatherlink/sensor.py b/custom_components/weatherlink/sensor.py index d5410ea..f093106 100644 --- a/custom_components/weatherlink/sensor.py +++ b/custom_components/weatherlink/sensor.py @@ -29,7 +29,7 @@ def state(self): return self.units.pressure.convert(self._lss_bar_condition.bar_sea_level) @property - def device_state_attributes(self): + def extra_state_attributes(self): condition = self._lss_bar_condition u = self.units.pressure return { @@ -54,7 +54,7 @@ def state(self): return self.units.temperature.convert(self._lss_temp_hum_condition.temp_in) @property - def device_state_attributes(self): + def extra_state_attributes(self): condition = self._lss_temp_hum_condition u = self.units.temperature return { diff --git a/custom_components/weatherlink/sensor_air_quality.py b/custom_components/weatherlink/sensor_air_quality.py index 170b0e1..9ea991c 100644 --- a/custom_components/weatherlink/sensor_air_quality.py +++ b/custom_components/weatherlink/sensor_air_quality.py @@ -57,7 +57,7 @@ def state(self): return "connected" @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._aq_condition return { "last_report_time": c.last_report_time, @@ -79,7 +79,7 @@ def state(self): return self.units.temperature.convert(self._aq_condition.temp) @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._aq_condition u = self.units.temperature return { @@ -130,7 +130,7 @@ def state(self): return self.units.pm.convert(self._aq_condition.pm_2p5_nowcast) @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._aq_condition u = self.units.pm return { @@ -156,7 +156,7 @@ def state(self): return self.units.pm.convert(self._aq_condition.pm_10_nowcast) @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._aq_condition u = self.units.pm return { diff --git a/custom_components/weatherlink/sensor_iss.py b/custom_components/weatherlink/sensor_iss.py index fe0e4fa..9e927cb 100644 --- a/custom_components/weatherlink/sensor_iss.py +++ b/custom_components/weatherlink/sensor_iss.py @@ -56,7 +56,7 @@ def state(self): return rx_state.name @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._iss_condition return { "txid": c.txid, @@ -75,7 +75,7 @@ def state(self): return self.units.temperature.convert_optional(self._iss_condition.temp) @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._iss_condition u = self.units.temperature return { @@ -127,7 +127,7 @@ def state(self): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._iss_condition u = self.units.wind_speed return { @@ -169,7 +169,7 @@ def state(self): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._iss_condition u = self.units.wind_speed return { @@ -192,7 +192,7 @@ def state(self): return self._iss_condition.wind_dir_scalar_avg_last_2_min @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._iss_condition return { "high": c.wind_dir_at_hi_speed_last_2_min, @@ -251,7 +251,7 @@ def state(self): return self.bearing_to_dir(self._iss_condition.wind_dir_scalar_avg_last_2_min) @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._iss_condition return { "high": self.bearing_to_dir(c.wind_dir_at_hi_speed_last_2_min), @@ -311,7 +311,7 @@ def state(self): return self.units.rain_rate.convert(self._iss_condition.rain_rate_last) @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._iss_condition u = self.units.rain_rate return { @@ -335,7 +335,7 @@ def state(self): return self.units.rainfall.convert(self._iss_condition.rainfall_daily) @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._iss_condition u = self.units.rainfall return { @@ -362,7 +362,7 @@ def state(self): return self.units.rainfall.convert_optional(self._iss_condition.rain_storm) @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._iss_condition u = self.units.rainfall return { diff --git a/custom_components/weatherlink/sensor_moisture.py b/custom_components/weatherlink/sensor_moisture.py index 1dee314..3ca5912 100644 --- a/custom_components/weatherlink/sensor_moisture.py +++ b/custom_components/weatherlink/sensor_moisture.py @@ -45,7 +45,7 @@ def state(self): return rx_state.name @property - def device_state_attributes(self): + def extra_state_attributes(self): c = self._moisture_condition return { "txid": c.txid, @@ -168,7 +168,7 @@ def state(self): return None @property - def device_state_attributes(self): + def extra_state_attributes(self): return { "raw": round_optional(self._wet_leaf(self._moisture_condition), 1), }