logo elektroda
logo elektroda
X
logo elektroda
REKLAMA
REKLAMA
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

GEEKMAGIC Smart Weather Clock ESP8266 ESPHome – integracja z Home Assistant, wyświetlanie encji

kmarkot 20 Maj 2025 17:20 4620 2
REKLAMA
  • #1 21554967
    kmarkot
    Poziom 31  
    Posty: 1371
    Pomógł: 127
    Ocena: 360
    Wi-Fi Wyświetlacz do Home Assistant ESPHOME GEEKMAGIC Smart Weather Clock


    Zamówiłem na popularnym chińskim portalu Mała przenośna inteligentna stacja pogodowa Wi-Fi Wyświetlacz Temperatura pogody Wilgotność Czas Budzik Dekoracja pulpitu
    https://pl.aliexpress.com/item/10050064369569...EO&gatewayAdapt=glo2pol#nav-specification

    Jest to wyświetlacz WI-FI esp8266: board: esp12e
    Są różne modele GEEKMAGIC na esp8266 i ESP32

    Zmieniłem oprogramowanie na ESPHome co pozwala na wyświetlanie encji z HA

    Podłączyłem płytkę ESP przy pomocy Konwerter FT232 - FTDI USB


    GEEKMAGIC Smart Weather Clock ESP8266 ESPHome – integracja z Home Assistant, wyświetlanie encji
    Płytka ESP8266 (model ESP-12E) z wyraźnie oznaczonymi pinami: RST, GPIO0, 3V3, RX, TX, GND.

    i zaprogramowałem

    
    esphome:
      name: smalltv
      friendly_name: SmallTV
    esp8266:
      board: esp12e
      framework:
        version: recommended
    
    external_components:
      - source:
          type: git
          url: https://github.com/rletendu/esphome.git
          ref: st7789_nobuffer_202312
        # refresh: 0s
        components: [st7789v]
    
    # Enable logging
    logger:
    
    ota:
      platform: esphome
    
    # Enable Home Assistant API
    api:
      encryption:
        key: "pihTkDrpuE3BSqFHagILJHX+1ZBQxh97jMuZq3JO6gw="
    
    wifi:
      ssid: !secret wifi_ssid
      password: !secret wifi_password
      fast_connect: true
    
      # Enable fallback hotspot (captive portal) in case wifi connection fails
      ap:
        ssid: "Cash From Cahos"
        password: "CFC_Rules_Since_69"
    
    # Ici, on active le serveur WEB du ESP8266, en allant sur l'IP du ESP8266, on tombe sur une interface pour piloter les relais
    
    captive_portal:
    
    spi:
      clk_pin: GPIO14
      mosi_pin: GPIO13
      interface: hardware
      id: spihwd
    
    # status_led:
    #   pin: GPIO2
    
    
    output:
      - platform: esp8266_pwm
        pin: GPIO05
        frequency: 40 Hz
        id: pwm_output
    
    light:
      - platform: monochromatic
        output: pwm_output
        name: "Backlight"
    
    font:
      - file: 'Roboto-Italic.ttf'
        id: font1
        size: 38
      - file: 'Ubuntu-Regular.ttf'
        id: font2
        size: 30
      - file: 'Ubuntu-Regular.ttf'
        id: font3
        size: 20
      - file: 'led.ttf'
        id: font4
        size: 85    
    
    time:
      - platform: homeassistant
        id: esptime
    
    
    sensor:
      - platform: homeassistant
        entity_id: sensor.moc_l1_l2_l3
        id: Mocl13
        internal: true
        accuracy_decimals: 1
        unit_of_measurement: "W"
        device_class: "power"
        state_class: "measurement"
     
      - platform: homeassistant
        entity_id: sensor.sonoffbasic_ds_multi_out
        id: tempzew
        internal: true
        accuracy_decimals: 2
        unit_of_measurement: "°C"
        device_class: "temperature"
        state_class: "measurement"
    
      - platform: homeassistant
        entity_id: sensor.temp_dom
        id: poktv
        internal: true
        accuracy_decimals: 2
        unit_of_measurement: "°C"
        device_class: "temperature"
        state_class: "measurement"
    
      - platform: homeassistant
        entity_id: sensor.temperature_max
        id: maxout
        internal: true
        accuracy_decimals: 2
        unit_of_measurement: "°C"
        device_class: "temperature"
        state_class: "measurement"
    
    text_sensor:    
      - platform: homeassistant
        name: "Energy 0/1"
        entity_id: input_select.energy_0_1
        id: energy
    
    color:
      - id: color_w
        red: 90%
        green: 90%
        blue: 90%
      - id: color_green
        red: 10%
        green: 60%
        blue: 40%
      - id: color_red
        red: 100%
        green: 0%
        blue: 0%
      - id: color_blue
        red: 10%
        green: 40%
        blue: 60%
      - id: color_blue2
        red: 70%
        green: 70%
        blue: 100%
    display:
      - platform: st7789v
        model: "Custom"
        spi_id: spihwd
        height: 240
        width: 240
        offset_height: 0
        offset_width: 0
        # dc_pin: GPIO02
        # reset_pin: GPIO04
        dc_pin: GPIO00
        reset_pin: GPIO02
        #backlight_pin: GPIO25
        eightbitcolor: True
        #update_interval: never
        update_interval: 30s
        id: disp
        spi_mode: mode3
        lambda: |-
          const auto RED     = Color(255, 0,   0,   0);
          // Calculate the center positions
          int center_x = it.get_width() / 2;
          int center_y = it.get_height() / 2;
    
          // Print "Hello World" centered
          // it.printf(center_x, center_y - 20, id(font2), TextAlign::CENTER, "Hello World");
    
          
          // Display the date in abbreviated weekday, MM/DD/YY format
          it.strftime(center_x, 130, id(font1), id(color_blue), TextAlign::CENTER, "%d:%b:%Y", id(esptime).now());
          it.strftime(center_x, 190, id(font4), id(color_blue2), TextAlign::CENTER, "%H:%M", id(esptime).now());
          
          // it.print(0, 0, id(font1), RED, "Hello World in RED!");
    
          // it.printf(0, 200, id(font1),"Test1");
          // it.print(130, 5, id(font3), id(color_w), "Grid Power:");
          it.printf(240,40, id(font2), id(color_w), TextAlign::RIGHT, "%.1fW",id(Mocl13).state);
          it.printf(center_x, 90, id(font3), id(color_green), TextAlign::CENTER, "%s", to_string(id(energy).state).c_str());
          it.printf(4, 4, id(font1),TextAlign::LEFT, "%.1f°C", id(tempzew).state);


    Oto wynik na wyświetlaczu można opublikować zawartość każdej encji z HA w tym wypadku moc chwilową ,data ,godzina , temperatura zewnętrzna i use energy to wynik bilansowania godzinowego między fazowego.

    Mała kostka z wyświetlaczem LCD pokazującym temperaturę, moc, datę i godzinę.
  • REKLAMA
  • #2 21558746
    kmarkot
    Poziom 31  
    Posty: 1371
    Pomógł: 127
    Ocena: 360
    Mała zmiana text Save energy na czerwono wyświetla gdy bilans godzinowy między fazowe jest na minusie

    Wyświetlacz elektroniczny pokazujący temperaturę, moc, datę, godzinę oraz komunikat Save energy na czerwono.
  • #3 21843135
    jozefplata22
    Poziom 2  
    Posty: 2
    Kreskówkowa postać w czarnym stroju i czerwonych butach, pokazana z profilu

    Added after 56 [seconds]:


    Kolorowy, promienisty wybuch przypominający fajerwerk na czarnym tle
REKLAMA