diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8af1d28..f2c706e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,10 +15,10 @@ jobs: strategy: matrix: firmware: - - file: copy2esphome/ulanzi-easy.yaml + - file: tests/ulanzi-easy.yaml name: Ulanzi-Easy manifest_filename: ulanzi-easy-manifest.json - - file: copy2esphome/ehtmxv2-template.yaml + - file: tests/ehtmxv2-template.yaml name: EHMTX template manifest_filename: ehtmxv2-template-manifest.json fail-fast: false diff --git a/tests/EHMTXv2.ttf b/tests/EHMTXv2.ttf new file mode 100644 index 0000000..0709311 Binary files /dev/null and b/tests/EHMTXv2.ttf differ diff --git a/copy2esphome/ehtmxv2-template.yaml b/tests/ehtmxv2-template.yaml similarity index 82% rename from copy2esphome/ehtmxv2-template.yaml rename to tests/ehtmxv2-template.yaml index 9ba87bb..d72632a 100644 --- a/copy2esphome/ehtmxv2-template.yaml +++ b/tests/ehtmxv2-template.yaml @@ -6,14 +6,12 @@ substitutions: external_components: - source: - type: git - url: https://github.com/lubeda/EspHoMaTriXv2 - ref: release - refresh: 60s + type: local + path: EspHoMaTriXv2/components # e.g. /config/esphome/components components: [ ehmtxv2 ] esphome: - comment: "EHMTXv2 from LuBeDa" + comment: "EHMTXv2 TEXT from LuBeDa" name: $devicename esp32: @@ -52,7 +50,7 @@ light: type: GRB internal: true variant: WS2812 - pin: $ledpin + pin: $matrix_pin num_leds: 256 color_correct: [30%, 30%, 30%] gamma_correct: 2.0 @@ -94,17 +92,5 @@ ehmtxv2: icons: - id: error lameid: 40530 - - id: home_assistant - lameid: 47693 - - id: temperature - lameid: 2056 - - id: lightbulb - lameid: 1762 - - id: music - lameid: 45625 - - id: phone - lameid: 1232 - - id: car - lameid: 2819 - id: sleep8x32 url: https://user-images.githubusercontent.com/16407309/224850723-634c9b2d-55d9-44f2-9f93-765c0485b090.gif diff --git a/copy2esphome/secrets.yaml b/tests/secrets.yaml similarity index 100% rename from copy2esphome/secrets.yaml rename to tests/secrets.yaml diff --git a/tests/ulanzi-easy.yaml b/tests/ulanzi-easy.yaml new file mode 100644 index 0000000..1a2a49f --- /dev/null +++ b/tests/ulanzi-easy.yaml @@ -0,0 +1,257 @@ +substitutions: + devicename: ulanzi + ledpin: GPIO32 + buzzerpin: GPIO15 + friendly_name: LED Matrix + board: esp32dev + # Pin definition from https://github.com/aptonline/PixelIt_Ulanzi + battery_pin: GPIO34 + ldr_pin: GPIO35 + matrix_pin: GPIO32 + left_button_pin: GPIO26 + mid_button_pin: GPIO27 + right_button_pin: GPIO14 + buzzer_pin: GPIO15 + scl_pin: GPIO22 + sda_pin: GPIO21 + +switch: + - platform: template + name: "Auto-Adjust Brightness" + id: switch_autobrightness + icon: mdi:brightness-auto + restore_mode: RESTORE_DEFAULT_ON + lambda: |- + if (id(aab_enable)) { + return true; + } else { + return false; + } + turn_on_action: + lambda: |- + id(aab_enable) = true; + turn_off_action: + lambda: |- + id(aab_enable) = false; + +globals: + # aab = auto-adjustable brightness + - id: aab_enable + type: "bool" + restore_value: true + initial_value: "true" + - id: aab_add + type: int + initial_value: '10' + - id: aab_max + type: int + initial_value: '220' + - id: aab_min + type: int + initial_value: '20' + +external_components: + - source: + type: git + url: https://github.com/lubeda/EspHoMaTriXv2 + ref: main + refresh: 60s + components: [ ehmtxv2 ] + +esphome: + comment: "EHMTXv2 from LuBeDa" + name: $devicename + on_boot: + then: + - ds1307.read_time: + +esp32: + board: esp32dev + +font: + - file: EHMTXv2.ttf + size: 16 + id: default_font + glyphs: | + !?"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnÖÄÜöäüopqrstuvwxyz@<>ß§€/ + +binary_sensor: + - platform: status + name: "$devicename Status" + - platform: gpio + pin: + number: $left_button_pin + inverted: true + name: "Left button" + - platform: gpio + pin: + inverted: true + number: $mid_button_pin + mode: INPUT_PULLUP + name: "Middle button" + - platform: gpio + pin: + number: $right_button_pin + inverted: true + name: "Right button" + +logger: + level: WARN + +api: + services: + - service: tune + variables: + tune: string + then: + - rtttl.play: + rtttl: !lambda 'return tune;' + +sensor: + - platform: sht3xd + temperature: + name: "$devicename Temperature" + humidity: + name: "$devicename Relative Humidity" + update_interval: 60s + - platform: adc + pin: $battery_pin + name: "$devicename Battery" + id: battery_voltage + update_interval: 10s + device_class: battery + accuracy_decimals: 0 + attenuation: auto + filters: + - sliding_window_moving_average: + window_size: 15 + send_every: 15 + send_first_at: 1 + - multiply: 1.6 + - lambda: |- + auto r = ((x - 3) / 0.69 * 100.00); + if (r >= 100) return 100; + if (r > 0) return r; + if (r <= 0) return 1; + return 0; + unit_of_measurement: '%' + - platform: adc + id: light_sensor + name: "$devicename Illuminance" + pin: $ldr_pin + update_interval: 10s + attenuation: auto + unit_of_measurement: lx + device_class: illuminance + accuracy_decimals: 0 + filters: + - lambda: |- + return (x / 10000.0) * 2000000.0 - 15 ; + on_value: + then: + - lambda: |- + if ( id(aab_enable) ) { + int n = x / 4 + id(aab_add); // new_value + if (n > id(aab_max)) n = id(aab_max); + if (n < id(aab_min)) n = id(aab_min); + int c = id(rgb8x32)->get_brightness(); // current value + int d = (n - c) * 100 / c; // diff in % + if ( abs(d) > 2 ) id(rgb8x32)->set_brightness(n); + } + +ota: + password: !secret ota_password + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + +web_server: + +output: + - platform: ledc + pin: $buzzerpin + id: rtttl_out + +rtttl: + output: rtttl_out + +i2c: + sda: $sda_pin + scl: $scl_pin + scan: true + id: i2cbus + +light: + - platform: neopixelbus + id: ehmtx_light + type: GRB + internal: true + variant: WS2812 + pin: $ledpin + num_leds: 256 + color_correct: [30%, 30%, 30%] + gamma_correct: 2.0 + name: "$devicename Light" + restore_mode: ALWAYS_OFF + +time: + - platform: homeassistant + on_time_sync: + then: + ds1307.write_time: + - platform: ds1307 + update_interval: never + id: ehmtx_time + +display: + - platform: addressable_light + id: ehmtx_display + addressable_light_id: ehmtx_light + width: 32 + height: 8 + pixel_mapper: |- + if (y % 2 == 0) { + return (y * 32) + x; + } + return (y * 32) + (31 - x); + rotation: 0° + update_interval: 16ms + auto_clear_enabled: true + lambda: |- + id(rgb8x32)->tick(); + id(rgb8x32)->draw(); + +ehmtxv2: + id: rgb8x32 + icons2html: true + matrix_component: ehmtx_display + time_component: ehmtx_time + time_format: "%H:%M" + date_format: "%d.%m." + show_seconds: false + default_font_id: default_font + special_font_id: default_font + icons: + - id: error + lameid: 40530 + - id: home_assistant + lameid: 47693 + - id: temperature + lameid: 2056 + - id: lightbulb + lameid: 1762 + - id: music + lameid: 45625 + - id: phone + lameid: 1232 + - id: car + lameid: 2819 + - id: sleep8x32 + url: https://user-images.githubusercontent.com/16407309/224850723-634c9b2d-55d9-44f2-9f93-765c0485b090.gif + on_next_screen: + - homeassistant.event: + event: esphome.new_screen + data_template: + iconname: !lambda "return icon.c_str();" + text: !lambda "return text.c_str();"