I want to add a service to the cover component.But after registration, the service is not bound to the entity.`
def setup_platform(hass, config, add_devices, discovery_info=None):
“”“Set up the Demo covers.”""
coverItems = []
for device in hass.data[“covers”]:
coverItems.append(DemoCover(hass, device, device[‘posi’]))
add_devices(coverItems, True)
class DemoCover(CoverDevice):
“”“Representation of a demo cover.”""
# pylint: disable=no-self-use
def __init__(self, hass, device,name, position=None, tilt_position=None,
device_class=None, supported_features=None):
"""Initialize the cover."""
self.hass = hass
self._name = name
self.hass.services.register("cover","maintain_scene",self.maintain_scene)//register services
self._position = position
self._device_class = device_class
self._supported_features = supported_features
self._set_position = None
# self._set_tilt_position = None
#self._set_position = 0
self._tilt_position = tilt_position
self._requested_closing = True
self._requested_closing_tilt = True
self._unsub_listener_cover = None
self._unsub_listener_cover_bar = None
self._unsub_listener_cover_tilt = None
self._is_opening = False
self._is_closing = False
self._deviceid = device.get('id')
self._position_step = self.alltime(10)
self.transport = hass.data['transport']
if position is None:
self._closed = True
else:
self._closed = self.current_cover_position <= 0
self.gethhznCoverPosition()
`