formatting

This commit is contained in:
John Lancaster
2024-03-03 12:34:33 -06:00
parent d7312bb3ef
commit 2c77c3aa66

View File

@@ -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):