새창 작성 수정 목록 링크 Edit G카랜다 HDD HDD HDD 게시물 주소 복사


● ESPHome의 LVGL을 활용하여 boiler 구성 요소를 사용하여 온도 조절과 보일러 상태를 표시하는 YAML 소스 코드를 생성

♨ 카랜더 일정 : 2024년09월26일
  • 링크

  • 첨부

  • 컨텐츠 정보

    본문

    ●  ESPHome의 LVGL을 활용하여 boiler 구성 요소를 사용하여 온도 조절과 보일러 상태를 표시하는 YAML 소스 코드를 생성

    고객님께서 요청하신 내용을 바탕으로 ESPHome의 LVGL을 활용하여 climate.485_ttl_ip109_bookroom_boiler 구성 요소를 사용하여 온도 조절과 보일러 상태를 표시하는 YAML 소스 코드를 생성해 드리겠습니다.


    YAML 구성 예시


    아래는 해당 구성 요소의 ID를 사용하여 LVGL 디스플레이에 온도 조절 및 보일러 켜기 버튼, 그리고 온도 상태를 표시하는 예시입니다.


    esphome:

      name: my_boiler_control


    # ESPHome에 필요한 기본 설정

    # 예: wifi 설정, logger 등...


    climate:

      - platform: climate

        id: climate.485_ttl_ip109_bookroom_boier  # 주어진 구성요소 ID

        name: "Bookroom Boiler"

        # 다른 설정들...

      

    lvgl:

      - name: "boiler_display"

        id: boiler_display

        widgets:

          - type: label

            id: label_temperature

            text: "현재 온도: -- °C"  # 초기 텍스트, 나중에 업데이트 될 예정

            x: 10

            y: 20

            font: "Roboto"

            color: 0xFFFFFF

            align: center

            

          - type: button

            id: button_heater

            text: "보일러 켜기"

            x: 10

            y: 60

            width: 150

            height: 40

            action: 

              - climate.set_mode:

                  id: my_boiler

                  mode: "HEAT" # 보일러 모드에서 난방 모드로 설정

            font: "Roboto"

            color: 0xFFFFFF

            bgcolor: 0x006400  # 버튼 배경 색상: 다크 그린

            align: center


          - type: label

            id: label_boiler_status

            text: "보일러 상태: 꺼짐"  # 초기 보일러 상태

            x: 10

            y: 110

            font: "Roboto"

            color: 0xFFFFFF

            align: center


    # 온도 변화나 보일러 상태 업데이트를 위한 설정

    on_climate_update:

      then:

        - lambda: |-

            // 보일러의 현재 온도를 가져와서 텍스트를 업데이트

            id(label_temperature).set_text("현재 온도: " + String(id(my_boiler).current_temperature) + " °C");

            

            // 보일러 상태에 따라 상태 메시지를 업데이트

            if (id(my_boiler).current_mode == climate::MODE_HEAT) {

              id(label_boiler_status).set_text("보일러 상태: 작동 중");

            } else {

              id(label_boiler_status).set_text("보일러 상태: 꺼짐");

            }


    설명


    climate 설정: 


    climate 섹션에서 id: my_boiler로 해당 보일러의 구성 요소를 정의합니다. 이 ID는 온도 조절과 보일러 제어에 사용됩니다.



    LVGL 디스플레이 구성:


    label_temperature: 현재 온도를 표시하기 위한 레이블입니다. 초기값은 "현재 온도: -- °C"로 설정되어 있으며, 실제 온도는 이후에 업데이트될 예정입니다.

    button_heater: 보일러를 켜는 버튼입니다. 이 버튼을 클릭하면 보일러의 모드가 난방 모드로 설정됩니다. 버튼의 텍스트는 "보일러 켜기"로 되어 있으며, 사용자가 쉽게 인식할 수 있도록 배경색(다크 그린)과 폰트를 설정했습니다.

    label_boiler_status: 보일러의 현재 상태를 보여주는 레이블입니다. 초기 상태는 "꺼짐"으로 설정되어 있으며, 보일러의 상태에 따라 업데이트됩니다.



    온도 및 상태 업데이트:


    on_climate_update 블록 내에서 보일러의 상태와 현재 온도를 가져와서 레이블에 표시합니다. 이를 통해 보일러의 현재 온도와 상태가 실시간으로 업데이트되도록 하였습니다.


    이와 같은 구성을 통해, LVGL을 이용한 디스플레이에서 보일러의 온도를 조절할 수 있을 뿐만 아니라, 사용자는 현황을 쉽게 파악할 수 있습니다. 만약 더 구체적인 요구사항이나 추가적인 기능이 필요하시다면 언제든지 말씀해 주세요. 고맙습니다!

    ☞ https://11q.kr 에 등록된 자료 입니다. ♠ 정보찾아 공유 드리며 출처는 링크 참조 바랍니다♠1.png

    [ 추가 정보 ... 더보기) ]
    뷰PDF 1,2



    office view

    관련자료

    댓글목록

    profile_image

    11qkr님의 댓글

    11qkr 쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 아이피 (192.♡.0.1) 작성일

    esphome:
      name: my_boiler_control

    wifi:
      ssid: "your_ssid"
      password: "your_password"

    logger:

    # Climate entity for the boiler
    # climate: # _2024_0926_1205_45
      - platform: climate
        id: my_boiler
        name: "Bookroom Boiler"
        climate_id: "485_ttl_ip109_bookroom_boier"

    # Sensor to get the current temperature from climate entity
    # sensor: # _2024_0926_1205_45
      - platform: homeassistant
        entity_id: climate.485_ttl_ip109_bookroom_boier
        attribute: current_temperature
        id: current_temperature
        name: "Current Temperature"
    # sensor:
    sensor: # _2024_0926_1205_45
      - platform: homeassistant
        entity_id: climate.485_ttl_ip109_bookroom_boier
        attribute: current_temperature
        id: my_boiler_temperature
        name: "Bookroom Boiler Temperature"


    # Binary sensor to track boiler heating status using hvac_action
    # binary_sensor: # _2024_0926_1205_45
     
      - platform: homeassistant
        entity_id: climate.485_ttl_ip109_bookroom_boier
        id: boiler_on_off_status
        attribute: hvac_action
        on_state:
          then:
            - if:
                condition:
                  lambda: return id(boiler_on_off_status).state == "heating";  # 현재 상태가 "heating"인지 확인
                then:
                  - lambda: id(label_boiler_status).set_text("보일러 상태: 켜짐");
                else:
                  - lambda: id(label_boiler_status).set_text("보일러 상태: 꺼짐");

    lvgl:
      # _2024_0926_1205_45
      - name: "boiler_display"
        id: boiler_display
        widgets:
          # Display the current temperature
          - type: label
            id: label_temperature
            text: "현재 온도: -- °C"  # 초기 텍스트, 나중에 업데이트
            x: 10
            y: 20
            font: "Roboto"
            color: 0xFFFFFF
            align: center
           
          # Button to turn on the boiler
          - type: button
            id: button_heater
            text: "보일러 켜기"
            x: 10
            y: 60
            width: 150
            height: 40
            action:
              - climate.set_mode:
                  id: my_boiler
                  mode: "HEAT"  # 난방 모드 설정
            font: "Roboto"
            color: 0xFFFFFF
            bgcolor: 0x006400  # 다크 그린 배경색
            align: center

          # Display the boiler status (on/off)
          - type: label
            id: label_boiler_status
            text: "보일러 상태: 꺼짐"  # 초기 보일러 상태
            x: 10
            y: 110
            font: "Roboto"
            color: 0xFFFFFF
            align: center

    # Automation to update the temperature label from the climate entity
    interval: # _2024_0926_1205_45
      - interval: 5s
        then:
          - lambda: |-
              auto temp = id(current_temperature).state;
              id(label_temperature).set_text("현재 온도: " + String(temp) + " °C");

    # Automation to update the boiler status label
    # binary_sensor: # _2024_0926_1205_45
      - platform: homeassistant
        entity_id: climate.485_ttl_ip109_bookroom_boier
        id: boiler_on_off_status
        attribute: hvac_action
        on_state:
          then:
            - lambda: |-
                id(label_boiler_status).set_text("보일러 상태: 켜짐");
        off_state:
          then:
            - lambda: |-
                id(label_boiler_status).set_text("보일러 상태: 꺼짐");

    # _2024_0926_1205_45
    api:
      services:
        - service: set_temperature
          variables:
            temperature: float
          then:
            - homeassistant.service:
                service: climate.set_temperature
                data:
                  entity_id: climate.485_ttl_ip109_bookroom_boier
                  temperature: !lambda 'return temperature;'
    ===> 에러 코드

    답변

    새창 작성 수정 목록 링크 Edit G카랜다 HDD HDD HDD 게시물 주소 복사


    ♥간단_메모글♥


    최근글


    새댓글



    PHP 안에 HTML ☞ 홈페이지 화면갱신 시간은 ♨
    ▶ 2024-09-27 07:09:44

    오늘의 홈 현황


    • 현재 접속자♨ 573 명
    • 오늘 가입자※ 0 명
    • 어제 가입자※ 3 명
    • 주간 가입자※ 9 명
    • 오늘 방문자 1,849 명
    • 어제 방문자 3,103 명
    • 최대 방문자 13,042 명
    • 전체 방문자 4,591,208 명
    • 전체 게시물※ 8,810 개
    • 전체 댓글수※ 25,113 개
    • 전체 회원수 11,254 명

    QR코드


    ☞ QR코드 스캔은 kakao앱 자체 QR코드

    알림 0








    최신글↑