Skip to content

Commit

Permalink
Problem solving
Browse files Browse the repository at this point in the history
  • Loading branch information
gjohansson-ST committed Dec 15, 2021
1 parent 350134c commit 1e19266
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions custom_components/sector/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def __init__(
def device_info(self) -> DeviceInfo:
"""Return device information."""
return {
"identifiers": {(DOMAIN, self.unique_id)},
"name": self.name,
"identifiers": {(DOMAIN, self._attr_unique_id)},
"name": self._attr_name,
"manufacturer": "Sector Alarm",
"model": "Alarmpanel",
"sw_version": "master",
Expand Down
7 changes: 3 additions & 4 deletions custom_components/sector/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ def __init__(
"""Initialize Temp sensor."""
self._hub = hub
super().__init__(coordinator)
self._serial = description.key
self.entity_description = description
self._attr_name = description.name
self._attr_unique_id: str = "sa_temp_" + str(description.key)
self.entity_description = description
self._attr_state = self._hub.temp_state[self._serial]
self._attr_native_value = self._hub.temp_state[description.key]

@property
def device_info(self) -> DeviceInfo:
Expand All @@ -88,4 +87,4 @@ def device_info(self) -> DeviceInfo:
@property
def extra_state_attributes(self) -> dict:
"""Extra states for sensor."""
return {"Serial No": self._serial}
return {"Serial No": self.entity_description.key}
2 changes: 1 addition & 1 deletion custom_components/sector/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def extra_state_attributes(self) -> dict:

async def async_turn_on(self, **kwargs) -> None:
"""Turn the switch on."""
self.async_triggerswitch("On")
await self.async_triggerswitch("On")

async def async_turn_off(self, **kwargs) -> None:
"""Turn the switch off."""
Expand Down

0 comments on commit 1e19266

Please sign in to comment.