Skip to content

Commit

Permalink
Improve volvooncall (home-assistant#34495)
Browse files Browse the repository at this point in the history
* Add write_ha_state to switch

* Add unique_id to voc
  • Loading branch information
fredrike authored Apr 22, 2020
1 parent 6dd8365 commit dd03fcb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions homeassistant/components/volvooncall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,8 @@ def device_state_attributes(self):
self.instrument.attributes,
model=f"{self.vehicle.vehicle_type}/{self.vehicle.model_year}",
)

@property
def unique_id(self) -> str:
"""Return a unique ID."""
return f"{self.vin}-{self.component}-{self.attribute}"
2 changes: 2 additions & 0 deletions homeassistant/components/volvooncall/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def is_on(self):
async def async_turn_on(self, **kwargs):
"""Turn the switch on."""
await self.instrument.turn_on()
self.async_write_ha_state()

async def async_turn_off(self, **kwargs):
"""Turn the switch off."""
await self.instrument.turn_off()
self.async_write_ha_state()

0 comments on commit dd03fcb

Please sign in to comment.