Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "Ulanzi-Tram Fallback Hotspot"
- password: "ulanzi903"
- captive_portal:
- esphome:
- name: ${device}
- project:
- name: "Ulanzi.EHMTXv2"
- # version: "2024.1.0"
- version: latest
- on_boot:
- then:
- - ds1307.read_time:
- esp32:
- board: esp32dev
- framework:
- advanced:
- ignore_efuse_custom_mac: true
- # Enable Home Assistant API
- api:
- encryption:
- key: "w4+UWbnnRlJg4XIVr372b7jlYgwWrwc4ZmggXCwTc+c="
- reboot_timeout: ${reboot_timeout}
- ota:
- - platform: esphome
- password: "d92b7b427db7a24b3e387e0be7cb2464"
- on_error:
- then:
- - logger.log:
- format: "OTA Update error %d"
- args: ["x"]
- level: "ERROR"
- tag: "ota"
- on_end:
- then:
- - logger.log:
- format: "OTA Update has completed successfully"
- level: "WARN"
- tag: "ota"
- ### Firmware, Hardware, ESP
- substitutions:
- device: ulanzi_tram
- name: Ulanzi_tram
- location: ${name}
- update_interval: 60s
- reboot_timeout: 0s
- project_name: "Ulanzi.EHMTXv2"
- project_version: "2023.9.1"
- comment: "Ulanzi Pixel Clock"
- board: esp32dev
- # Pin definition from https://github.com/aptonline/PixelIt_Ulanzi
- battery_pin: GPIO34
- buzzer_pin: GPIO15
- ldr_pin: GPIO35
- matrix_pin: GPIO32
- left_button_pin: GPIO26
- mid_button_pin: GPIO27
- right_button_pin: GPIO14
- scl_pin: GPIO22
- sda_pin: GPIO21
- ehmtxv2:
- id: rgb8x32
- icons2html: true
- matrix_component: ehmtx_display
- time_component: ehmtx_time
- time_format: "%H:%M"
- time_format_big: "%H:%M"
- date_format: "%d/%m"
- show_seconds: true
- weekdays: "НДПНВТСРЧТПТСБ"
- advanced_clock: true
- default_font_id: default_font
- default_font_yoffset: 8 # the text is aligned BASELINE_LEFT, the baseline defaults to 6
- special_font_id: special_font
- special_font_yoffset: 8
- blend_steps: 0 #32
- scroll_count: 1 # scroll long text at least two times
- scroll_interval: 32 # milliseconds # the interval in ms to scroll the text (default=80), should be a multiple of the update_interval from the display (default: 16ms)
- rainbow_interval: 32 # milliseconds
- clock_interval: 60 # show the clock at least each x seconds
- show_dow: false # draw the day indicator on the bottom of the screen, defaults to true
- # show_date: false # show the date for show_screen - show_clock seconds otherwise only shows the clock for show_screen seconds, defaults to true
- week_start_monday: true # default monday is first day of week, false = sunday
- frame_interval: 192 # the interval in ms to display the next anim frame (default=192), should be a multiple of the update_interval from the display (default: 16ms)
- on_start_running:
- then:
- lambda: |-
- ESP_LOGD(TAG, "removing default clock screen and setting a new one with new screen time");
- id(rgb8x32)->del_screen("*", 2);
- id(rgb8x32)->clock_screen(1440, 25, true, 192, 192, 192);
- id(rgb8x32)->set_weekday_color(150, 150, 150);
- on_next_screen:
- - homeassistant.event:
- event: esphome.new_screen
- data_template:
- iconname: !lambda "return icon.c_str();"
- text: !lambda "return text.c_str();"
- - lambda: |-
- id(current_screen).publish_state(icon.c_str());
- on_next_clock:
- lambda: |-
- id(current_screen).publish_state("Clock");
- on_add_screen:
- - homeassistant.event:
- event: esphome.add_screen
- data_template:
- icon: !lambda "return icon.c_str();"
- mode: !lambda "return mode;"
- # https://developer.lametric.com/icons
- icons:
- - id: ha
- lameid: 7956
- - id: tempc
- lameid: 2422
- - id: plug
- lameid: 403
- - id: humidity
- lameid: 51764
- - id: co2
- lameid: 30662
- - id: co2_bath
- lameid: 7109
- - id: co2_indoor
- lameid: 7113
- - id: co2_bed
- lameid: 7110
- - id: pm25
- lameid: 6641
- - id: alice
- lameid: 57047
- - id: alice_line
- lameid: 57048
- - id: printer_done
- lameid: 51884
- - id: printer
- lameid: 51841
- - id: printer_paused
- lameid: 56979
- - id: printer_error
- lameid: 56980
- - id: temperature
- lameid: 2056
- - id: temperature_down
- lameid: 19649
- - id: temperature_up
- lameid: 19650
- - id: temperature_hot
- lameid: 22293
- - id: temperature_cold
- lameid: 22296
- - id: umbrella
- lameid: 41619
- - id: snow
- lameid: 17140
- - id: weather_clear_night
- lameid: 18433
- - id: weather_cloudy
- lameid: 2283
- - id: weather_exceptional
- lameid: 16754
- - id: weather_fog
- lameid: 52167
- - id: weather_hail
- lameid: 53288
- - id: weather_lightning
- lameid: 23713
- - id: weather_lightning_rainy
- lameid: 49299
- - id: weather_partlycloudy
- lameid: 22160
- - id: weather_pouring
- lameid: 49300
- - id: weather_rainy
- lameid: 2284
- - id: weather_snowy
- lameid: 2289
- - id: weather_snowy_rainy
- lameid: 49301
- - id: weather_sunny
- lameid: 2282
- - id: weather_windy
- lameid: 21909
- - id: weather_windy_variant
- lameid: 21909
- - id: weather_cloudy_night
- lameid: 12195
- - id: battery_low
- lameid: 640
- - id: battery_charging
- lameid: 1095
- - id: humidifier
- lameid: 56401
- - id: video
- lameid: 1944
- - id: player_play
- lameid: 1548
- - id: player_pause
- lameid: 20945
- - id: attention
- lameid: 555
- - id: alert_light
- lameid: 34175
- 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: 2025.2.0
- refresh: 60s
- components: [ ehmtxv2 ]
- font:
- # Matrix Clock Fonts
- # Grab these from hhttps://github.com/trip5/Matrix-Fonts
- # Store in a "fonts" subfolder of your ESPHome config folder or change paths below
- - file: fonts/MatrixChunky6.ttf
- size: 6
- id: default_font
- glyphs: >-
- - file: fonts/MatrixChunky8.ttf
- size: 8
- id: special_font
- glyphs: >-
- binary_sensor:
- - platform: status
- name: "$devicename Status"
- - platform: gpio
- pin:
- number: $left_button_pin
- inverted: true
- name: "$devicename Left button"
- on_press:
- lambda:
- id(rgb8x32)->hold_screen(120);
- - platform: gpio
- pin:
- inverted: true
- number: $mid_button_pin
- mode: INPUT_PULLUP
- name: "$devicename Middle button"
- - platform: gpio
- pin:
- number: $right_button_pin
- inverted: true
- name: "$devicename Right button"
- on_press:
- lambda:
- id(rgb8x32)->skip_screen();
- logger:
- level: info
- output:
- - platform: gpio
- pin:
- number: GPIO15
- ignore_strapping_warning: true
- id: buzzer_pin
- 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
- c = c>0?c:1 ;
- int d = (n - c) * 100 / c; // diff in %
- if ( abs(d) > 2 ) id(rgb8x32)->set_brightness(n);
- }
- web_server:
- i2c:
- sda: $sda_pin
- scl: $scl_pin
- scan: true
- id: i2cbus
- light:
- - platform: neopixelbus
- id: ehmtx_light
- type: GRB
- internal: true
- variant: WS2812
- pin: $matrix_pin
- 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
- - platform: homeassistant
- on_time:
- - seconds: 0
- minutes: 0
- hours: /12
- days_of_week: MON-SUN
- then:
- - logger.log: "***************** time event ***"
- - switch.toggle: restart_ulanzi
- 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();
- switch:
- - platform: restart
- name: "$devicename Restart"
- id: restart_ulanzi
- - platform: template
- name: "$devicename 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;
- - platform: template
- name: "$devicename Display"
- icon: "mdi:clock-digital"
- restore_mode: ALWAYS_ON
- lambda: |-
- return id(rgb8x32)->show_display;
- turn_on_action:
- lambda: |-
- id(rgb8x32)->set_display_on();
- turn_off_action:
- lambda: |-
- id(rgb8x32)->set_display_off();
- - platform: template
- name: "$devicename Night Mode"
- icon: "mdi:weather-night"
- restore_mode: ALWAYS_OFF
- lambda: |-
- return id(rgb8x32)->night_mode;
- turn_on_action:
- lambda: |-
- id(rgb8x32)->set_night_mode_on();
- turn_off_action:
- lambda: |-
- id(rgb8x32)->set_night_mode_off();
- text_sensor:
- - platform: template
- name: "$devicename Current Screen"
- id: current_screen
- update_interval: never
- icon: "mdi:overscan"
- entity_category: diagnostic
Advertisement
Add Comment
Please, Sign In to add comment