forked from gcormier/megadesk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# User-contributed samples | ||
For esphome, not vetted but hopefully can provide ideas. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
- id: '1665206728980' | ||
alias: Stand Every Workday | ||
description: '' | ||
trigger: | ||
- platform: time | ||
at: 07:55:00 | ||
condition: | ||
- condition: state | ||
entity_id: binary_sensor.workday_sensor | ||
state: 'on' | ||
- condition: device | ||
device_id: 24637765d54f431d8aabcc70fea8d9e3 | ||
domain: device_tracker | ||
entity_id: device_tracker.iphone | ||
type: is_home | ||
action: | ||
- device_id: dcc5e28a83dac013a370ee84060e0f3b | ||
domain: button | ||
entity_id: button.standing | ||
type: press | ||
mode: single | ||
- id: '1665206778134' | ||
alias: Sit at End of Workday | ||
description: Set desk to sitting to keep 'standing' stats accurate | ||
trigger: | ||
- platform: time | ||
at: '17:00:00' | ||
condition: | ||
- condition: state | ||
entity_id: binary_sensor.workday_sensor | ||
state: 'on' | ||
action: | ||
- device_id: dcc5e28a83dac013a370ee84060e0f3b | ||
domain: button | ||
entity_id: button.sitting | ||
type: press | ||
mode: single |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Custom Sensor to detect when standing | ||
|
||
template: | ||
- binary_sensor: | ||
- name: "standing" | ||
state: > | ||
{{ states('number.megadesk_height_cm')|float > 100 }} | ||
sensor: | ||
# time spent standing | ||
- platform: history_stats | ||
name: standing_today | ||
entity_id: binary_sensor.standing | ||
state: 'on' | ||
type: time | ||
start: '{{ now().replace(hour=0, minute=0, second=0) }}' | ||
end: '{{ now().replace(hour=23, minute=59, second=59) }}' | ||
- platform: template | ||
sensors: | ||
time_standing: | ||
unit_of_measurement: "Hours" | ||
value_template: "{{ (states('sensor.standing_today') | float) }}" | ||
friendly_name: 'Time Standing' | ||
|
||
# time TV is on Today | ||
- platform: history_stats | ||
name: roku_on_today | ||
entity_id: media_player.55_tcl_roku_tv | ||
state: 'on' | ||
type: time | ||
start: '{{ now().replace(hour=0, minute=0, second=0) }}' | ||
end: '{{ now().replace(hour=23, minute=59, second=59) }}' | ||
- platform: template | ||
sensors: | ||
tv_consumption: | ||
unit_of_measurement: "Hours" | ||
value_template: "{{ (states('sensor.roku_on_today') | float) }}" | ||
friendly_name: 'TV Consumption' | ||
|
||
|
||
# work day sensor targeted to BC (used by automation for standing desk) | ||
|
||
binary_sensor: | ||
- platform: workday | ||
country: CA | ||
province: BC | ||
workdays: [mon, tue, wed, thu, fri] | ||
excludes: [sat, sun, holiday] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Notes | ||
The only other changes I've made from the files checked into GitHub are to remove buttons 3-4 and rename button 1 to 'sitting' and button 2 to 'standing' | ||
|
||
## automations.yaml | ||
This checks to see if it's a work day (not a holiday) and if my iPhone is home and then sets the desk to standing. At the end of the day it sets it to sitting (to avoid skewing any stats) | ||
|
||
## Mini graph card | ||
``` | ||
type: custom:mini-graph-card | ||
entities: | ||
- entity: sensor.standing_today | ||
name: Time Spent Standing | ||
hours_to_show: 168 | ||
group_by: date | ||
aggregate_func: max | ||
show: | ||
graph: bar | ||
tap_action: | ||
action: more-info | ||
entity: button.standing | ||
color_thresholds: | ||
- color: '#e45e65' | ||
value: 0 | ||
- color: '#e0b400' | ||
value: 1 | ||
- color: '#0da035' | ||
value: 2 | ||
color_thresholds_transition: hard | ||
``` |