formatting
This commit is contained in:
17
apps/tv.py
17
apps/tv.py
@@ -1,5 +1,4 @@
|
||||
from dataclasses import dataclass, field, fields
|
||||
from datetime import timedelta
|
||||
from dataclasses import dataclass, fields
|
||||
|
||||
from appdaemon.entity import Entity
|
||||
from appdaemon.plugins.hass.hassapi import Hass
|
||||
@@ -8,10 +7,11 @@ from appdaemon.plugins.hass.hassapi import Hass
|
||||
@dataclass(init=False)
|
||||
class SoundBar(Hass):
|
||||
"""Turns on the soundbar by sending a command with the Broadlink remote.
|
||||
- Turns on when the playing_entity goes to playing
|
||||
- Turns off when the off_entity turns off
|
||||
- Turns on when the playing_entity goes to playing
|
||||
- Turns off when the off_entity turns off
|
||||
|
||||
"""
|
||||
|
||||
device: str
|
||||
remote_entity: Entity
|
||||
playing_entity: Entity
|
||||
@@ -32,13 +32,13 @@ class SoundBar(Hass):
|
||||
arg = self.args[f.name]
|
||||
if f.type == Entity:
|
||||
if not self.entity_exists(arg):
|
||||
self.log(f'{arg} does not exist', level="WARNING")
|
||||
self.log(f'{arg} does not exist', level='WARNING')
|
||||
else:
|
||||
setattr(self, f.name, self.get_entity(arg))
|
||||
else:
|
||||
setattr(self, f.name, arg)
|
||||
else:
|
||||
self.log(f'{f.name} field is unset', level="WARNING")
|
||||
self.log(f'{f.name} field is unset', level='WARNING')
|
||||
self.log(repr(self))
|
||||
|
||||
def send_remote_command(self, command: str):
|
||||
@@ -48,10 +48,7 @@ class SoundBar(Hass):
|
||||
|
||||
self.log(f'Sending remote command: {command}')
|
||||
self.call_service(
|
||||
service='remote/send_command',
|
||||
entity_id=self.remote_entity.entity_id,
|
||||
device='BoseTV',
|
||||
command=command
|
||||
service='remote/send_command', entity_id=self.remote_entity.entity_id, device='BoseTV', command=command
|
||||
)
|
||||
|
||||
def turn_on_soundbar(self, entity=None, attribute=None, old=None, new=None, kwargs=None):
|
||||
|
||||
Reference in New Issue
Block a user