Support for naming vehicle. Support for selecting what resources to display
This commit is contained in:
parent
827e3c4395
commit
1c6ba989a9
7 changed files with 69 additions and 93 deletions
|
@ -8,7 +8,7 @@ https://home-assistant.io/components/switch.volvooncall/
|
|||
"""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.volvooncall import VolvoEntity
|
||||
from homeassistant.components.volvooncall import VolvoEntity, RESOURCES
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -18,7 +18,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
"""Setup Tellstick switches."""
|
||||
if discovery_info is None:
|
||||
return
|
||||
add_devices([VolvoSwitch(hass, discovery_info)])
|
||||
add_devices([VolvoSwitch(hass, *discovery_info)])
|
||||
|
||||
|
||||
class VolvoSwitch(VolvoEntity, ToggleEntity):
|
||||
|
@ -37,12 +37,7 @@ class VolvoSwitch(VolvoEntity, ToggleEntity):
|
|||
"""Turn the switch off."""
|
||||
self.vehicle.stop_heater()
|
||||
|
||||
@property
|
||||
def _name(self):
|
||||
"""Return the name of the switch."""
|
||||
return 'Heater'
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the icon."""
|
||||
return 'mdi:radiator'
|
||||
return RESOURCES[self._attribute][2]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue