Tahoma switches (#13636)
* Added the ability to switch Tahoma Garage door relay. Those are special switches that can only be pushed. Their state is always OFF, they react to the turn_on action, perform it, but stay OFF * fixing indents and so on * CI fix
This commit is contained in:
parent
4008bf5611
commit
e6006e9beb
2 changed files with 53 additions and 1 deletions
51
homeassistant/components/switch/tahoma.py
Normal file
51
homeassistant/components/switch/tahoma.py
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
"""
|
||||||
|
Support for Tahoma Switch - those are push buttons for garage door etc.
|
||||||
|
|
||||||
|
Those buttons are implemented as switchs that are never on. They only
|
||||||
|
receive the turn_on action, perform the relay click, and stay in OFF state
|
||||||
|
|
||||||
|
For more details about this platform, please refer to the documentation at
|
||||||
|
https://home-assistant.io/components/switch.tahoma/
|
||||||
|
"""
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from homeassistant.components.switch import SwitchDevice
|
||||||
|
from homeassistant.components.tahoma import (
|
||||||
|
DOMAIN as TAHOMA_DOMAIN, TahomaDevice)
|
||||||
|
|
||||||
|
DEPENDENCIES = ['tahoma']
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
"""Set up Tahoma switchs."""
|
||||||
|
controller = hass.data[TAHOMA_DOMAIN]['controller']
|
||||||
|
devices = []
|
||||||
|
for switch in hass.data[TAHOMA_DOMAIN]['devices']['switch']:
|
||||||
|
devices.append(TahomaSwitch(switch, controller))
|
||||||
|
add_devices(devices, True)
|
||||||
|
|
||||||
|
|
||||||
|
class TahomaSwitch(TahomaDevice, SwitchDevice):
|
||||||
|
"""Representation a Tahoma Switch."""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_class(self):
|
||||||
|
"""Return the class of the device."""
|
||||||
|
if self.tahoma_device.type == 'rts:GarageDoor4TRTSComponent':
|
||||||
|
return 'garage'
|
||||||
|
return None
|
||||||
|
|
||||||
|
def turn_on(self, **kwargs):
|
||||||
|
"""Send the on command."""
|
||||||
|
self.toggle()
|
||||||
|
|
||||||
|
def toggle(self, **kwargs):
|
||||||
|
"""Click the switch."""
|
||||||
|
self.apply_action('cycle')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_on(self):
|
||||||
|
"""Get whether the switch is in on state."""
|
||||||
|
return False
|
|
@ -32,7 +32,7 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
TAHOMA_COMPONENTS = [
|
TAHOMA_COMPONENTS = [
|
||||||
'scene', 'sensor', 'cover'
|
'scene', 'sensor', 'cover', 'switch'
|
||||||
]
|
]
|
||||||
|
|
||||||
TAHOMA_TYPES = {
|
TAHOMA_TYPES = {
|
||||||
|
@ -43,6 +43,7 @@ TAHOMA_TYPES = {
|
||||||
'io:RollerShutterGenericIOComponent': 'cover',
|
'io:RollerShutterGenericIOComponent': 'cover',
|
||||||
'io:WindowOpenerVeluxIOComponent': 'cover',
|
'io:WindowOpenerVeluxIOComponent': 'cover',
|
||||||
'io:LightIOSystemSensor': 'sensor',
|
'io:LightIOSystemSensor': 'sensor',
|
||||||
|
'rts:GarageDoor4TRTSComponent': 'switch',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue