|
| 1 | +# Home Assistant opensleep Setup |
| 2 | + |
| 3 | +## configuration.yaml |
| 4 | + |
| 5 | +```yaml |
| 6 | +... |
| 7 | +mqtt: |
| 8 | + - text: |
| 9 | + name: "opensleep sleep time" |
| 10 | + command_topic: "opensleep/actions/set_profile" |
| 11 | + command_template: > |
| 12 | + {% if value %} |
| 13 | + both.sleep={{ value }} |
| 14 | + {% endif %} |
| 15 | + retain: false |
| 16 | + pattern: ^([01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9])?$ |
| 17 | + state_topic: "opensleep/state/config/profile/left/sleep" |
| 18 | + - text: |
| 19 | + name: "opensleep wake time" |
| 20 | + command_topic: "opensleep/actions/set_profile" |
| 21 | + command_template: > |
| 22 | + {% if value %} |
| 23 | + both.wake={{ value }} |
| 24 | + {% endif %} |
| 25 | + retain: false |
| 26 | + pattern: ^([01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9])?$ |
| 27 | + state_topic: "opensleep/state/config/profile/left/wake" |
| 28 | + - text: |
| 29 | + name: "opensleep alarm" |
| 30 | + command_topic: "opensleep/actions/set_profile" |
| 31 | + command_template: > |
| 32 | + {% if value %} |
| 33 | + both.alarm={{ value }} |
| 34 | + {% endif %} |
| 35 | + retain: false |
| 36 | + state_topic: "opensleep/state/config/profile/left/alarm" |
| 37 | + - text: |
| 38 | + name: "opensleep target temp" |
| 39 | + command_topic: "opensleep/state/frozen/left_target_temp" # RO |
| 40 | + retain: false |
| 41 | + state_topic: "opensleep/state/frozen/left_target_temp" |
| 42 | + - text: |
| 43 | + name: "opensleep current temp" |
| 44 | + command_topic: "opensleep/state/frozen/left_temp" # RO |
| 45 | + retain: false |
| 46 | + state_topic: "opensleep/state/frozen/left_temp" |
| 47 | + - switch: |
| 48 | + name: "opensleep away mode" |
| 49 | + command_topic: "opensleep/set_away_mode" |
| 50 | + state_topic: "opensleep/state/config/away_mode" |
| 51 | + retain: false |
| 52 | + - text: |
| 53 | + name: "opensleep temperatures" |
| 54 | + command_topic: "opensleep/actions/set_profile" |
| 55 | + command_template: > |
| 56 | + {% if value %} |
| 57 | + both.temperatures={{ value }} |
| 58 | + {% endif %} |
| 59 | + retain: false |
| 60 | + state_topic: "opensleep/state/config/profile/left/temperatures" |
| 61 | +``` |
| 62 | +
|
| 63 | +## Dashboard |
| 64 | +
|
| 65 | +```yaml |
| 66 | +views: |
| 67 | + - title: # ... |
| 68 | + # ... |
| 69 | + cards: |
| 70 | + - type: entities |
| 71 | + entities: |
| 72 | + - entity: text.opensleep_sleep_time |
| 73 | + name: sleep time |
| 74 | + icon: mdi:bed-clock |
| 75 | + - entity: text.opensleep_wake_time |
| 76 | + icon: mdi:sun-clock |
| 77 | + name: wake time |
| 78 | + - entity: text.opensleep_temperatures |
| 79 | + name: temperatures |
| 80 | + icon: mdi:thermometer |
| 81 | + - entity: text.opensleep_alarm |
| 82 | + icon: mdi:alarm |
| 83 | + name: alarm |
| 84 | +``` |
| 85 | +
|
| 86 | +## Automations |
| 87 | +
|
| 88 | +```yaml |
| 89 | +alias: "opensleep leave bed" |
| 90 | +description: "" |
| 91 | +triggers: |
| 92 | + - trigger: mqtt |
| 93 | + topic: opensleep/state/presence/any |
| 94 | + payload: "false" |
| 95 | +conditions: [] |
| 96 | +actions: |
| 97 | + - action: light.turn_on |
| 98 | + metadata: {} |
| 99 | + data: |
| 100 | + brightness_pct: 100 |
| 101 | + target: |
| 102 | + area_id: 107d |
| 103 | +mode: single |
| 104 | +``` |
0 commit comments