diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..df2202e --- /dev/null +++ b/.clang-format @@ -0,0 +1,83 @@ +# Google C/C++ Code Style settings +# https://clang.llvm.org/docs/ClangFormatStyleOptions.html +# Author: Kehan Xue, kehan.xue (at) gmail.com + +Language: Cpp +BasedOnStyle: Google +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: None +AlignOperands: Align +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Empty +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: Never # To avoid conflict, set this "Never" and each "if statement" should include brace when coding +AllowShortLambdasOnASingleLine: Inline +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: true +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterStruct: false + AfterControlStatement: Never + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: false +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +ColumnLimit: 80 +CompactNamespaces: false +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false # Make sure the * or & align on the left +EmptyLineBeforeAccessModifier: LogicalBlock +FixNamespaceComments: true +IncludeBlocks: Preserve +IndentCaseLabels: true +IndentPPDirectives: None +IndentWidth: 2 +KeepEmptyLinesAtTheStartOfBlocks: true +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PointerAlignment: Left +ReflowComments: false +# SeparateDefinitionBlocks: Always # Only support since clang-format 14 +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: c++11 +TabWidth: 4 +UseTab: Never diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 0000000..d11673e --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,57 @@ +name: Build ESPHome + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: '0 */6 * * *' + +jobs: + matrix_maker: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.create_matrix.outputs.matrix }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Create yaml file matrix + id: create_matrix + run: | + # Read the list of YAML files and create a matrix + yaml_files=$(find . -not -name "secrets.yaml" -maxdepth 1 -type f -name "*.yaml" -exec echo {} \; | tr '\n' ' ') + yaml_array="[\"$(echo "$yaml_files" | sed 's/ /", "/g')\"]" + yaml_array=$(echo $yaml_array | sed 's/.....$/]/') + DATA=$(echo $yaml_array | jq -c ) + echo "matrix=$DATA" >> $GITHUB_OUTPUT + - name: Debug output + run: echo "${{ steps.create_matrix.outputs.matrix }}" + build: + needs: matrix_maker + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + name: ${{ fromJSON(needs.matrix_maker.outputs.matrix) }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: CLang Format Lint + uses: DoozyX/clang-format-lint-action@v0.15 + with: + source: '.' + extensions: 'h,cpp' + style: file + exclude: '*/version.h' + clangFormatVersion: 15 + - name: Create secrets file + run: | + echo "d2lmaV9ic3NpZDogIjFDOjg3OjJDOjcwOkMyOkMyIgp3aWZpX3NzaWQ6ICJzc2lkIgp3aWZpX3Bhc3N3b3JkOiAid2lmaXBhc3MiCndpZmlfZmFsbGJhY2tfcGFzc3dvcmQ6ICJ3aWZpZmFsbGJhY2twYXNzIgphcGlfZW5jcnlwdGlvbjogImFwaWVuY3J5cHRpb24iCm90YV9lbmNyeXB0aW9uOiAib3RhZW5jcnlwdGlvbiIK" | base64 --decode > secrets.yaml + - name: Build esphome + uses: esphome/build-action@v1.8.0 + with: + yaml_file: ${{ matrix.name }} diff --git a/clear-homething.yaml b/clear-homething.yaml deleted file mode 100644 index 924cad2..0000000 --- a/clear-homething.yaml +++ /dev/null @@ -1,221 +0,0 @@ -esphome: - name: "clear-homething" - on_boot: - priority: 600.0 - then: - - delay: 45s - - if: - condition: - not: - - wifi.connected: - then: - - switch.turn_on: sleep_toggle - -esp32: - board: featheresp32 - -wifi: - ssid: !secret wifi_ssid - password: !secret wifi_password - fast_connect: true - id: wifi_id - # power_save_mode: HIGH - -external_components: - - source: - # type: git - # url: https://github.com/landonr/homeThing - # ref: main - type: local - path: ../homeThing/components - refresh: 0s - components: [homeThing] - - source: - # type: git - # url: https://github.com/landonr/esphome-components - # ref: main - # refresh: 0s - type: local - path: ../local_components/components - components: [ - homeassistant_component, - homeassistant_media_player, - media_player_source, - media_player_source_sonos, - media_player_source_spotify, - media_player_source_custom - ] - -packages: - device_base: !include ../homeThing/common/device_base.yaml - settings: !include ../homeThing/common/settings.yaml - ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml - ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml - ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml - ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml - ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml - # home_media_player: !include homeConfig/media_player.yaml - home_switch: !include homeConfig/switch.yaml - fonts: !include ../homeThing/common/fonts.yaml - icon_fonts: !include ../homeThing/common/icon_fonts.yaml - -substitutions: - friendly_name: "clear homething" - -color: - - id: my_primary_accent - red_int: 75 - green_int: 45 - blue_int: 209 - -light: - - platform: homeassistant_component - id: light_desk_lamp - entity_id: light.desk_lamp - name: Desk Lamp - - platform: homeassistant_component - id: light_all_lights - entity_id: light.all_lights - name: All Lights - - platform: homeassistant_component - id: light_rgb_lights - entity_id: light.rgb_lights - name: Color Lights - -homeThing: - id: homeThingMenu - settings: - sleep_after: 14400 - display_timeout: 300 - sleep_switch: sleep_toggle - backlight: backlight - battery: - battery_percent: battery_percent - charging: charging - # media_player_group: media_group_component - display: my_display - on_redraw: - then: - component.update: my_display - display_state: - colors: - accent_primary: my_primary_accent - draw_battery_level: true - font_small: small_font - font_medium: medium_font - font_large: large_font - font_large_heavy: large_heavy_font - font_material_large: material_font_large - font_material_small: material_font_small - font_logo: home_thing_logo - home_screen: - name: root - entities: - - id: light_all_lights - type: light - - type: command - name: "desk nudge up" - command: - - homeassistant.service: - service: button.press - data: - entity_id: "button.desk_position_nudge_up" - - type: command - name: "desk nudge down" - command: - - homeassistant.service: - service: button.press - data: - entity_id: "button.desk_position_nudge_down" - screens: - - name: Plants Screen - entities: - - type: cover - id: cover_megadesk - - type: number - id: desk_height_number - - type: command - name: "desk nudge up" - command: - - homeassistant.service: - service: button.press - data: - entity_id: "button.desk_position_nudge_up" - - type: command - name: "desk nudge down" - command: - - homeassistant.service: - service: button.press - data: - entity_id: "button.desk_position_nudge_down" - - id: light_desk_lamp - type: light - - name: Shortcuts - entities: - - id: light_all_lights - type: light - - id: light_rgb_lights - type: light - - type: command - name: "color lights" - command: - - homeassistant.service: - service: script.colors - - type: command - name: "hell lights" - command: - - homeassistant.service: - service: scene.turn_on - data: - entity_id: "scene.hell" - - type: command - name: "lights off" - command: - - homeassistant.service: - service: script.off_script - - name: Settings Screen - show_version: True - entities: - - id: backlight - type: light - - id: "restart_switch" - type: switch - - id: wifi_ssid - type: text_sensor - - id: wifi_signal_percent - type: sensor - - id: wifi_ip - type: text_sensor - -spi: - clk_pin: GPIO18 - mosi_pin: GPIO19 - -number: - - platform: homeassistant_component - entity_id: number.desk_height_cm - name: desk height - id: desk_height_number - min_value: 61.0 - max_value: 105.0 - step: 1 - -display: - - platform: st7789v - model: TTGO_TDisplay_135x240 - id: my_display - cs_pin: GPIO5 - dc_pin: GPIO16 - reset_pin: GPIO23 - rotation: 90 - update_interval: 10s - lambda: |- - id(homeThingMenu)->draw_menu_screen(); - return; - -cover: - - platform: homeassistant_component - entity_id: "cover.megadesk_cover" - name: "Megadesk" - id: cover_megadesk - \ No newline at end of file diff --git a/desk-homething.yaml b/desk-homething.yaml index cb471a0..c7eb9c9 100644 --- a/desk-homething.yaml +++ b/desk-homething.yaml @@ -28,18 +28,18 @@ substitutions: log_level: "WARN" external_components: - # - source: github://landonr/homeThing@lando/now-playing-commands - # refresh: 0s - - source: - type: local - path: ../homeThing/components + - source: github://landonr/homeThing + refresh: 0s + # - source: + # type: local + # path: ../homeThing/components components: [homeThing] - source: - type: local - path: ../local_components/components - # type: git - # url: https://github.com/landonr/esphome-components - # ref: main + # type: local + # path: ../local_components/components + type: git + url: https://github.com/landonr/esphome-components + ref: main refresh: 0s components: [ homeassistant_component, @@ -49,20 +49,49 @@ external_components: media_player_source_spotify, media_player_source_custom ] + - source: github://pr#5214 # used to load images on compile + components: [ image ] + - source: github://pr#5254 # used to load fonts on compile + components: [ font, external_files ] packages: - device_base: !include ../homeThing/common/device_base.yaml + # home_media_player: !include homeConfig/media_player.yaml + # home_switch: !include homeConfig/switch.yaml + + # device_base: !include ../homeThing/common/device_base.yaml # settings: !include ../homeThing/common/settings.yaml - ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml + # ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml # ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ip od_battery.yaml # ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml # ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml - ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml + # ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml # home_media_player: !include homeConfig/media_player.yaml # home_switch: !include homeConfig/switch.yaml - fonts: !include ../homeThing/common/fonts-light.yaml - icon_fonts: !include ../homeThing/common/icon_fonts.yaml - debug: !include ../homeThing/common/debugging.yaml + # fonts: !include ../homeThing/common/fonts-light.yaml + # icon_fonts: !include ../homeThing/common/icon_fonts.yaml + # debug: !include ../homeThing/common/debugging.yaml + remote_package: + url: https://github.com/landonr/homeThing + ref: main + files: [ + common/device_base.yaml, # defines api, ota, free memory and uptime sensor + common/ipod/lilygo_tdisplay_ipod_backlight.yaml, # used for toggling backlight + common/ipod/lilygo_tdisplay_ipod_sleep.yaml, # required for device to sleep + common/fonts.yaml, # default font + common/icon_fonts.yaml, # material icons + # common/ipod/lilygo_tdisplay_ipod_battery.yaml, # used for battery percent + # common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml, # used for button controls + # common/ipod/lilygo_tdisplay_ipod_rotary.yaml, # used for rotary controls + # common/settings.yaml, # settings screen + # common/images.yaml # boot screen image + ] + refresh: 0s + +image: + id: launch_image + file: "https://freight.cargo.site/t/original/i/35740c5dcf360e685ed3f8a27095b923c658ea3435692ecfa6b2036725a90776/desklogo.png" + resize: 168x60 + type: TRANSPARENT_BINARY switch: - platform: restart @@ -129,7 +158,7 @@ homeThing: font_large_heavy: large_font font_material_large: material_font_large font_material_small: material_font_small - font_logo: home_thing_logo + launch_image: launch_image home_screen: name: root entities: diff --git a/eden-remote.yaml b/eden-remote.yaml deleted file mode 100644 index 495e09d..0000000 --- a/eden-remote.yaml +++ /dev/null @@ -1,105 +0,0 @@ -esphome: - name: eden_remote - platform: ESP32 - board: featheresp32 - on_boot: - priority: 600.0 - then: - - delay: 45s - - if: - condition: - not: - - wifi.connected: - then: - - switch.turn_on: sleep_toggle - -wifi: - ssid: !secret wifi_ssid - password: !secret wifi_password - fast_connect: true - id: wifi_id - ap: - ssid: "${friendly_name} Fallback" - password: !secret wifi_fallback_password - -external_components: - - source: - # type: git - # url: https://github.com/landonr/homeThing - # ref: main - # refresh: 0s - type: local - path: ../homeThing/components - components: [homeThing] - - source: - type: git - url: https://github.com/landonr/esphome-components - ref: main - refresh: 0s - # type: local - # path: ../local_components/components - components: [ - homeassistant_component, - homeassistant_media_player, - media_player_source, - media_player_source_sonos, - media_player_source_spotify, - media_player_source_custom - ] - -packages: - device_base: !include ../homeThing/common/device_base.yaml - ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml - ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml - ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml - ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml - ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml - home_media_player: !include homeConfig/media_player.yaml - home_text_sensor: !include homeConfig/text_sensor.yaml - home_light: !include homeConfig/light.yaml - home_switch: !include homeConfig/switch.yaml - fonts: !include ../homeThing/common/fonts.yaml - icon_fonts: !include ../homeThing/common/icon_fonts.yaml - -substitutions: - friendly_name: "Eden's Remote" - -spi: - clk_pin: GPIO18 - mosi_pin: GPIO19 - -homeThing: - id: homeThingMenu - sleep_switch: sleep_toggle - backlight: backlight - battery: - battery_percent: battery_percent - charging: charging - media_player_group: media_group_component - display: my_display - on_redraw: - then: - component.update: my_display - display_state: - draw_battery_level: true - font_small: small_font - font_medium: medium_font - font_large: large_font - font_large_heavy: large_heavy_font - font_material_large: material_font_large - font_material_small: material_font_small - font_logo: home_thing_logo - -display: - - platform: st7789v - model: TTGO_TDisplay_135x240 - id: my_display - cs_pin: GPIO5 - dc_pin: GPIO16 - reset_pin: GPIO23 - rotation: 90 - update_interval: 10s - lambda: |- - id(homeThingMenu)->draw_menu_screen(); - return; - diff --git a/fireremote.yaml b/fireremote.yaml index bf7002e..1b73ca7 100644 --- a/fireremote.yaml +++ b/fireremote.yaml @@ -2,17 +2,19 @@ esphome: name: fireremote platform: ESP32 board: m5stack-fire - on_boot: - priority: 600.0 - then: - - delay: 45s - - if: - condition: - not: - - wifi.connected: - then: - - switch.turn_on: sleep_toggle - + # on_boot: + # priority: 600.0 + # then: + # - delay: 45s + # - if: + # condition: + # not: + # - wifi.connected: + # then: + # - switch.turn_on: sleep_toggle +logger: +api: +ota: wifi: ssid: !secret wifi_ssid password: !secret wifi_password @@ -26,47 +28,72 @@ external_components: - source: type: git url: https://github.com/ssieb/custom_components - components: [ ip5306 ] + # type: local + # path: ../ssieb_custom_components/components + # components: [ ip5306 ] - source: - # type: git - # url: https://github.com/landonr/homeThing - # ref: main - # refresh: 0s - type: local - path: ../homeThing/components + type: git + url: https://github.com/landonr/homeThing + ref: main + refresh: 0s + # type: local + # path: ../homeThing/components components: [homeThing] - source: type: git url: https://github.com/landonr/esphome-components ref: main refresh: 0s - # type: local - # path: ../local_components/components + # # type: local + # # path: ../local_components/components components: [ homeassistant_component, homeassistant_media_player, media_player_source, media_player_source_sonos, media_player_source_spotify, - media_player_source_custom - ] - - source: - type: local - path: ../local_components/components - components: [ + media_player_source_custom, UnitEncoderC ] + # - source: + # type: local + # path: ../local_components/components + # components: [ + # UnitEncoderC + # ] + - source: github://pr#5214 # used to load images on compile + components: [ image ] + - source: github://pr#5254 # used to load fonts on compile + components: [ font, external_files ] packages: - device_base: !include ../homeThing/common/device_base.yaml - home_media_player: !include homeConfig/media_player.yaml - home_text_sensor: !include homeConfig/text_sensor.yaml - home_light: !include homeConfig/light.yaml - home_switch: !include homeConfig/switch.yaml - fonts: !include ../homeThing/common/fonts.yaml - icon_fonts: !include ../homeThing/common/icon_fonts.yaml + home_media_player: !include homeConfig/media_player_light.yaml + # home_text_sensor: !include homeConfig/text_sensor.yaml + # home_light: !include homeConfig/light.yaml + # home_switch: !include homeConfig/switch.yaml + # ip5306: !include ../homeThing/common/m5stack-fire/ip5306.yaml + # device_base: !include ../homeThing/common/device_base.yaml + # fonts: !include ../homeThing/common/fonts.yaml + # icon_fonts: !include ../homeThing/common/icon_fonts.yaml # images: !include ../homeThing/common/images.yaml - settings: !include ../homeThing/common/settings.yaml + # settings: !include ../homeThing/common/settings.yaml + remote_package: + url: https://github.com/landonr/homeThing + ref: main + files: [ + common/device_base.yaml, # defines api, ota, free memory and uptime sensor + common/fonts.yaml, # default font + common/icon_fonts.yaml, # material icons + common/m5stack-fire/ip5306.yaml, # power management and screen backlight + common/m5stack-fire/sleep.yaml, # deep sleep + common/m5stack-fire/binary_sensor.yaml, # buttons + common/m5stack-fire/backlight.yaml, # backlight + common/m5stack-fire/sidelight.yaml, # sidelight + common/UnitEncoderC.yaml, # encoder + common/images.yaml, # boot screen image + common/settings.yaml, # settings screen + ] + refresh: 0s substitutions: friendly_name: "homeThingFireRemote" @@ -78,138 +105,19 @@ substitutions: material_font_large_size: "28" material_font_small_size: "24" -i2c: - - id: bus_a - sda: 21 - scl: 22 - scan: True - - id: bus_b - sda: GPIO0 - scl: GPIO26 - scan: true - -UnitEncoderC: - id: encoder_base - i2c_id: bus_a - button: - name: "${friendly_name} Rotary Button" - id: rotary_button - internal: True - on_press: - then: - - lambda: |- - id(homeThingMenu)->buttonPressSelect(); - encoder: - name: "${friendly_name} Rotary Encoder" - id: rotary - internal: True - encoder_filter: 2 - on_clockwise: - - lambda: |- - id(homeThingMenu)->buttonPressWakeUpDisplay(); - id(homeThingMenu)->rotaryScrollClockwise(id(rotary).state); - on_anticlockwise: - - lambda: |- - id(homeThingMenu)->buttonPressWakeUpDisplay(); - id(homeThingMenu)->rotaryScrollCounterClockwise(id(rotary).state); - -ip5306: - i2c_id: bus_a - battery_level: - name: ${friendly_name} Battery Percent - id: battery_percent - charger_connected: - internal: true - id: connected - charge_full: - id: full - internal: true - -deep_sleep: - id: deep_sleep_ - wakeup_pin: 39 - wakeup_pin_mode: INVERT_WAKEUP - -binary_sensor: - - platform: gpio - id: M5_BtnA - pin: - number: 39 - inverted: true - on_click: - then: - - lambda: |- - id(homeThingMenu)->rotaryScrollCounterClockwise(0); - - platform: gpio - id: M5_BtnB - pin: - number: 38 - inverted: true - on_click: - then: - - lambda: |- - id(homeThingMenu)->buttonPressSelect(); - - platform: gpio - id: M5_BtnC - pin: - number: 37 - inverted: true - on_press: - - voice_assistant.start: - on_release: - - voice_assistant.stop: - # on_click: - # then: - # - lambda: |- - # id(homeThingMenu)->rotaryScrollClockwise(0); - -# We can still control the backlight independently -switch: - - platform: template - name: ${friendly_name} Sleep Toggle - id: sleep_toggle - optimistic: true - on_turn_on: - then: - - deep_sleep.enter: - id: deep_sleep_ - -output: - - platform: ledc - pin: 32 - id: gpio_32_backlight_pwm - -light: - - platform: monochromatic - output: gpio_32_backlight_pwm - name: ${friendly_name} Backlight - id: backlight - restore_mode: ALWAYS_ON - - platform: fastled_clockless - chipset: SK6812 - pin: GPIO15 - num_leds: 10 - rgb_order: GRB - id: side_light - name: ${friendly_name} Remote Light - restore_mode: ALWAYS_OFF - default_transition_length: 0s - effects: - - addressable_rainbow: - name: Rainbow Effect - speed: 20 - width: 15 - -spi: - clk_pin: 18 - mosi_pin: 23 - miso_pin: 19 - -cover: - - platform: homeassistant_component - entity_id: "cover.megadesk_cover" - name: "Megadesk" - id: cover_megadesk +text_sensor: + - platform: homeassistant + entity_id: "sensor.catfeeder_node_servings_today" + name: "Servings today" + id: servings_today + - platform: homeassistant + entity_id: "sensor.catfeeder_node_servings_total" + name: "Servings total" + id: servings_total + - platform: homeassistant + entity_id: "sensor.catfeeder_node_last_feed" + name: "Last feed" + id: last_feed homeThing: id: homeThingMenu @@ -234,7 +142,7 @@ homeThing: font_large_heavy: large_heavy_font font_material_large: material_font_large font_material_small: material_font_small - font_logo: home_thing_logo + launch_image: launch_image header_height: 24 margin_size: 8 slider_margin_size: 6 @@ -246,27 +154,30 @@ homeThing: dark_mode: true draw_volume_level: false draw_header_time: true - screens: - - name: Desk Screen - entities: - - type: cover - id: cover_megadesk + home_screen: + name: root + entities: - type: command - name: "desk nudge up" + name: "feed lil freak" command: - - homeassistant.service: - service: button.press - data: - entity_id: "button.desk_position_nudge_up" - - type: command - name: "desk nudge down" - command: - - homeassistant.service: - service: button.press - data: - entity_id: "button.desk_position_nudge_down" - - id: light_desk_lamp - type: light + - light.turn_on: + id: side_light + brightness: 100% + effect: Rainbow Effect + # - homeassistant.service: + # service: button.press + # data: + # entity_id: "button.catfeeder_node_feed_single" + - delay: 3s + - light.turn_off: + id: side_light + - type: text_sensor + id: servings_today + - type: text_sensor + id: servings_total + - type: text_sensor + id: last_feed + screens: - name: Settings Screen show_version: True entities: @@ -283,6 +194,11 @@ homeThing: - id: wifi_ip type: text_sensor +spi: + clk_pin: 18 + mosi_pin: 23 + miso_pin: 19 + display: - platform: ili9xxx model: M5STACK @@ -290,28 +206,28 @@ display: dc_pin: 27 reset_pin: 33 id: my_display - update_interval: 3600s + update_interval: 3600s lambda: |- id(homeThingMenu)->draw_menu_screen(); return; -i2s_audio: - i2s_lrclk_pin: GPIO15 - # i2s_bclk_pin: GPIO35 - -microphone: - - platform: i2s_audio - id: adc_mic - adc_type: internal - adc_pin: GPIO34 - -speaker: - - platform: i2s_audio - dac_type: internal - i2s_dout_pin: GPIO25 - mode: right - id: speaker_id - -voice_assistant: - microphone: adc_mic - speaker: speaker_id \ No newline at end of file +# i2s_audio: +# i2s_lrclk_pin: GPIO15 +# # i2s_bclk_pin: GPIO35 + +# microphone: +# - platform: i2s_audio +# id: adc_mic +# adc_type: internal +# adc_pin: GPIO34 + +# speaker: +# - platform: i2s_audio +# dac_type: internal +# i2s_dout_pin: GPIO25 +# mode: right +# id: speaker_id + +# voice_assistant: +# microphone: adc_mic +# speaker: speaker_id \ No newline at end of file diff --git a/homeConfig/media_player_mass.yaml b/homeConfig/media_player_mass.yaml new file mode 100644 index 0000000..7618643 --- /dev/null +++ b/homeConfig/media_player_mass.yaml @@ -0,0 +1,52 @@ +media_player_source_sonos: + id: sonos + +media_player_source_spotify: + id: spotty + +media_player_source_custom: + - id: fav_playlists + name: playlists + sources: + name: liked songs + media_id: spotify:user:t5vciyb6zy94uerxdhb0mopfn:collection + media_type: playlist + - id: youtube_videos + name: youtube videos + sources: + - name: fred again boilerroom + media_id: c0-hvjV2A5Y + media_type: app + app: youtube + - name: 100 gecs boilerroom + media_id: 8NWHnWbpxmc + media_type: app + app: youtube + - name: young marco dekmantel 2017 + media_id: 1_vXiL_qD5c + media_type: app + app: youtube + - name: fred again, skrilly, four tet coachella + media_id: dFfC92iBxNw + media_type: app + app: youtube + +media_player: + - platform: homeassistant_media_player + name: Muse + entity_id: "media_player.muse_proto" + id: media_player_muse + type: speaker + sources: + - id: sonos + type: sonos + - id: spotty + type: spotify + - id: fav_playlists + type: custom + +homeassistant_media_player: + id: media_group_component + media_players: + - id: media_player_muse + type: speaker \ No newline at end of file diff --git a/homething-lilygo.yaml b/homething-lilygo.yaml index 2edfc30..a25ab9e 100644 --- a/homething-lilygo.yaml +++ b/homething-lilygo.yaml @@ -24,12 +24,12 @@ wifi: external_components: - source: - # type: git - # url: https://github.com/landonr/homeThing - # ref: main - # refresh: 0s - type: local - path: ../homeThing/components + type: git + url: https://github.com/landonr/homeThing + ref: main + refresh: 0s + # type: local + # path: ../homeThing/components components: [homeThing] - source: type: git @@ -46,20 +46,39 @@ external_components: media_player_source_spotify, media_player_source_custom ] + - source: github://pr#5214 # used to load images on compile + components: [ image ] + - source: github://pr#5254 # used to load fonts on compile + components: [ font, external_files ] packages: - device_base: !include ../homeThing/../homeThing/common/device_base.yaml - ipod_control_backlight: !include ../homeThing/../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml - ipod_control_battery: !include ../homeThing/../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml - ipod_control_binary_sensor: !include ../homeThing/../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml - ipod_control_rotary: !include ../homeThing/../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml - ipod_control_sleep: !include ../homeThing/../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml home_media_player: !include homeConfig/media_player.yaml home_text_sensor: !include homeConfig/text_sensor.yaml home_light: !include homeConfig/light.yaml home_switch: !include homeConfig/switch.yaml - fonts: !include ../homeThing/../homeThing/common/fonts.yaml - icon_fonts: !include ../homeThing/../homeThing/common/icon_fonts.yaml + # device_base: !include ../homeThing/../homeThing/common/device_base.yaml + # ipod_control_backlight: !include ../homeThing/../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml + # ipod_control_battery: !include ../homeThing/../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml + # ipod_control_binary_sensor: !include ../homeThing/../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml + # ipod_control_rotary: !include ../homeThing/../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml + # ipod_control_sleep: !include ../homeThing/../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml + # fonts: !include ../homeThing/../homeThing/common/fonts.yaml + # icon_fonts: !include ../homeThing/../homeThing/common/icon_fonts.yaml + remote_package: + url: https://github.com/landonr/homeThing + ref: main + files: [ + common/device_base.yaml, # defines api, ota, free memory and uptime sensor + common/ipod/lilygo_tdisplay_ipod_backlight.yaml, # used for toggling backlight + common/ipod/lilygo_tdisplay_ipod_battery.yaml, # used for battery percent + common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml, # used for button controls + common/ipod/lilygo_tdisplay_ipod_rotary.yaml, # used for rotary controls + common/ipod/lilygo_tdisplay_ipod_sleep.yaml, # required for device to sleep + common/fonts.yaml, # default font + common/icon_fonts.yaml, # material icons + common/images.yaml # boot screen image + ] + refresh: 0s substitutions: friendly_name: "homeThingClear" diff --git a/lilygos3.yaml b/lilygos3.yaml index ad77768..a45b7b0 100644 --- a/lilygos3.yaml +++ b/lilygos3.yaml @@ -31,21 +31,21 @@ wifi: external_components: - source: - # type: git - # url: https://github.com/landonr/homeThing - # ref: main - type: local - path: ../homething/components - refresh: 0s + type: git + url: https://github.com/landonr/homeThing + ref: main + # type: local + # path: ../homething/components + # refresh: 0s components: [homeThing] - source: - # type: git - # url: https://github.com/landonr/esphome-components - # ref: main - # refresh: 0s - type: local - path: ../local_components/components + type: git + url: https://github.com/landonr/esphome-components + ref: main refresh: 0s + # type: local + # path: ../local_components/components + # refresh: 0s components: [ homeassistant_component, homeassistant_media_player, @@ -56,20 +56,39 @@ external_components: ] - source: github://landonr/lilygo-tdisplays3-esphome components: [tdisplays3] + - source: github://pr#5214 # used to load images on compile + components: [ image ] + - source: github://pr#5254 # used to load fonts on compile + components: [ font, external_files ] packages: - device_base: !include ../homeThing/common/device_base.yaml - settings: !include ../homeThing/common/settings.yaml home_media_player: !include homeConfig/media_player.yaml home_switch: !include homeConfig/switch.yaml - fonts: !include ../homeThing/common/fonts.yaml - icon_fonts: !include ../homeThing/common/icon_fonts.yaml - # images: !include ../homeThing/common/images.yaml - ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml - ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml - ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml - ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml - s3_backlight: !include ../homeThing/common/tdisplay-s3/backlight.yaml + # device_base: !include ../homeThing/common/device_base.yaml + # fonts: !include ../homeThing/common/fonts.yaml + # icon_fonts: !include ../homeThing/common/icon_fonts.yaml + # ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml + # ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml + # ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml + # ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml + # s3_backlight: !include ../homeThing/common/tdisplay-s3/backlight.yaml + # settings: !include ../homeThing/common/settings.yaml + remote_package: + url: https://github.com/landonr/homeThing + ref: main + files: [ + common/device_base.yaml, # defines api, ota, free memory and uptime sensor + common/fonts.yaml, # default font + common/icon_fonts.yaml, # material icons + common/ipod/lilygo_tdisplay_ipod_battery.yaml, # used for battery percent + common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml, # used for button controls + common/ipod/lilygo_tdisplay_ipod_rotary.yaml, # used for rotary controls + common/ipod/lilygo_tdisplay_ipod_sleep.yaml, # required for device to sleep + common/tdisplay-s3/backlight.yaml, # backlight + common/settings.yaml, # settings screen + common/images.yaml # boot screen image + ] + refresh: 0s substitutions: friendly_name: "s3 homething" @@ -144,7 +163,7 @@ homeThing: font_large_heavy: large_heavy_font font_material_large: material_font_large font_material_small: material_font_small - font_logo: home_thing_logo + launch_image: launch_image home_screen: name: root entities: diff --git a/m5stickcplus.yaml b/m5stickcplus.yaml index 7ab35b2..3c1d5e6 100755 --- a/m5stickcplus.yaml +++ b/m5stickcplus.yaml @@ -26,30 +26,31 @@ wifi: password: !secret wifi_fallback_password external_components: + # - source: + # type: git + # url: https://github.com/esphome/esphome + # ref: dev + # components: [adc, i2s_audio, microphone] - source: type: git - url: https://github.com/esphome/esphome - ref: dev - components: [adc, i2s_audio, microphone] + url: https://github.com/landonr/esphome-axp192 + ref: lando/add-charging-indicator + # type: local + # path: ../axp192/components - source: type: git - url: https://gitlab.com/geiseri/esphome_extras.git - refresh: 0s - components: [axp192] - - source: - # type: git - # url: https://github.com/landonr/homeThing - # ref: main - type: local - path: ../homeThing/components + url: https://github.com/landonr/homeThing + ref: main + # type: local + # path: ../homeThing/components refresh: 0s components: [homeThing] - source: - # type: git - # url: https://github.com/landonr/esphome-components - # ref: main - type: local - path: ../local_components/components + type: git + url: https://github.com/landonr/esphome-components + ref: main + # type: local + # path: ../local_components/components refresh: 0s components: [ homeassistant_component, @@ -60,24 +61,42 @@ external_components: media_player_source_custom, MiniEncoderC ] + - source: github://pr#5214 # used to load images on compile + components: [ image ] + - source: github://pr#5254 # used to load fonts on compile + components: [ font, external_files ] packages: - device_base: !include ../homeThing/common/device_base.yaml + remote_package: + url: https://github.com/landonr/homeThing + ref: main + files: [ + common/device_base.yaml, # defines api, ota, free memory and uptime sensor + common/fonts.yaml, # default font + common/icon_fonts.yaml, # material icons + common/m5stack-stickc/axp192-marty.yaml, # power management and screen backlight + common/m5stack-stickc/sleep.yaml, # deep sleep + common/m5stack-stickc/binary_sensor.yaml, # buttons + common/m5stack-stickc/MiniEncoderC.yaml, # rotary encoder and built in led + common/images.yaml # boot screen image + ] + refresh: 0s home_media_player: !include homeConfig/media_player_light.yaml home_text_sensor: !include homeConfig/text_sensor.yaml home_light: !include homeConfig/light.yaml home_switch: !include homeConfig/switch.yaml - fonts: !include ../homeThing/common/fonts.yaml - icon_fonts: !include ../homeThing/common/icon_fonts.yaml - # images: !include ../homeThing/common/images.yaml - axp192: !include ../homeThing/common/m5stack-stickc/axp192.yaml # power management and screen backlight - sleep: !include ../homeThing/common/m5stack-stickc/sleep.yaml # deep sleep - binary_sensor: !include ../homeThing/common/m5stack-stickc/binary_sensor.yaml # buttons - mini_encoder_c: !include ../homeThing/common/m5stack-stickc/MiniEncoderC.yaml # rotary encoder and built in led + # device_base: !include ../homeThing/common/device_base.yaml + # fonts: !include ../homeThing/common/fonts.yaml + # icon_fonts: !include ../homeThing/common/icon_fonts.yaml + # axp192: !include ../homeThing/common/m5stack-stickc/axp192.yaml # power management and screen backlight + # sleep: !include ../homeThing/common/m5stack-stickc/sleep.yaml # deep sleep + # binary_sensor: !include ../homeThing/common/m5stack-stickc/binary_sensor.yaml # buttons + # mini_encoder_c: !include ../homeThing/common/m5stack-stickc/MiniEncoderC.yaml # rotary encoder and built in led substitutions: friendly_name: "homeThingM5StickPlus" + # log_level: DEBUG spi: clk_pin: GPIO13 @@ -104,7 +123,7 @@ homeThing: font_large_heavy: large_heavy_font font_material_large: material_font_large font_material_small: material_font_small - font_logo: home_thing_logo + launch_image: launch_image draw_now_playing_bottom_menu: True display: diff --git a/m5stickcplusTest.yaml b/m5stickcplusTest.yaml new file mode 100644 index 0000000..c0ae33a --- /dev/null +++ b/m5stickcplusTest.yaml @@ -0,0 +1,142 @@ +esphome: + name: m5stickcplus + +esp32: + board: m5stick-c + framework: + type: arduino + +ota: + +api: + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + fast_connect: true + id: wifi_id + ap: + ssid: "${friendly_name} Fallback" + password: !secret wifi_fallback_password + +external_components: + - source: github://pr#5214 # used to load images on compile + components: [ image ] + refresh: 0s + - source: github://pr#5254 # used to load images on compile + refresh: 0s + components: [ font, external_files ] + # - source: + # type: git + # url: https://github.com/esphome/esphome + # ref: dev + # components: [adc, i2s_audio, microphone] + # - source: + # type: git + # url: https://gitlab.com/geiseri/esphome_extras.git + # refresh: 0s + # components: [axp192] + # - source: github://paulchilton/esphome-axp192 + # components: [axp192] + # refresh: 0s + - source: + type: git + url: https://github.com/landonr/esphome-axp192 + ref: lando/add-charging-indicator + # type: local + # path: ../axp192/components + - source: + type: git + url: https://github.com/landonr/homeThing + ref: main + # type: local + # path: ../homeThing/components + refresh: 0s + components: [homeThing] + - source: + type: git + url: https://github.com/landonr/esphome-components + ref: main + # type: local + # path: ../local_components/components + refresh: 0s + components: [ + homeassistant_component, + homeassistant_media_player, + media_player_source, + media_player_source_sonos, + media_player_source_spotify, + media_player_source_custom, + MiniEncoderC + ] + +logger: + level: DEBUG + +packages: + remote_package: + url: https://github.com/landonr/homeThing + ref: main + files: [ + common/fonts.yaml, # default font + common/icon_fonts.yaml, # material icons + common/m5stack-stickc/axp192-marty.yaml, # power management and screen backlight + # common/m5stack-stickc/binary_sensor.yaml, # buttons + # common/m5stack-stickc/MiniEncoderC.yaml, # rotary encoder and built in led + ] + refresh: 0s + # fonts: !include ../homeThing/common/fonts.yaml + # icon_fonts: !include ../homeThing/common/icon_fonts.yaml + # images: !include ../homeThing/common/images.yaml + # axp192: !include ../homeThing/common/m5stack-stickc/axp192-marty.yaml # power management and screen backlight + # binary_sensor: !include ../homeThing/common/m5stack-stickc/binary_sensor.yaml # buttons + # mini_encoder_c: !include ../homeThing/common/m5stack-stickc/MiniEncoderC.yaml # rotary encoder and built in led + +substitutions: + friendly_name: "homeThingM5StickPlus" + +binary_sensor: + - platform: gpio + pin: + number: GPIO37 + inverted: true + name: Button A + +spi: + clk_pin: GPIO13 + mosi_pin: GPIO15 + +display: + - platform: st7789v + model: TTGO_TDisplay_135x240 + id: my_display + cs_pin: GPIO5 + dc_pin: GPIO23 + reset_pin: GPIO18 + rotation: 270 + update_interval: 1s + lambda: |- + if (id(axp_charger).state) { + it.rectangle(10, 10, 108, 44, Color(0, 255, 0)); + it.printf(60, 25, id(small_font), "Charging"); + } else { + it.rectangle(10, 10, 108, 44, Color(255, 0, 0)); + it.printf(60, 25, id(small_font), "Not Charging"); + } + it.printf(20, 50, id(small_font), "Battery: %f", id(batteryPercent).state); + return; + +# Individual outputs +switch: + # - platform: gpio + # name: "PCF8574 Pin #0" + # id: ledpin + # pin: + # pcf8574: pcf8574_hub + # number: 3 + # mode: + # output: true + # inverted: True + - platform: restart + id: restart_switch + name: "${friendly_name} Restart" \ No newline at end of file diff --git a/megadesk.h b/megadesk.h index c16ac43..f633324 100644 --- a/megadesk.h +++ b/megadesk.h @@ -2,18 +2,17 @@ class Megadesk : public Component, public Sensor, public UARTDevice { public: - Megadesk(UARTComponent *parent) : UARTDevice(parent) {} + Megadesk(UARTComponent* parent) : UARTDevice(parent) {} - Sensor *raw_height = new Sensor(); - Sensor *min_height = new Sensor(); - Sensor *max_height = new Sensor(); + Sensor* raw_height = new Sensor(); + Sensor* min_height = new Sensor(); + Sensor* max_height = new Sensor(); void setup() override {} - int digits=0; + int digits = 0; - int readdigits() - { + int readdigits() { int r; while ((r = read()) > 0) { if ((r < 0x30) || (r > 0x39)) { @@ -21,26 +20,24 @@ class Megadesk : public Component, public Sensor, public UARTDevice { return digits; } // it's a digit, add with base10 shift - digits = 10*digits + (r-0x30); + digits = 10 * digits + (r - 0x30); // keep reading... } return -1; } - void recvData() - { + void recvData() { const int numChars = 2; - const int numFields = 4; // read/store all 4 fields for simplicity, use only the last 3. + const int numFields = + 4; // read/store all 4 fields for simplicity, use only the last 3. // static variables allows segmented/char-at-a-time decodes static uint16_t receivedBytes[numFields]; static uint8_t ndx = 0; - int r; // read char/digit + int r; // read char/digit // read 2 chars - while ((ndx < numChars) && ((r = read()) != -1)) - { - if ((ndx == 0) && (r != '>')) - { + while ((ndx < numChars) && ((r = read()) != -1)) { + if ((ndx == 0) && (r != '>')) { // first char is not Tx, keep reading... continue; } @@ -50,27 +47,23 @@ class Megadesk : public Component, public Sensor, public UARTDevice { // read ascii digits while ((ndx >= numChars) && ((r = readdigits()) != -1)) { receivedBytes[ndx] = r; - digits = 0; // clear + digits = 0; // clear if (++ndx == numFields) { // thats all 4 fields. parse/process them now and break-out. - parseData(receivedBytes[1], - receivedBytes[2], - receivedBytes[3]); + parseData(receivedBytes[1], receivedBytes[2], receivedBytes[3]); ndx = 0; return; } } } - void parseData(byte command, uint16_t position, uint8_t push_addr) - { - if (command == '=') - { + void parseData(byte command, uint16_t position, uint8_t push_addr) { + if (command == '=') { raw_height->publish_state(position); - } else if (command == 'R'){ - if (push_addr == 11){ + } else if (command == 'R') { + if (push_addr == 11) { min_height->publish_state(position); - } else if (push_addr == 12){ + } else if (push_addr == 12) { max_height->publish_state(position); } } diff --git a/online-font-test.yaml b/online-font-test.yaml new file mode 100644 index 0000000..c39252e --- /dev/null +++ b/online-font-test.yaml @@ -0,0 +1,97 @@ +esphome: + name: "online-font-test" + +esp32: + board: featheresp32 + +logger: + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + fast_connect: true + id: wifi_id + power_save_mode: HIGH + + +packages: + # ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml + remote_package: + url: https://github.com/landonr/homeThing + ref: main + files: [ + common/ipod/lilygo_tdisplay_ipod_backlight.yaml, # used for toggling backlight + ] + + +external_components: + - source: github://pr#5214 # used to load images on compile + components: [ image ] + refresh: 0s + - source: github://pr#5254 # used to load fonts on compile + components: [ font, external_files ] + refresh: 0s + # - source: + # type: git + # url: https://github.com/landonr/esphome-components + # ref: main + # refresh: 0s + # type: local + # path: ../compile-online-image/esphome/components + # components: [ + # font, + # external_files + # ] + +font: + - file: + url: "https://github.com/landonr/homeThing/raw/main/fonts/iosevka.ttf" + # refresh: 10s + type: web + id: web_font + size: 24 + glyphs: '^…*/|\$#<>!?"%()[]+=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz&êÊîÎâÂôÔéÉíÍáÁóÓčëËüÜïÏöÖøØṣṢñãõÑÃÕ''’' + + - file: + url: "https://github.com/landonr/homeThing/raw/main/fonts/iosevka.ttf" + # refresh: 10s + type: web + id: web_font_medium + size: 20 + glyphs: '^…*/|\$#<>!?"%()[]+=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz&êÊîÎâÂôÔéÉíÍáÁóÓčëËüÜïÏöÖøØṣṢñãõÑÃÕ''’' + + - file: "fonts/iosevka.ttf" + id: local_font + size: 16 + glyphs: '^…*/|\$#<>!?"%()[]+=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz&êÊîÎâÂôÔéÉíÍáÁóÓčëËüÜïÏöÖøØṣṢñãõÑÃÕ''’' + - file: "https://github.com/landonr/homeThing/raw/main/fonts/materialdesignicons-webfont.ttf" + id: material_font_large + size: 20 + glyphs: [ + '󰐊', # mdi-play + ] + # - file: "gfonts://Roboto" + # id: roboto + # size: 20 + + +spi: + clk_pin: GPIO18 + mosi_pin: GPIO19 + +display: + - platform: st7789v + model: TTGO_TDisplay_135x240 + id: my_display + cs_pin: GPIO5 + dc_pin: GPIO16 + reset_pin: GPIO23 + rotation: 90 + update_interval: 10s + lambda: |- + it.print(0, 0, id(web_font), "web font"); + it.print(0, 25, id(web_font_medium), "web font medium"); + it.print(0, 50, id(local_font), "local font"); + it.print(0, 75, id(material_font_large), "󰐊"); + // it.print(0, 100, id(roboto), "gfont"); + return; \ No newline at end of file diff --git a/proto.yaml b/proto.yaml index 76cdccf..573721e 100644 --- a/proto.yaml +++ b/proto.yaml @@ -26,20 +26,20 @@ wifi: external_components: - source: - # type: git - # url: https://github.com/landonr/homeThing - # ref: main - # refresh: 0s - type: local - path: ../homeThing/components + type: git + url: https://github.com/landonr/homeThing + ref: main + refresh: 0s + # type: local + # path: ../homeThing/components components: [homeThing] - source: - # type: git - # url: https://github.com/landonr/esphome-components - # ref: main - # refresh: 0s - type: local - path: ../local_components/components + type: git + url: https://github.com/landonr/esphome-components + ref: main + refresh: 0s + # type: local + # path: ../local_components/components components: [ homeassistant_component, homeassistant_media_player, @@ -48,22 +48,42 @@ external_components: media_player_source_spotify, media_player_source_custom ] + - source: github://pr#5214 # used to load images on compile + components: [ image ] + - source: github://pr#5254 # used to load fonts on compile + components: [ font, external_files ] packages: - device_base: !include ../homeThing/common/device_base.yaml - ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml - ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml - ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml - ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml - ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml + # device_base: !include ../homeThing/common/device_base.yaml + # ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml + # ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml + # ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml + # ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml + # ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml + # fonts: !include ../homeThing/common/fonts.yaml + # icon_fonts: !include ../homeThing/common/icon_fonts.yaml + # settings: !include ../homeThing/common/settings.yaml + # images: !include ../homeThing/common/images.yaml home_media_player: !include homeConfig/media_player.yaml home_text_sensor: !include homeConfig/text_sensor.yaml home_light: !include homeConfig/light.yaml home_switch: !include homeConfig/switch.yaml - fonts: !include ../homeThing/common/fonts.yaml - icon_fonts: !include ../homeThing/common/icon_fonts.yaml - images: !include ../homeThing/common/images.yaml - settings: !include ../homeThing/common/settings.yaml + remote_package: + url: https://github.com/landonr/homeThing + ref: main + files: [ + common/device_base.yaml, # defines api, ota, free memory and uptime sensor + common/ipod/lilygo_tdisplay_ipod_backlight.yaml, # used for toggling backlight + common/ipod/lilygo_tdisplay_ipod_battery.yaml, # used for battery percent + common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml, # used for button controls + common/ipod/lilygo_tdisplay_ipod_rotary.yaml, # used for rotary controls + common/ipod/lilygo_tdisplay_ipod_sleep.yaml, # required for device to sleep + common/fonts.yaml, # default font + common/icon_fonts.yaml, # material icons + common/settings.yaml, # settings screen + common/images.yaml # boot screen image + ] + refresh: 0s substitutions: friendly_name: "homeThing proto" diff --git a/tdisplayremote.yaml b/tdisplayremote.yaml index 8b35314..773a368 100644 --- a/tdisplayremote.yaml +++ b/tdisplayremote.yaml @@ -24,12 +24,12 @@ wifi: external_components: - source: - # type: git - # url: https://github.com/landonr/homeThing - # ref: main - # refresh: 0s - type: local - path: components + type: git + url: https://github.com/landonr/homeThing + ref: main + refresh: 0s + # type: local + # path: components components: [homeThing] - source: type: git @@ -46,23 +46,42 @@ external_components: media_player_source_spotify, media_player_source_custom ] + - source: github://pr#5214 # used to load images on compile + components: [ image ] + - source: github://pr#5254 # used to load fonts on compile + components: [ font, external_files ] packages: - device_base: !include ../homeThing/common/device_base.yaml - ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml - ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml - ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml - ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml - ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml + # device_base: !include ../homeThing/common/device_base.yaml + # ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml + # ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml + # ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml + # ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml + # ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml + # fonts: !include ../homeThing/common/fonts.yaml + # icon_fonts: !include ../homeThing/common/icon_fonts.yaml home_media_player: !include homeConfig/media_player.yaml home_text_sensor: !include homeConfig/text_sensor.yaml home_light: !include homeConfig/light.yaml home_switch: !include homeConfig/switch.yaml - fonts: !include ../homeThing/common/fonts.yaml - icon_fonts: !include ../homeThing/common/icon_fonts.yaml - + remote_package: + url: https://github.com/landonr/homeThing + ref: main + files: [ + common/device_base.yaml, # defines api, ota, free memory and uptime sensor + common/ipod/lilygo_tdisplay_ipod_backlight.yaml, # used for toggling backlight + common/ipod/lilygo_tdisplay_ipod_battery.yaml, # used for battery percent + common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml, # used for button controls + common/ipod/lilygo_tdisplay_ipod_rotary.yaml, # used for rotary controls + common/ipod/lilygo_tdisplay_ipod_sleep.yaml, # required for device to sleep + common/fonts.yaml, # default font + common/icon_fonts.yaml, # material icons + common/images.yaml # boot screen image + # common/settings.yaml, # settings screen + ] + refresh: 0s substitutions: - friendly_name: "homeThingClear" + friendly_name: "homeThing clear" spi: clk_pin: GPIO18 diff --git a/tdisplayremoteir.yaml b/tdisplayremoteir.yaml deleted file mode 100644 index b0a8347..0000000 --- a/tdisplayremoteir.yaml +++ /dev/null @@ -1,110 +0,0 @@ -esphome: - name: lilygo_display_ir - platform: ESP32 - board: featheresp32 - # on_boot: - # priority: 600.0 - # then: - # - delay: 45s - # - if: - # condition: - # not: - # - wifi.connected: - # then: - # - switch.turn_on: sleep_toggle - -wifi: - ssid: !secret wifi_ssid - password: !secret wifi_password - fast_connect: true - id: wifi_id - ap: - ssid: "${friendly_name} Fallback" - password: !secret wifi_fallback_password - -logger: - level: DEBUG -# external_components: -# - source: -# # type: git -# # url: https://github.com/landonr/homeThing -# # ref: main -# # refresh: 0s -# type: local -# path: components -# components: [homeThing] -# - source: -# type: git -# url: https://github.com/landonr/esphome-components -# ref: main -# refresh: 0s -# # type: local -# # path: ../local_components/components -# components: [ -# homeassistant_component, -# homeassistant_media_player, -# media_player_source, -# media_player_source_sonos, -# media_player_source_spotify, -# media_player_source_custom -# ] - -# packages: -# device_base: !include ../homeThing/common/device_base.yaml -# ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml -# ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml -# ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml -# ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml -# ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml -# home_media_player: !include homeConfig/media_player.yaml -# home_text_sensor: !include homeConfig/text_sensor.yaml -# home_light: !include homeConfig/light.yaml -# home_switch: !include homeConfig/switch.yaml -# fonts: !include ../homeThing/common/fonts.yaml -# icon_fonts: !include ../homeThing/common/icon_fonts.yaml - -# substitutions: -# friendly_name: "homeThingClear" - -# spi: -# clk_pin: GPIO18 -# mosi_pin: GPIO19 - -# homeThing: -# id: homeThingMenu -# sleep_switch: sleep_toggle -# backlight: backlight -# battery: -# battery_percent: battery_percent -# charging: charging -# media_player_group: media_group_component -# display: my_display -# on_redraw: -# then: -# component.update: my_display -# display_state: -# draw_battery_level: true -# font_small: small_font -# font_medium: medium_font -# font_large: large_font -# font_large_heavy: large_heavy_font -# font_material_large: material_font_large -# font_material_small: material_font_small -# launch_image: launch_image - -# display: -# - platform: st7789v -# model: TTGO_TDisplay_135x240 -# id: my_display -# cs_pin: GPIO5 -# dc_pin: GPIO16 -# reset_pin: GPIO23 -# rotation: 90 -# update_interval: 10s -# lambda: |- -# id(homeThingMenu)->draw_menu_screen(); -# return; - -remote_receiver: - pin: GPIO27 - dump: all \ No newline at end of file diff --git a/tdisplayt4.yaml b/tdisplayt4.yaml index e73bd41..7674c0d 100644 --- a/tdisplayt4.yaml +++ b/tdisplayt4.yaml @@ -17,12 +17,12 @@ wifi: external_components: - source: - # type: git - # url: https://github.com/landonr/homeThing - # ref: main - # refresh: 0s - type: local - path: components + type: git + url: https://github.com/landonr/homeThing + ref: main + refresh: 0s + # type: local + # path: ../homeThing/components components: [homeThing] - source: type: git @@ -39,15 +39,30 @@ external_components: media_player_source_spotify, media_player_source_custom ] + - source: github://pr#5214 # used to load images on compile + components: [ image ] + - source: github://pr#5254 # used to load fonts on compile + components: [ font, external_files ] packages: - device_base: !include ../homeThing/common/device_base.yaml + remote_package: + url: https://github.com/landonr/homeThing + ref: main + files: [ + common/device_base.yaml, # defines api, ota, free memory and uptime sensor + common/fonts.yaml, # default font + common/icon_fonts.yaml, # material icons + common/images.yaml, # material icons + ] + refresh: 0s home_media_player: !include homeConfig/media_player.yaml home_text_sensor: !include homeConfig/text_sensor.yaml home_light: !include homeConfig/light.yaml home_switch: !include homeConfig/switch.yaml - fonts: !include ../homeThing/common/fonts.yaml - icon_fonts: !include ../homeThing/common/icon_fonts.yaml + # device_base: !include ../homeThing/common/device_base.yaml + # fonts: !include ../homeThing/common/fonts.yaml + # icon_fonts: !include ../homeThing/common/icon_fonts.yaml + # images: !include ../homeThing/common/images.yaml substitutions: friendly_name: "tdisplayT4" diff --git a/white-homething.yaml b/white-homething.yaml index 65eb10a..8de805a 100644 --- a/white-homething.yaml +++ b/white-homething.yaml @@ -23,20 +23,20 @@ wifi: external_components: - source: - # type: git - # url: https://github.com/landonr/homeThing - # ref: main - type: local - path: ../homething/components + type: git + url: https://github.com/landonr/homeThing + ref: main + # type: local + # path: ../homething/components refresh: 0s components: [homeThing] - source: - # type: git - # url: https://github.com/landonr/esphome-components - # ref: main - # refresh: 0s - type: local - path: ../local_components/components + type: git + url: https://github.com/landonr/esphome-components + ref: main + refresh: 0s + # type: local + # path: ../local_components/components components: [ homeassistant_component, homeassistant_media_player, @@ -45,21 +45,42 @@ external_components: media_player_source_spotify, media_player_source_custom ] + - source: github://pr#5214 # used to load images on compile + components: [ image ] + - source: github://pr#5254 # used to load fonts on compile + components: [ font, external_files ] packages: - device_base: !include ../homeThing/common/device_base.yaml - settings: !include ../homeThing/common/settings.yaml - ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml - ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml - ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml - ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml - ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml home_media_player: !include homeConfig/media_player_light.yaml home_switch: !include homeConfig/switch.yaml - fonts: !include ../homeThing/common/fonts-light.yaml - icon_fonts: !include ../homeThing/common/icon_fonts.yaml - images: !include ../homeThing/common/images.yaml - debug: !include ../homeThing/common/debugging.yaml + # device_base: !include ../homeThing/common/device_base.yaml + # ipod_control_backlight: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_backlight.yaml + # ipod_control_battery: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_battery.yaml + # ipod_control_binary_sensor: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml + # ipod_control_rotary: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_rotary.yaml + # ipod_control_sleep: !include ../homeThing/common/ipod/lilygo_tdisplay_ipod_sleep.yaml + # fonts: !include ../homeThing/common/fonts-light.yaml + # icon_fonts: !include ../homeThing/common/icon_fonts.yaml + # settings: !include ../homeThing/common/settings.yaml + # images: !include ../homeThing/common/images.yaml + # debug: !include ../homeThing/common/debugging.yaml + remote_package: + url: https://github.com/landonr/homeThing + ref: main + files: [ + common/device_base.yaml, # defines api, ota, free memory and uptime sensor + common/ipod/lilygo_tdisplay_ipod_backlight.yaml, # used for toggling backlight + common/ipod/lilygo_tdisplay_ipod_battery.yaml, # used for battery percent + common/ipod/lilygo_tdisplay_ipod_binary_sensor.yaml, # used for button controls + common/ipod/lilygo_tdisplay_ipod_rotary.yaml, # used for rotary controls + common/ipod/lilygo_tdisplay_ipod_sleep.yaml, # required for device to sleep + common/fonts.yaml, # default font + common/icon_fonts.yaml, # material icons + common/settings.yaml, # settings screen + common/images.yaml, # boot screen image + common/debugging.yaml # debug + ] + refresh: 0s substitutions: friendly_name: "white homething"