Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ Temporary Items
.apdisk

# Development files
.esphome
.esphome

HomeDicator-test.yaml
secrets.yaml
2 changes: 2 additions & 0 deletions HomeDicator/core/config/common/fonts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ font:
"\U000F0FD2", # mdi:bed-king
"\U000F0FD1", # mdi:bed-king-outline
"\U000F08A0", # mdi:bed-empty
"\U000F1C21", # mdi:bench
"\U000F00DE", # mdi:brightness-5
"\U000F1302", # mdi:bunk-bed
"\U000F0097", # mdi:bunk-bed-outline
Expand Down Expand Up @@ -208,6 +209,7 @@ font:
"\U000F12BE", # mdi:stairs-down
"\U000F12BD", # mdi:stairs-up
"\U000F12BA", # mdi:string-lights
"\U000F12BB", # mdi:string-lights-off
"\U000F06AC", # mdi:subway
"\U000F04DF", # mdi:subway-variant
"\U000F04E6", # mdi:sync
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ ota:
wifi:
ssid: ${wifi_ssid}
password: ${wifi_password}
domain: ${wifi_domain}
reboot_timeout: ${wifi_reboot_timeout}
on_disconnect:
- lvgl.label.update:
id: lvgl_wifi_signal_icon
Expand Down
41 changes: 41 additions & 0 deletions HomeDicator/core/templates/mode_climate_sensor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# NOTE: this must be placed in your configuration under text_sensor, not sensor.
platform: homeassistant
id: mode_${hass_climate_id}
entity_id: climate.${hass_climate_id}
on_value:
- if:
condition:
lambda: |-
return !id(user_is_interacting);
then:
- lvgl.buttonmatrix.update:
id: mode_selector
state:
disabled: false
- if:
condition:
lambda: 'return "off" == x;'
then:
- lvgl.matrix.button.update:
id: state_off
selected: true
control:
checked: true
- if:
condition:
lambda: 'return "cool" == x;'
then:
- lvgl.matrix.button.update:
id: state_cool
selected: true
control:
checked: true
- if:
condition:
lambda: 'return "heat" == x;'
then:
- lvgl.matrix.button.update:
id: state_heat
selected: true
control:
checked: true
18 changes: 18 additions & 0 deletions HomeDicator/core/templates/spinbox_climate_sensor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
platform: homeassistant
id: ${hass_climate_id}
entity_id: climate.${hass_climate_id}
attribute: temperature
on_value:
- lvgl.widget.update:
id: lvgl_spinbox_${hass_climate_id}
state:
disabled: false
- if:
condition:
lambda: |-
return !id(user_is_interacting);
then:
- lvgl.spinbox.update:
id: lvgl_spinbox_${hass_climate_id}
value: !lambda |-
return x;
50 changes: 50 additions & 0 deletions HomeDicator/core/templates/switch_sensor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# NOTE: this must be placed in your configuration under text_sensor, not sensor.
platform: homeassistant
id: ${hass_domain}_${hass_entity_id}
entity_id: ${hass_domain}.${hass_entity_id}
on_value:
- lambda: |-
ESP_LOGI("SWITCH", "got new state for ${hass_domain}.${hass_entity_id}: %s", x.c_str());
- if:
condition:
lambda: |-
return !id(user_is_interacting);
then:
- logger.log: "running switch on_value"
- if:
condition:
lambda: 'return "on" == x;'
then:
- logger.log: "setting switch to on"
- lvgl.widget.update:
id: button_${hass_domain}_${hass_entity_id}
state:
checked: true
disabled: false
- lvgl.label.update:
id: label_${hass_domain}_${hass_entity_id}
text: ${icon_on}
text_color: 0xeebf41
- if:
condition:
lambda: 'return "off" == x;'
then:
- logger.log: "setting switch to off"
- lvgl.widget.update:
id: button_${hass_domain}_${hass_entity_id}
state:
checked: false
disabled: false
- lvgl.label.update:
id: label_${hass_domain}_${hass_entity_id}
text: ${icon_off}
text_color: 0xababab
- if:
condition:
lambda: 'return "unavailable" == x || "unknown" == x;'
then:
- logger.log: "setting switch to unknown"
- lvgl.widget.update:
id: button_${hass_domain}_${hass_entity_id}
state:
disabled: true
51 changes: 51 additions & 0 deletions HomeDicator/user_interface/templates/tiles/switch/square.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
obj:
styles: info_or_button_tile
layout:
type: FLEX
flex_flow: COLUMN
flex_align_main: CENTER
flex_align_cross: CENTER
flex_align_track: CENTER
pad_row: 0
widgets:
- obj:
bg_opa: TRANSP
layout:
type: FLEX
flex_flow: COLUMN
flex_align_main: CENTER
flex_align_cross: CENTER
flex_align_track: CENTER
pad_row: 20
widgets:
- button:
checkable: true
state:
disabled: true
bg_opa: TRANSP
pressed:
bg_opa: TRANSP
checked:
bg_opa: TRANSP
shadow_opa: TRANSP
id: button_${hass_domain}_${hass_entity_id}
widgets:
- label:
id: label_${hass_domain}_${hass_entity_id}
text_font: icons35
text_align: CENTER
text_color: 0xababab
text: ${icon_off}
bg_opa: TRANSP
bg_color: 0x272727
border_width: 0
on_short_click:
- logger.log: "switch clicked"
- homeassistant.action:
action: ${hass_action}
data:
entity_id: ${hass_domain}.${hass_entity_id}
- label:
styles: info_or_button_tile_subtitle
text: ${title}
text_font: libreFranklin10
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if:
condition:
lambda: |-
return id(user_is_interacting);
then:
- homeassistant.action:
action: climate.set_temperature
data:
entity_id: climate.${hass_climate_id}
temperature: !lambda |-
return static_cast<int>(x);
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
obj:
styles: info_or_button_tile
layout:
type: FLEX
flex_flow: COLUMN
flex_align_main: CENTER
flex_align_cross: CENTER
flex_align_track: CENTER
pad_row: 0
widgets:
- obj:
bg_opa: TRANSP
width: 205
pad_all: 0
layout:
type: FLEX
flex_flow: ROW
flex_align_main: CENTER
flex_align_cross: CENTER
flex_align_track: CENTER
pad_row: 0
widgets:
- buttonmatrix:
id: mode_selector
one_checked: true
bg_opa: TRANSP
width: 205
height: 50
border_width: 0
pad_all: 0
state:
disabled: true
rows:
- buttons:
- id: state_off
text: "Off"
control:
checkable: true
- id: state_heat
text: "Heat"
control:
checkable: true
# heat on: 0xc84545
# heat off: 0x8D3030
- id: state_cool
text: "Cool"
control:
checkable: true
# cool on: 0x34b3ce
# cool off: 0x23798D
on_press:
then:
- globals.set:
id: user_is_interacting
value: 'true'
on_release:
then:
- globals.set:
id: user_is_interacting
value: 'false'
- if:
condition:
lambda: 'return id(state_off) == x;'
then:
- logger.log:
format: "set climate mode to off"
- homeassistant.action:
action: climate.set_hvac_mode
data:
entity_id: climate.${hass_climate_id}
hvac_mode: "off"
- if:
condition:
lambda: 'return id(state_heat) == x;'
then:
- logger.log:
format: "set climate mode to heat"
- homeassistant.action:
action: climate.set_hvac_mode
data:
entity_id: climate.${hass_climate_id}
hvac_mode: "heat"
- if:
condition:
lambda: 'return id(state_cool) == x;'
then:
- logger.log:
format: "set climate mode to cool"
- homeassistant.action:
action: climate.set_hvac_mode
data:
entity_id: climate.${hass_climate_id}
hvac_mode: "cool"
- label:
text_align: CENTER
styles: info_or_button_tile_subtitle
text: ${title}
text_font: libreFranklin10
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
obj:
styles: info_or_button_tile
layout:
type: FLEX
flex_flow: COLUMN
flex_align_main: CENTER
flex_align_cross: CENTER
flex_align_track: CENTER
pad_row: 0
widgets:
- obj:
bg_opa: TRANSP
width: 205
pad_all: 0
layout:
type: FLEX
flex_flow: ROW
flex_align_main: CENTER
flex_align_cross: CENTER
flex_align_track: CENTER
pad_row: 0
widgets:
- button:
id: spin_down
bg_color: 0x34b3ce
on_press:
then:
- globals.set:
id: user_is_interacting
value: 'true'
- lvgl.spinbox.decrement: lvgl_spinbox_${hass_climate_id}
on_release:
then:
- globals.set:
id: user_is_interacting
value: 'false'
widgets:
- label:
text: "-"
- spinbox:
id: lvgl_spinbox_${hass_climate_id}
align: CENTER
text_align: CENTER
bg_opa: TRANSP
border_width: 0
pad_all: 0
width: 50
text_font: libreFranklin32
text_color: 0xeebf41
state:
disabled: true
range_from: ${min_value}
range_to: ${max_value}
value: ${min_value}
step: 1
rollover: false
digits: 2
decimal_places: 0
on_value: !include helpers/spinbox_on_value.yaml
- button:
id: spin_up
bg_color: 0xc84545
on_press:
then:
- globals.set:
id: user_is_interacting
value: 'true'
- lvgl.spinbox.increment: lvgl_spinbox_${hass_climate_id}
on_release:
then:
- globals.set:
id: user_is_interacting
value: 'false'
widgets:
- label:
text: "+"
- label:
text_align: CENTER
styles: info_or_button_tile_subtitle
text: ${title}
text_font: libreFranklin10
Loading