Still iterating on the home cinema configuration

This commit is contained in:
Pierre committed 2026-09-26 16:43:24 +02:00
1 parent ed6f218968
commit ed59a72c3f
6 files changed
+232 -35

No files matched your search

+8 -1
View File
@@ -1,5 +1,6 @@
import appdaemon.plugins.hass.hassapi as hass
from smartswitch import SmartSwitch
from ad_toolbox.eventhandler import EventHandler
import ad_toolbox.smartcondition as SmartCondition
import telnetlib
import time
@@ -36,6 +37,8 @@ class SmartProjector(SmartSwitch):
if 'press_enter_event' in self.args:
self.listen_event(lambda event_name, data, kwargs: self.press_enter(),self.args['press_enter_event'])
if 'press_enter_events' in self.args:
self.event_handlers.append(EventHandler(self, self.args['press_enter_events'], self.on_press_enter_event))
self.projector_ready_conditions = SmartCondition.Evaluator(self,self.args["projector_ready_conditions"],condition_name = 'projector_ready_conditions')
@@ -195,8 +198,12 @@ class SmartProjector(SmartSwitch):
self.attributes['warming_up'] = False
self.entity.set_state(state = self.get_projector_state(),attributes = self.attributes)
def on_press_enter_event(self, event_name, data, event_context):
self.press_enter()
def press_enter(self):
self.send_cmd("enter")
if self.entity.get_state() == 'on':
self.send_cmd("enter")
def send_cmd(self,cmd, log_command = False):
cmd = f"*{cmd}#"