From a36f1032ac1d479a5d362a410242a3ef015f7ceb Mon Sep 17 00:00:00 2001 From: Carlo Costanzo Date: Mon, 24 Nov 2025 11:22:21 -0500 Subject: [PATCH] Add PC lock/unlock automation and update README with new configuration details for HASS.Agent integration #Closes #160 --- README.md | 1 + config/packages/README.md | 1 + config/packages/hass_agent_homepc.yaml | 35 ++++++++++++++++++++++++++ config/packages/sleepiq.yaml | 19 +++++++++++--- 4 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 config/packages/hass_agent_homepc.yaml diff --git a/README.md b/README.md index c66575f7..cfc1c3ef 100755 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ Live, personal Home Assistant configuration shared for **browsing and inspiratio - Garage routines and entry lighting: [config/packages/garadget.yaml](config/packages/garadget.yaml), [config/automation/garage_entry_light.yaml](config/automation/garage_entry_light.yaml) - Holiday/front-of-house color scenes: [config/scene/monthly_colors.yaml](config/scene/monthly_colors.yaml), [config/script/monthly_color_scene.yaml](config/script/monthly_color_scene.yaml) - Dash-button triggers for quick actions: [config/automation/dash_buttons.yaml](config/automation/dash_buttons.yaml) +- PC lock/unlock-driven lighting via HASS.Agent: [config/packages/hass_agent_homepc.yaml](config/packages/hass_agent_homepc.yaml) - Battery and solar awareness: [config/packages/powerwall.yaml](config/packages/powerwall.yaml) - Presence-aware office comfort: [config/packages/office_motion.yaml](config/packages/office_motion.yaml) - Weather-aware lighting: [config/automation/dark_rainy_day.yaml](config/automation/dark_rainy_day.yaml) diff --git a/config/packages/README.md b/config/packages/README.md index 611f1b34..065e3029 100755 --- a/config/packages/README.md +++ b/config/packages/README.md @@ -46,6 +46,7 @@ Live collection of plug-and-play Home Assistant packages. Each YAML file in this | [phynplus.yaml](phynplus.yaml) | Tie the Phyn Plus smart shutoff into HA notifications, automations, and valve overrides. | `valve.phyn_shutoff_valve`, `binary_sensor.phyn_leak_test_running`, `script.notify_engine_two_button` | | [powerwall.yaml](powerwall.yaml) | Track Tesla Powerwall grid status and shed loads automatically when off-grid. | `binary_sensor.powerwall_grid_status`, `sensor.powerwall_*`, `script.notify_engine` | | [vacuum.yaml](vacuum.yaml) | Dreame (ex-Neato) vacuum orchestration with maintenance reminders and reset helpers. | `sensor.l10s_vacuum_task_status`, `sensor.l10s_vacuum_sensor_dirty_left`, `button.l10s_vacuum_reset_sensor` | +| [hass_agent_homepc.yaml](hass_agent_homepc.yaml) | Mirrors PC lock/unlock state from HASS.Agent to the office lamp for instant desk presence cues. | `sensor.carlo_homepc_carlo_homepc_sessionstate`, `switch.office_lamp_switch` | | [finance.yaml](finance.yaml) | Yahoo Finance sensor bundle for portfolio glances and Lovelace cards. | `sensor.tsla`, `sensor.aapl`, `sensor.amzn`, `sensor.msft` | ### Blog & video deep dives diff --git a/config/packages/hass_agent_homepc.yaml b/config/packages/hass_agent_homepc.yaml new file mode 100644 index 00000000..bbe7af55 --- /dev/null +++ b/config/packages/hass_agent_homepc.yaml @@ -0,0 +1,35 @@ +#------------------------------------------- +# Control the office lamp based on CARLO-HOMEPC session state via HASS.Agent. +# Sleep Number bed-triggered PC lock/monitor sleep lives in config/packages/sleepiq.yaml. +# Docs: https://hassagent.readthedocs.io/en/latest/ +#------------------------------------------- + +automation: + - alias: "Office Lamp - Follow CARLO-HOMEPC Session" + id: 7b3f9e14-55b1-44aa-a6eb-2e0873a4c2bb + mode: single + trigger: + - platform: state + entity_id: sensor.carlo_homepc_carlo_homepc_sessionstate + to: 'Locked' + id: locked + - platform: state + entity_id: sensor.carlo_homepc_carlo_homepc_sessionstate + to: 'Unlocked' + id: unlocked + action: + - choose: + - conditions: + - condition: trigger + id: locked + sequence: + - service: switch.turn_off + target: + entity_id: switch.office_lamp_switch + - conditions: + - condition: trigger + id: unlocked + sequence: + - service: switch.turn_on + target: + entity_id: switch.office_lamp_switch diff --git a/config/packages/sleepiq.yaml b/config/packages/sleepiq.yaml index f8e9045c..ccd84669 100755 --- a/config/packages/sleepiq.yaml +++ b/config/packages/sleepiq.yaml @@ -49,6 +49,19 @@ group: - sensor.sleepnumber_carlo_stacey_sleepnumber # - sensor.Stacey_sleep_hours -############################################################################## -### Automations - Detect when things are not right. Like any Good Watchdog. -############################################################################## +automation: + - alias: "CARLO-HOMEPC - Lock PC and Sleep Monitors When Carlo Is in Bed" + id: 25c69640-4c38-46a2-82ae-5a32c3c6f1b4 + mode: single + trigger: + - platform: state + entity_id: binary_sensor.sleepnumber_carlo_carlo_is_in_bed + from: 'off' + to: 'on' + action: + - service: button.press + target: + entity_id: button.carlo_homepc_carlo_homepc_lock + - service: button.press + target: + entity_id: button.carlo_homepc_carlo_homepc_monitorsleep