diff --git a/homeassistant/components/smarla/__init__.py b/homeassistant/components/smarla/__init__.py index c55b1067735..2de3fcfa242 100644 --- a/homeassistant/components/smarla/__init__.py +++ b/homeassistant/components/smarla/__init__.py @@ -22,12 +22,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: FederwiegeConfigEntry) - federwiege = Federwiege(hass.loop, connection) federwiege.register() - federwiege.connect() entry.runtime_data = federwiege await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) + federwiege.connect() + return True diff --git a/homeassistant/components/smarla/manifest.json b/homeassistant/components/smarla/manifest.json index 5e572c78536..8f7786bdf72 100644 --- a/homeassistant/components/smarla/manifest.json +++ b/homeassistant/components/smarla/manifest.json @@ -8,5 +8,5 @@ "iot_class": "cloud_push", "loggers": ["pysmarlaapi", "pysignalr"], "quality_scale": "bronze", - "requirements": ["pysmarlaapi==0.8.2"] + "requirements": ["pysmarlaapi==0.9.0"] } diff --git a/homeassistant/components/smarla/number.py b/homeassistant/components/smarla/number.py index d2421962b07..c1a236e4557 100644 --- a/homeassistant/components/smarla/number.py +++ b/homeassistant/components/smarla/number.py @@ -53,9 +53,10 @@ class SmarlaNumber(SmarlaBaseEntity, NumberEntity): _property: Property[int] @property - def native_value(self) -> float: + def native_value(self) -> float | None: """Return the entity value to represent the entity state.""" - return self._property.get() + v = self._property.get() + return float(v) if v is not None else None def set_native_value(self, value: float) -> None: """Update to the smarla device.""" diff --git a/homeassistant/components/smarla/switch.py b/homeassistant/components/smarla/switch.py index d68f3428a77..f9b56fdea7e 100644 --- a/homeassistant/components/smarla/switch.py +++ b/homeassistant/components/smarla/switch.py @@ -52,7 +52,7 @@ class SmarlaSwitch(SmarlaBaseEntity, SwitchEntity): _property: Property[bool] @property - def is_on(self) -> bool: + def is_on(self) -> bool | None: """Return the entity value to represent the entity state.""" return self._property.get() diff --git a/requirements_all.txt b/requirements_all.txt index f21b455f0a1..44499fb9d33 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2338,7 +2338,7 @@ pysma==0.7.5 pysmappee==0.2.29 # homeassistant.components.smarla -pysmarlaapi==0.8.2 +pysmarlaapi==0.9.0 # homeassistant.components.smartthings pysmartthings==3.2.5 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 58983df2583..82238467816 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1938,7 +1938,7 @@ pysma==0.7.5 pysmappee==0.2.29 # homeassistant.components.smarla -pysmarlaapi==0.8.2 +pysmarlaapi==0.9.0 # homeassistant.components.smartthings pysmartthings==3.2.5 diff --git a/tests/components/smarla/snapshots/test_number.ambr b/tests/components/smarla/snapshots/test_number.ambr index 3232795c277..50312e09920 100644 --- a/tests/components/smarla/snapshots/test_number.ambr +++ b/tests/components/smarla/snapshots/test_number.ambr @@ -53,6 +53,6 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': '1', + 'state': '1.0', }) # --- diff --git a/tests/components/smarla/test_number.py b/tests/components/smarla/test_number.py index 642b39f33fb..3589829e56c 100644 --- a/tests/components/smarla/test_number.py +++ b/tests/components/smarla/test_number.py @@ -93,11 +93,11 @@ async def test_number_state_update( entity_id = entity_info["entity_id"] - assert hass.states.get(entity_id).state == "1" + assert hass.states.get(entity_id).state == "1.0" mock_number_property.get.return_value = 100 await update_property_listeners(mock_number_property) await hass.async_block_till_done() - assert hass.states.get(entity_id).state == "100" + assert hass.states.get(entity_id).state == "100.0"