diff --git a/.gitignore b/.gitignore index 4da120d..9da54b9 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,7 @@ Temporary Items .apdisk # Development files -.esphome \ No newline at end of file +.esphome + +HomeDicator-test.yaml +secrets.yaml diff --git a/HomeDicator/core/config/common/fonts.yaml b/HomeDicator/core/config/common/fonts.yaml index dd9162a..3646ad6 100755 --- a/HomeDicator/core/config/common/fonts.yaml +++ b/HomeDicator/core/config/common/fonts.yaml @@ -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 @@ -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 diff --git a/HomeDicator/core/config/device/seeed-sensecap-indicator/hardware.yaml b/HomeDicator/core/config/device/seeed-sensecap-indicator/hardware.yaml index d07071f..968c751 100755 --- a/HomeDicator/core/config/device/seeed-sensecap-indicator/hardware.yaml +++ b/HomeDicator/core/config/device/seeed-sensecap-indicator/hardware.yaml @@ -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 diff --git a/HomeDicator/core/templates/mode_climate_sensor.yaml b/HomeDicator/core/templates/mode_climate_sensor.yaml new file mode 100755 index 0000000..1be8692 --- /dev/null +++ b/HomeDicator/core/templates/mode_climate_sensor.yaml @@ -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 \ No newline at end of file diff --git a/HomeDicator/core/templates/spinbox_climate_sensor.yaml b/HomeDicator/core/templates/spinbox_climate_sensor.yaml new file mode 100755 index 0000000..c63258b --- /dev/null +++ b/HomeDicator/core/templates/spinbox_climate_sensor.yaml @@ -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; diff --git a/HomeDicator/core/templates/switch_sensor.yaml b/HomeDicator/core/templates/switch_sensor.yaml new file mode 100755 index 0000000..e5bc189 --- /dev/null +++ b/HomeDicator/core/templates/switch_sensor.yaml @@ -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 diff --git a/HomeDicator/user_interface/templates/tiles/switch/square.yaml b/HomeDicator/user_interface/templates/tiles/switch/square.yaml new file mode 100644 index 0000000..2b5e1ee --- /dev/null +++ b/HomeDicator/user_interface/templates/tiles/switch/square.yaml @@ -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 diff --git a/HomeDicator/user_interface/templates/tiles/thermostat/helpers/spinbox_on_value.yaml b/HomeDicator/user_interface/templates/tiles/thermostat/helpers/spinbox_on_value.yaml new file mode 100755 index 0000000..063fd0b --- /dev/null +++ b/HomeDicator/user_interface/templates/tiles/thermostat/helpers/spinbox_on_value.yaml @@ -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(x); diff --git a/HomeDicator/user_interface/templates/tiles/thermostat/mode_square.yaml b/HomeDicator/user_interface/templates/tiles/thermostat/mode_square.yaml new file mode 100755 index 0000000..c5c31dc --- /dev/null +++ b/HomeDicator/user_interface/templates/tiles/thermostat/mode_square.yaml @@ -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 diff --git a/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_square.yaml b/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_square.yaml new file mode 100755 index 0000000..1daa149 --- /dev/null +++ b/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_square.yaml @@ -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 diff --git a/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_wide.yaml b/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_wide.yaml new file mode 100755 index 0000000..c7d89ea --- /dev/null +++ b/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_wide.yaml @@ -0,0 +1,86 @@ +obj: + height: SIZE_CONTENT + width: SIZE_CONTENT + pad_all: 0 + bg_opa: TRANSP + widgets: + - obj: + styles: info_or_button_tile_wide + width: 440 + layout: + type: FLEX + flex_flow: COLUMN + flex_align_main: START + flex_align_cross: CENTER + flex_align_track: CENTER + pad_row: 0 + widgets: + - label: + text_font: libreFranklin18 + text_color: 0xffffff + text: ${title} + pad_top: 18 + pad_bottom: 10 + - obj: + clickable: false + bg_opa: TRANSP + width: SIZE_CONTENT + height: SIZE_CONTENT + layout: + type: FLEX + flex_flow: ROW + flex_align_main: CENTER + flex_align_cross: CENTER + 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 + 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: "+" diff --git a/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_wide_half_height.yaml b/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_wide_half_height.yaml new file mode 100755 index 0000000..87955ed --- /dev/null +++ b/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_wide_half_height.yaml @@ -0,0 +1,99 @@ +obj: + height: SIZE_CONTENT + width: SIZE_CONTENT + pad_all: 0 + bg_opa: TRANSP + widgets: + - obj: + styles: info_or_button_tile_wide + width: 440 + height: 78 + layout: + type: FLEX + flex_flow: ROW + flex_align_main: SPACE_BETWEEN + flex_align_cross: CENTER + flex_align_track: CENTER + pad_row: 0 + widgets: + - obj: + clickable: false + bg_opa: TRANSP + width: SIZE_CONTENT + height: SIZE_CONTENT + pad_all: 0 + layout: + type: FLEX + flex_flow: ROW + flex_align_main: CENTER + flex_align_cross: CENTER + widgets: + - obj: + bg_opa: COVER + bg_color: ${color} + pad_all: 0 + height: 52 + width: 80 + radius: 25 + layout: + type: FLEX + flex_flow: COLUMN + flex_align_main: CENTER + flex_align_cross: CENTER + flex_align_track: CENTER + widgets: + - label: + styles: info_or_button_tile_icon + text: ${icon} + - 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 + 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: "+" diff --git a/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_wide_half_height_icon_right.yaml b/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_wide_half_height_icon_right.yaml new file mode 100755 index 0000000..56f1456 --- /dev/null +++ b/HomeDicator/user_interface/templates/tiles/thermostat/spinbox_wide_half_height_icon_right.yaml @@ -0,0 +1,99 @@ +obj: + height: SIZE_CONTENT + width: SIZE_CONTENT + pad_all: 0 + bg_opa: TRANSP + widgets: + - obj: + styles: info_or_button_tile_wide + width: 440 + height: 78 + layout: + type: FLEX + flex_flow: ROW + flex_align_main: SPACE_BETWEEN + flex_align_cross: CENTER + flex_align_track: CENTER + pad_row: 0 + widgets: + - obj: + clickable: false + bg_opa: TRANSP + width: SIZE_CONTENT + height: SIZE_CONTENT + pad_all: 0 + layout: + type: FLEX + flex_flow: ROW + flex_align_main: CENTER + flex_align_cross: CENTER + 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 + 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: "+" + - obj: + bg_opa: COVER + bg_color: ${color} + pad_all: 0 + height: 52 + width: 80 + radius: 25 + layout: + type: FLEX + flex_flow: COLUMN + flex_align_main: CENTER + flex_align_cross: CENTER + flex_align_track: CENTER + widgets: + - label: + styles: info_or_button_tile_icon + text: ${icon} \ No newline at end of file