diff --git a/apps/ad_toolbox b/apps/ad_toolbox index 191e69e..cded4a0 160000 --- a/apps/ad_toolbox +++ b/apps/ad_toolbox @@ -1 +1 @@ -Subproject commit 191e69eb1d82a1336645fb86b79cacd981466ab3 +Subproject commit cded4a0200e200265f9cad4c8dc2b9f3e7b51681 diff --git a/apps/smartlight.py b/apps/smartlight.py index f9b9835..04f2012 100644 --- a/apps/smartlight.py +++ b/apps/smartlight.py @@ -190,7 +190,7 @@ class SmartLight(SmartSwitch): def on_turn_on_with_transition(self, event_name, data, event_category): transition_time = self.args["on_events_with_transition"][event_category]["transition_time"] brightness_pct = self.args["on_events_with_transition"][event_category]["brightness_pct"] - self.log(f"Turn on at {brightness_pct}% with a transition of {transition_time}s") + self.log_info(f"Turn on at {brightness_pct}% with a transition of {transition_time}s") self.call_service("light/turn_on", entity_id = self.entity_id,brightness_pct = 1) self.call_service("light/turn_on", entity_id = self.entity_id, transition = transition_time,brightness_pct = brightness_pct) @@ -210,7 +210,7 @@ class SmartLight(SmartSwitch): # Override: apply light_brightness_pct when turning on, if one is active. def switch_on(self): if self.light_brightness_pct != None: - self.log(f"Turn on {self.entity_id} at {self.light_brightness_pct}%") + self.log_info(f"Turn on {self.entity_id} at {self.light_brightness_pct}%") self.call_service("light/turn_on", entity_id = self.entity_id,brightness_pct = self.light_brightness_pct) else: super().switch_on() diff --git a/apps/smartswitch.py b/apps/smartswitch.py index eb6425f..f602729 100644 --- a/apps/smartswitch.py +++ b/apps/smartswitch.py @@ -104,7 +104,7 @@ class SmartSwitch(SmartObject): if self.smart_conditions_evaluator == None: self.off_conditions_evaluator = SmartCondition.Evaluator(self,self.args['off_conditions'],condition_name = "off_conditions",on_succeed_cb = self.on_off_conditions,constants = self.constants, templates_library = self.templates_library) else: - self.log(f"Warning you can't have both an off_conditons and a smart_conditions, the off_conditions will be ignored") + self.log_warning(f"Warning you can't have both an off_conditons and a smart_conditions, the off_conditions will be ignored") # Event-driven controls (off / on / toggle / iOS action) self.event_handlers = [] @@ -120,12 +120,12 @@ class SmartSwitch(SmartObject): self.auto_switch_cb_handle = None if 'auto_switch_on_after' in self.args: if self.is_off(): - self.log(f"Smartswitch has been restarted while it was on. Since we have auto_switch_on_after activated we turn it on as we can't know how long is left for the timer",level = 'WARNING') + self.log_warning(f"Smartswitch has been restarted while it was on. Since we have auto_switch_on_after activated we turn it on as we can't know how long is left for the timer") self.switch_on() self.listen_state(self.on_state_change,self.entity_id, old = 'on',new = 'off') if 'auto_switch_off_after' in self.args: if self.is_on(): - self.log(f"Smartswitch has been restarted while it was on. Since we have auto_switch_off_after activated we turn it off as we can't know how long is left for the timer",level = 'WARNING') + self.log_warning(f"Smartswitch has been restarted while it was on. Since we have auto_switch_off_after activated we turn it off as we can't know how long is left for the timer") self.switch_off() self.listen_state(self.on_state_change,self.entity_id, old = 'off',new = 'on') @@ -137,7 +137,7 @@ class SmartSwitch(SmartObject): # listen_state callback for auto_switch_*_after. Cancels any pending # timer then arms a new one for the configured delay. def on_state_change(self, entity, attribute, old, new, kwargs): - self.log("state changed from " + str(old) + " to " + str(new)) + self.log_info("state changed from " + str(old) + " to " + str(new)) if old != new: if self.auto_switch_cb_handle != None: self.cancel_timer(self.auto_switch_cb_handle) @@ -145,18 +145,18 @@ class SmartSwitch(SmartObject): if new == 'on' and 'auto_switch_off_after' in self.args: delay = self.args['auto_switch_off_after'] - self.log(f"{self.entity_id} will auto switch on in {delay}s") + self.log_info(f"{self.entity_id} will auto switch on in {delay}s") self.auto_switch_cb_handle = self.run_in(self.on_auto_switch_after, delay, new_state = 'off',autoswitch_delay = delay) if new == 'off' and 'auto_switch_on_after' in self.args: delay = self.args['auto_switch_on_after'] - self.log(f"{self.entity_id} will auto switch off in {delay}s") + self.log_info(f"{self.entity_id} will auto switch off in {delay}s") self.auto_switch_cb_handle = self.run_in(self.on_auto_switch_after, delay, new_state = 'on',autoswitch_delay = delay) # Timer callback: applies the deferred state set by auto_switch_*_after. def on_auto_switch_after(self, kwargs): self.auto_switch_cb_handle = None new_state = kwargs['new_state'] - self.log(f"Switching {self.entity_id} {new_state} after {kwargs['autoswitch_delay']}s") + self.log_info(f"Switching {self.entity_id} {new_state} after {kwargs['autoswitch_delay']}s") if new_state == 'on': self.switch_on() else: @@ -167,7 +167,7 @@ class SmartSwitch(SmartObject): # ------------------------------------------------------------------ def switch_on(self): - self.log(f"Turn on {self.entity_id}") + self.log_info(f"Turn on {self.entity_id}") self.turn_on(self.entity_id) # not needed yet # if self.smart_conditions_evaluator: @@ -176,7 +176,7 @@ class SmartSwitch(SmartObject): # self.off_conditions_evaluator.force_last_evaluation_result(SmartCondition.Result.Succeeded) def switch_off(self): - self.log(f"Turn off {self.entity_id}") + self.log_info(f"Turn off {self.entity_id}") self.turn_off(self.entity_id) # not needed yet # if self.smart_conditions_evaluator: @@ -186,10 +186,10 @@ class SmartSwitch(SmartObject): def on_toggle_event(self, event_name, data, kwargs): if self.is_on(): - self.log(f"Toggled off by event {event_name}") + self.log_info(f"Toggled off by event {event_name}") self.switch_off() else: - self.log(f"Toggled on by event {event_name}") + self.log_info(f"Toggled on by event {event_name}") self.switch_on() def is_on(self): return self.get_state(self.entity_id) != 'off' @@ -201,11 +201,11 @@ class SmartSwitch(SmartObject): # ------------------------------------------------------------------ def on_turn_off_event(self, event_name, data, kwargs): - self.log(f"Turned off by event {event_name}") + self.log_info(f"Turned off by event {event_name}") self.switch_off() def on_turn_on_event(self, event_name, data, kwargs): - self.log(f"Turned on by event {event_name}") + self.log_info(f"Turned on by event {event_name}") self.switch_on() def on_toggle_event_action(self, event_name, data, kwargs): diff --git a/apps/vertex2.py b/apps/vertex2.py index 3522c9e..ea84ed6 100644 --- a/apps/vertex2.py +++ b/apps/vertex2.py @@ -268,7 +268,7 @@ class Vertex2(SmartObject): for sensor in self.allm_sensors.values(): sensor.set_state(state='unavailable') self.audio_out_signal_sensor.set_state(state='unavailable') - self.log(f'Vertex2 IP INTERRUPT unavailable: {error}', level='WARNING') + self.log_warning(f'Vertex2 IP INTERRUPT unavailable: {error}') interrupt_stop.wait(5) def trigger_tx0_stuck_workaround(self, kwargs): @@ -323,7 +323,7 @@ class Vertex2(SmartObject): def on_input_selected_sensor_change(self,entity, attribute, old, new, kwargs): if old != new: - self.log(f"input_select switch from {old} to {new}") + self.log_info(f"input_select switch from {old} to {new}") if old in self.input_names: input_id = self.input_names[old] config = self.args['input_config'][input_id] @@ -348,7 +348,7 @@ class Vertex2(SmartObject): def select_input(self,input_selected): try: input_value = int(input_selected) except ValueError: input_value = self.input_names[input_selected] - self.log(f"Switching to input {input_value}") + self.log_info(f"Switching to input {input_value}") self.send_cmd("insel",f"{input_value} {input_value}") def on_update_output_selection(self): @@ -391,7 +391,7 @@ class Vertex2(SmartObject): ) self._refresh_selected_output_signal() - self.log(f"Selecting TX{output_index} as the active output") + self.log_info(f"Selecting TX{output_index} as the active output") self.apply_output_audio_settings(output_index) if output_index == 0: self.force_tx1_plus5(False) @@ -434,21 +434,21 @@ class Vertex2(SmartObject): f'{r.text[:160]!r}' ) except (Timeout,ConnectionError): - self.log(f"{request} is unreachable", level = "WARNING") + self.log_warning(f"{request} is unreachable") def mute_tx0(self, mute): self.send_cmd("mutetx0audio","on" if mute else "off") def force_tx0_plus5(self, enabled): - self.log(f"Setting TX0 +5V FORCE to {enabled}") + self.log_info(f"Setting TX0 +5V FORCE to {enabled}") self.send_cmd("tx0plus5", "on" if enabled else "off") def force_tx1_plus5(self, enabled): - self.log(f"Setting TX1 +5V FORCE to {enabled}") + self.log_info(f"Setting TX1 +5V FORCE to {enabled}") self.send_cmd("tx1plus5", "on" if enabled else "off") def toggle_filmmaker_mode(self, value): - self.log(f"Setting filmmaker mode to {value}") + self.log_info(f"Setting filmmaker mode to {value}") self.send_cmd("filmmaker","on" if value else "off") def on_output_config_conditions_update(self, output_index): @@ -494,18 +494,18 @@ class Vertex2(SmartObject): self.send_cmd('edid', 'audioout on') def set_edid_video_flags_to_tx0(self): - self.log(f"Setting EDID Video Flags to TX0") + self.log_info(f"Setting EDID Video Flags to TX0") self.send_cmd("edid","videotx0 on") def set_edid_video_flags_to_tx1(self): - self.log(f"Setting EDID Video Flags to TX1") + self.log_info(f"Setting EDID Video Flags to TX1") self.send_cmd("edid","videotx1 on") def mute_tx1(self, mute): self.send_cmd("mutetx1audio","on" if mute else "off") def reboot(self): - self.log("Rebooting Vertex2") + self.log_info("Rebooting Vertex2") self.send_cmd("reboot") def get_input_config(self,input_number):