mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Add buttons to Blue current integration (#143964)
* Add buttons to Blue current integration * Apply feedback * Changed configEntry to use the BlueCurrentConfigEntry. The connector is now accessed via the entry instead of hass.data. * Changed test_buttons_created test to use the snapshot_platform function. Also removed the entry.unique_id check in the test_charge_point_buttons function because this is not needed anymore, according to https://github.com/home-assistant/core/pull/114000#discussion_r1627201872 * Applied requested changes. Changes requested by joostlek. * Moved has_value from BlueCurrentEntity to class level. This value was still inside the __init__ function, so the value was not overwritten by the ChargePointButton. --------- Co-authored-by: Floris272 <florispuijk@outlook.com>
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
"""Entity representing a Blue Current charge point."""
|
||||
|
||||
from abc import abstractmethod
|
||||
|
||||
from homeassistant.const import ATTR_NAME
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
@@ -17,12 +15,12 @@ class BlueCurrentEntity(Entity):
|
||||
|
||||
_attr_has_entity_name = True
|
||||
_attr_should_poll = False
|
||||
has_value = False
|
||||
|
||||
def __init__(self, connector: Connector, signal: str) -> None:
|
||||
"""Initialize the entity."""
|
||||
self.connector = connector
|
||||
self.signal = signal
|
||||
self.has_value = False
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register callbacks."""
|
||||
@@ -43,7 +41,6 @@ class BlueCurrentEntity(Entity):
|
||||
return self.connector.connected and self.has_value
|
||||
|
||||
@callback
|
||||
@abstractmethod
|
||||
def update_from_latest_data(self) -> None:
|
||||
"""Update the entity from the latest data."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user