# Sample Home Assistant configuration for Hyprland Monitor Control # Copy relevant sections to your configuration files # Automations automation: # Basic presence-based control - alias: "Monitors - Turn off when away" description: "Turn off all monitors when nobody is home" trigger: - platform: state entity_id: group.all_persons to: "not_home" for: "00:05:00" # Wait 5 minutes to avoid false triggers action: - service: hyprmonitors.turn_off_all_monitors - service: notify.persistent_notification data: title: "Monitor Control" message: "All monitors turned off - nobody home" - alias: "Monitors - Turn on when arriving home" description: "Turn on monitors when someone arrives home" trigger: - platform: state entity_id: group.all_persons to: "home" condition: - condition: time after: "07:00:00" before: "23:00:00" action: - service: hyprmonitors.turn_on_all_monitors - service: notify.persistent_notification data: title: "Monitor Control" message: "Monitors turned on - welcome home!" # Time-based control - alias: "Monitors - Morning startup" description: "Turn on monitors in the morning on weekdays" trigger: - platform: time at: "07:30:00" condition: - condition: time weekday: - mon - tue - wed - thu - fri - condition: state entity_id: group.all_persons state: "home" action: - service: switch.turn_on entity_id: switch.hyprmonitors_all_monitors - alias: "Monitors - Evening shutdown" description: "Turn off monitors late at night" trigger: - platform: time at: "23:30:00" action: - service: switch.turn_off entity_id: switch.hyprmonitors_all_monitors # Work mode automation - alias: "Monitors - Focus mode" description: "Turn off secondary monitors during focus time" trigger: - platform: state entity_id: input_boolean.focus_mode to: "on" action: - service: hyprmonitors.turn_off_monitor data: monitor: "DP-2" # Adjust to your secondary monitor - service: hyprmonitors.turn_off_monitor data: monitor: "HDMI-A-1" # Adjust as needed - alias: "Monitors - Exit focus mode" description: "Turn on all monitors when exiting focus mode" trigger: - platform: state entity_id: input_boolean.focus_mode to: "off" action: - service: hyprmonitors.turn_on_all_monitors # Meeting automation (requires calendar integration) - alias: "Monitors - Meeting mode" description: "Adjust monitors for meetings" trigger: - platform: calendar event: start entity_id: calendar.work condition: - condition: template value_template: > {{ 'meeting' in trigger.calendar_event.summary.lower() or 'call' in trigger.calendar_event.summary.lower() }} action: # Keep only main monitor on for meetings - service: hyprmonitors.turn_on_monitor data: monitor: "DP-1" # Main monitor - service: hyprmonitors.turn_off_monitor data: monitor: "DP-2" # Secondary monitor # Power saving based on computer usage - alias: "Monitors - Idle detection" description: "Turn off monitors when computer is idle" trigger: - platform: state entity_id: binary_sensor.computer_active # You'd need to create this to: "off" for: "00:10:00" # 10 minutes idle condition: - condition: time after: "09:00:00" before: "22:00:00" action: - service: hyprmonitors.turn_off_all_monitors - alias: "Monitors - Activity detected" description: "Turn on monitors when computer becomes active" trigger: - platform: state entity_id: binary_sensor.computer_active to: "on" condition: - condition: state entity_id: group.all_persons state: "home" action: - service: hyprmonitors.turn_on_all_monitors # Input Booleans for manual control input_boolean: focus_mode: name: "Focus Mode" icon: mdi:focus-field monitor_automation: name: "Monitor Automation Enabled" initial: true icon: mdi:auto-mode # Scripts for complex monitor control script: gaming_mode: alias: "Gaming Mode" description: "Optimize monitors for gaming" sequence: - service: hyprmonitors.turn_on_monitor data: monitor: "DP-1" # Main gaming monitor - service: hyprmonitors.turn_off_monitor data: monitor: "DP-2" # Turn off secondary to reduce distractions - service: notify.persistent_notification data: title: "Monitor Control" message: "Gaming mode activated" work_mode: alias: "Work Mode" description: "Setup monitors for work" sequence: - service: hyprmonitors.turn_on_all_monitors - delay: "00:00:02" # Small delay between commands - service: notify.persistent_notification data: title: "Monitor Control" message: "Work mode activated - all monitors on" presentation_mode: alias: "Presentation Mode" description: "Setup for presentations" sequence: - service: hyprmonitors.turn_on_monitor data: monitor: "HDMI-A-1" # Projector/external display - service: hyprmonitors.turn_on_monitor data: monitor: "DP-1" # Laptop screen for notes - service: notify.persistent_notification data: title: "Monitor Control" message: "Presentation mode ready" # Sensors for monitoring sensor: - platform: template sensors: monitor_power_usage: friendly_name: "Estimated Monitor Power Usage" unit_of_measurement: "W" value_template: > {% set total_monitors = state_attr('sensor.hyprmonitors_monitor_status', 'total_monitors') | int %} {% set monitors_on = state_attr('sensor.hyprmonitors_monitor_status', 'monitors_on') | int %} {{ monitors_on * 30 }} # Assuming 30W per monitor icon_template: mdi:lightning-bolt # Groups for organization group: monitor_controls: name: "Monitor Controls" entities: - switch.hyprmonitors_all_monitors - sensor.hyprmonitors_monitor_status - input_boolean.focus_mode - input_boolean.monitor_automation # Lovelace Dashboard Configuration # Add this to your dashboard YAML or use the UI editor # Main Monitor Control Card type: vertical-stack cards: - type: entities title: "Monitor Status" entities: - entity: sensor.hyprmonitors_monitor_status name: "Overall Status" icon: mdi:monitor-multiple - entity: sensor.monitor_power_usage name: "Est. Power Usage" - type: divider - entity: switch.hyprmonitors_all_monitors name: "All Monitors" icon: mdi:power - type: horizontal-stack cards: - type: button entity: script.work_mode name: "Work Mode" icon: mdi:briefcase tap_action: action: call-service service: script.work_mode - type: button entity: script.gaming_mode name: "Gaming" icon: mdi:gamepad-variant tap_action: action: call-service service: script.gaming_mode - type: button entity: script.presentation_mode name: "Present" icon: mdi:presentation tap_action: action: call-service service: script.presentation_mode - type: entities title: "Individual Monitors" entities: - entity: switch.hyprmonitors_dp_1 name: "Main Monitor (DP-1)" icon: mdi:monitor - entity: switch.hyprmonitors_dp_2 name: "Secondary (DP-2)" icon: mdi:monitor - entity: switch.hyprmonitors_hdmi_a_1 name: "External (HDMI)" icon: mdi:monitor-speaker - type: entities title: "Automation Settings" entities: - entity: input_boolean.monitor_automation name: "Enable Automation" - entity: input_boolean.focus_mode name: "Focus Mode" # Alternative Glance Card Layout type: glance entities: - entity: sensor.hyprmonitors_monitor_status name: "Status" - entity: switch.hyprmonitors_all_monitors name: "All" - entity: switch.hyprmonitors_dp_1 name: "Main" - entity: switch.hyprmonitors_dp_2 name: "Secondary" title: "Monitor Quick Control" columns: 4 # Advanced Card with Custom Button Row type: custom:button-card name: "Monitor Control Hub" styles: card: - height: 120px tap_action: action: more-info entity: sensor.hyprmonitors_monitor_status custom_fields: status: | [[[ const status = states['sensor.hyprmonitors_monitor_status'].state; const icon = status === 'all_on' ? 'mdi:monitor-multiple' : status === 'all_off' ? 'mdi:monitor-off' : 'mdi:monitor-shimmer'; return ``; ]]] buttons: | [[[ return `
Work Game Off
`; ]]]