You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Home-AssistantConfig/config/packages/sleepiq.yaml

134 lines
4.1 KiB

######################################################################
# @CCOSTAN - Follow Me on X
# For more info visit https://www.vcloudinfo.com/click-here
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# -------------------------------------------------------------------
# SleepIQ - Bed presence and Sleep Number metrics
# SleepIQ sensors, helpers, and bed-related automations.
# -------------------------------------------------------------------
# Related Issue: 1568
# Notes: "Carlo Snore Mode" (input_boolean) can be voice-controlled via Alexa.
# Preset option strings may differ per bed; adjust "Snore"/"Flat"
# below if needed to match your select entity's options.
# Notes: Single-package preference: keep all SleepIQ device-specific YAML
# (helpers/automations) centralized in this file.
######################################################################
homeassistant:
customize_glob:
"sensor.*_sleep_hours":
unit_of_measurement: hours
icon: mdi:sleep
# customize:
# sensor.Carlo_sleep_hours:
# friendly_name: 'Carlo Slept last night'
# sensor.Stacey_sleep_hours:
# friendly_name: 'Stacey Slept last night'
#-------------------------------------------
sleepiq:
username: !secret sleepiq_username
password: !secret sleepiq_password
#-------------------------------------------
# sensor:
# - platform: history_stats
# name: Carlo_sleep_hours
# entity_id: binary_sensor.sleepnumber_carlo_carlo_is_in_bed
# state: 'on'
# type: time
# end: '{{ now() }}'
# duration:
# hours: 24
#
# - platform: history_stats
# name: Stacey_sleep_hours
# entity_id: binary_sensor.sleepnumber_carlo_stacey_is_in_bed
# state: 'on'
# type: time
# end: '{{ now() }}'
# duration:
# hours: 24
input_boolean:
carlo_snore:
name: Carlo Snore Mode
icon: mdi:bed
group:
bed:
entities:
- binary_sensor.sleepnumber_carlo_carlo_is_in_bed
- sensor.sleepnumber_carlo_carlo_sleepnumber
# - sensor.Carlo_sleep_hours
- binary_sensor.sleepnumber_carlo_stacey_is_in_bed
- sensor.sleepnumber_carlo_stacey_sleepnumber
# - sensor.Stacey_sleep_hours
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
- alias: "SLEEPIQ - Carlo Snore On (Foundation Right)"
id: 7bc879bb-9cc9-4b30-8eea-4b15a9fb7b25
mode: single
trigger:
- platform: state
entity_id: input_boolean.carlo_snore
from: "off"
to: "on"
action:
- service: select.select_option
continue_on_error: true
target:
entity_id: select.sleepnumber_carlo_foundation_preset_right
data:
option: "Snore"
- alias: "SLEEPIQ - Carlo Snore Off (Foundation Right Flat)"
id: 2f80d533-73f1-4079-9e91-4375cfabf8dc
mode: single
trigger:
- platform: state
entity_id: input_boolean.carlo_snore
from: "on"
to: "off"
action:
- service: select.select_option
continue_on_error: true
target:
entity_id: select.sleepnumber_carlo_foundation_preset_right
data:
option: "Flat"
- alias: "SLEEPIQ - Auto Disable Carlo Snore When Out Of Bed 20m"
id: 962c51d9-3ca7-4ebb-a516-5fc650b4b1a8
mode: single
trigger:
- platform: state
entity_id: binary_sensor.sleepnumber_carlo_carlo_is_in_bed
from: "on"
to: "off"
for: "00:20:00"
condition:
- condition: state
entity_id: input_boolean.carlo_snore
state: "on"
action:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.carlo_snore

Powered by TurnKey Linux.