본문 바로가기

집 꾸미기/스마트한 집

현대통신 아파트 조명 구글홈 연동 - Home Assistant

반응형

아파트 월패드용 스마트폰 어플이 있으나 도저히 사용할 수 없는 속도다.

프로그램 실행하는데 하세월 걸리고 버튼 누르고 변경되는걸 확인하는데도 몇초씩 걸린다.

 

불편함에 찾아보니 이미 선구자들이

월패드와 전등, 보일러 등 연결된 장치간 통신이 RS485 이며 해당 패킷을 분석하고 패킷을 보내서 제어를 하고 있다.

 

 

기본적으로 서버가 필요하며 라즈베리 파이나 도커 설치 가능한 NAS를 주로 사용한다.

 

RS485 제어 방법은 크게 아래 3가지다.

  • 서버에 직접 RS485-USB 장치를 연결 (패킷 제어 프로그램 필요. node.js나 파이썬 버전으로 제작되어있음)
  • RS485 to wifi 장치를 연결 (패킷 제어 프로그램 필요. node.js나 파이썬 버전으로 제작되어있음 )
  • ESPHome 장치를 이용한 제어 (Home assistant 플러그인 있음)

 

 

 

자세한 내용은 아래를 읽어보며 따라가면 된다.

 

cafe.naver.com/stsmarthome/12973

 

월패드 연동 ESPHOME RS485...

2020-04-01 업데이트 1. 체크섬 2byte 대응 checksum2 옵션 추가 (a...

cafe.naver.com

 

cafe.naver.com/stsmarthome/18238

 

[ESPHome] 현대통신 월패드 R...

대한민국 모임의 시작, 네이버 카페

cafe.naver.com

 

 

 

본인은 HA(Home assistant) 에서 가장 간편하게 사용 할 수 있는 ESPhome 버전으로 사용하고 있다.

사용을 위한 준비 과정을 요약하면 아래와 같다. 

1. 준비물

  • NAS (또는 라즈베리파이) 
  • Wemo d1 mini (RS8266 장치, 와이파이 가능한 프로그래밍 보드)
  • RS485 to UART
  • 납땜 장비, 소량의 전선
  • ESPeasy 펌웨어
  • HASS.io 설치 (home assistant 와 기타 애드온 관리 프로그램 통합된 버전)
  • 5V 1A 정도의 usb 충전기

2. 사용방법 요약

 

 

3. 사용중인 설정 내용

같은 imazu 여도 아파트마다 조금씩 패킷이 다르다. 참조할 것..

 

백업을 위해서 사용중인 esphome 데이터를 아래와 같이 붙여넣는다.

substitutions:
  node_name: rs485
  device_name: "RS485 Controller"
  
esphome:
  name: imazu_home_kks
  platform: esp8266
  board: d1_mini

wifi:
  ssid: "SSID"
  password: "PASSWORD"
  manual_ip:
    static_ip: 192.168.1.4 #(YOUR IP)
    gateway: 192.168.1.1
    subnet: 255.255.255.0
  reboot_timeout: 10min
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Fallback Hotspot"
    password: "FALLBACK HOTSPOT PASSWORD"

captive_portal:


debug:
# Enable logging
logger:
  baud_rate: 0
  level: DEBUG #기본값
  #level: VERBOSE #사용하지 않는 패킷만 출력
  #level: VERY_VERBOSE #전체 패킷 출력 (초기 설정시에 추천)

# Enable Home Assistant API
api:
  reboot_timeout: 0s

ota:
  password: "PASSWORD"

status_led:
  pin: 
    number: GPIO2
    inverted: True


# RS485 Component (for ttl to rs485 module)
#  - esp8266: UART0 (TX: GPIO1, RX: GPIO3)
#  - esp32: UART2 (TX: GPIO17, RX: GPIO16)
rs485:
  baud_rate: 9600 #Required
  data_bits: 8    #Option(default: 8)
  parity: 0       #Option(default: 0)
  stop_bits: 1    #Option(default: 1)
  
  rx_wait: 10     #Option(default: 10ms)  -> 수신 메시지 대기시간 (10ms 미만으로 수신된 메시지만 한 패킷으로 판단)
  tx_interval: 50 #Option(default: 50ms) -> 발신 메시지 전송 간격 (패킷 수신 후 50ms 대기 후 전송)
  tx_wait: 100    #Option(default: 100ms) -> 발신 메시지 Ack 대기시간
  tx_retry_cnt: 3 #Option(default: 3)     -> 발신 메시지 Ack 없을 경우 재시도 횟수
  prefix: [0xF7]  #Option -> 값 세팅시 모든 수신 패킷 Check, 발신 패킷에 Append
  suffix: [0xEE]  #Option -> 값 세팅시 모든 수신 패킷 Check, 발신 패킷에 Append

  checksum: True      #Option(default: False) -> 체크섬 사용여부 (lambda 사용시 세팅 불필요)
  # checksum_lambda: |- #Option -> Default(CheckSum8 Xor) 체크섬 아닐 경우 직접 로직 구현(아래 값은 Default 로직임)
  #   // @param: const uint8_t *data, const unsigned short len
  #   // @return: uint8_t
  #   uint8_t crc = 0xF7; // data 변수에는 prefix 제외되어 있음
  #   for(num_t i=0; i<len; i++)
  #     crc ^= data[i];
  #   return crc;
  
  checksum2: False  #Option(default: False) -> ADD 체크섬 사용여부
  # checksum2: !lambda |- #Option -> Default(CheckSum8 Add) 체크섬 아닐 경우 직접 로직 구현(아래 값은 Default 로직임)
  #   // @param: const uint8_t *data, const unsigned short len, const uint8_t checksum1
  #   // @return: uint8_t
  #   uint8_t crc = 0xF7; // data 변수에는 prefix 제외되어 있음
  #   for(num_t i=0; i<len; i++)
  #     crc += data[i];
  #   crc += checksum1; // 첫번째 체크섬 계산 결과
  #   return crc;
  
#  state_response: #Option -> 값 세팅시 response 패킷 수신 후에 명령 패킷 송신
#    data: [0x04]
#    offset: 3
#    and_operator: False #Option(default: False) 수신패킷의 offset 위치와 data[0] And 비트연산 (비트위치-1: 0x01, 2: 0x02, 3: 0x04, 4: 0x08, 5: 0x10, 6: 0x20, 7: 0x40, 8: 0x80)
#    inverted: False #Option(default: False) 결과 값 반전(일치하지 않을 경우 참)
    
    
#  packet_monitor: #Option -> 패킷 모니터: Array 없으면 전체 출력, 있을 경우 or 조건 (logger level DEBUG 추천)
#   - [0x0c, 0x01, 0x2b]  # offset: 0
#   - data: [0x19, 0x04, 0x40, 0x23]
#     offset: 2

# RS485 Device 셋팅 팁
# 1. 상태 확인용(수신) Schema
#   - 대상: device(Required), sub_device(Option), state*
#   - 조건: device and sub_device 일치할때만 해당 Device에 패킷 전달됨
#   - 예시:
#     device: 
#       offset: 0 # 수신 패킷 비교 위치 (prefix 제외)
#       data: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x23, 0x00] # hex array
#       and_operator: False # And 비트연산 사용여부
#       inverted: False #Option(default: False) 결과 값 반전 여부
#     #alias schema
#     device: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x23, 0x00] # offset: 0, data: hex array
#
# 2. 명령용(발신) Schema
#   - 대상: command*
#   - 예시:
#     command:
#       data: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x21, 0x01, 0x00]  # prefix, checksum, suffix 제외
#       ack: [0x0b, 0x01, 0x1f, 0x04, 0x40, 0x21, 0x01, 0x01]   # prefix, checksum, suffix 제외
#     # Ack 없을 경우
#     command: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x21, 0x01, 0x00]
#     # Template(lambda): command_on, command_off
#     command_on: !lambda |-
#       uint8_t flag = id(balcony).state ? 0x02 : 0x01;
#       return {
#                 {0x0b, 0x01, 0x19, 0x02, 0x40, 0x23, flag, 0x00},
#                 {0x0b, 0x01, 0x19, 0x04, 0x40, 0x23, 0x01, 0x01}
#              };
#     command_off: !lambda |-
#       uint8_t flag = id(balcony).state ? 0x02 : 0x01;
#       return {
#                 {0x0b, 0x01, 0x19, 0x02, 0x40, 0x23, flag, 0x00},
#                 {0x0b, 0x01, 0x19, 0x04, 0x40, 0x23, 0x02, 0x02}
#              };
#     # 상태확인 요청 (Sensor 포함 모든 Device에 사용 가능)
#     command_state: [0x0B, 0x01, 0x19, 0x01, 0x40, 0x23, 0x00, 0x00] #Option
#     update_interval: 30s #Option(default: 60s)
#
# 3. Automation Schema
#   - rs485.write:
#       data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x23, 0x01, 0x00]
#       ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x23, 0x01, 0x01]
#   - rs485.write: !lambda return {{0x0b, 0x01, 0x19, 0x02, 0x40, 0x23, 0x01, 0x00}, {0x0b, 0x01, 0x19, 0x04, 0x40, 0x23, 0x01, 0x01}};
#   # Ack 없는 경우
#   - rs485.write: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x23, 0x01, 0x00]
#   - rs485.write: !lambda return {{0x0b, 0x01, 0x19, 0x02, 0x40, 0x23, 0x01, 0x00}, {}};



# RS485 Sensor

globals:
  - id: EV_CALL_COUNT
    type: int
    initial_value: '0'
  - id: EV_CALLING
    type: bool
    initial_value: 'false'

sensor:
  #엘리베이터 방향 정보
  - platform: rs485
    id: EV_ARRIVE
    device: [0x0D, 0x01, 0x34, 0x01, 0x41, 0x10, 0x00]
    #device: [0x0D, 0x01, 0x34, 0x01, 0x41, 0x10, 0x00]  kks 
    data:
      offset: 7
      length: 1
    on_value:
      then:
        - text_sensor.template.publish:
            id: EV_DIRECTION
            state: !lambda |-
              if (x == 0x01) return "도착";
              else if (x == 0xA6) return "UP";
              else if (x == 0xB6) return "DOWN";
              else return "";
  # 엘리베이터 층수 정보
  - platform: rs485
    id: EV
    device: [0x0D, 0x01, 0x34, 0x01, 0x41, 0x10, 0x00]
    #device: [0x0D, 0x01, 0x34, 0x01, 0x41, 0x10, 0x00]  kks
    lambda: !lambda |-
      if(len < 9) return {};
      char buf[3];
      sprintf(buf, "%02X ", data[8]);
      if(buf[0] == 'F')
        if(buf[1] == 'F') return -1.0;
        else return -2.0;
      else
        return atof(buf);
    on_value:
      then:
        - text_sensor.template.publish:
            id: EV_TEXT
            state: !lambda |-
              char result[10];
              if(x == 0) sprintf(result, "");
              else if(x > 0) sprintf(result, "%1.0f층", x);
              else sprintf(result, "지하 %1.0f층", -x);
              return result;

text_sensor:
  - platform: homeassistant
    name: Google Home mini TTS state
    icon: "mdi:speaker"
    entity_id: sensor.tts_state
    id: TTS_STATE

  # 엘리베이터 층수 정보
  - platform: template
    name: Elevator Floor
    icon: "mdi:elevator"
    id: EV_TEXT
    on_value:
      then:
        - if:
            condition:
              lambda: |-
                return ( "" != id(EV_TEXT).state );
            then:
              # 층수 정보가 업데이트 될 경우 엘리베이터 호출에 성공한 것으로 판단
              - globals.set:
                  id: EV_CALLING
                  value: 'false'
              # TTS로 엘리베이터 층수 방송
              - if:
                  condition:
                    lambda: |-
                      return ( "off" == id(TTS_STATE).state );
                  then:
                    - homeassistant.service:
                        service: media_player.turn_on
                        data:
                          entity_id: media_player.sigtagyeop
              - homeassistant.service:
                  service: tts.google_say
                  data:
                    entity_id: media_player.sigtagyeop
                    message: !lambda 'return id(EV_TEXT).state;'

  # 엘리베이터 방향(UP/DOWN/도착) 정보
  - platform: template
    name: Elevator Direction
    icon: "mdi:elevator"
    id: EV_DIRECTION
    on_value:
      - if:
          condition:
            text_sensor.state:
              id: EV_DIRECTION
              state: '도착'
          then:
            # 방향 정보가 업데이트 될 경우 엘리베이터 호출에 성공한 것으로 판단
            - globals.set:
                id: EV_CALLING
                value: 'false'
            - delay: 5s
            - homeassistant.service:
                service: media_player.turn_off
                data:
                  entity_id: media_player.sigtagyeop


switch:
    
  # 안방1 콘센트
  # 켜기
  #  0xf7 0x0b 0x01 0x1f 0x02 0x40 0x21 0x01 0x00 0x80 0xee
  #  0xf7 0x0b 0x01 0x1f 0x04 0x40 0x21 0x01 0x01 0x87 0xee (ack)
  # 끄기
  #  0xf7 0x0b 0x01 0x1f 0x02 0x40 0x21 0x02 0x00 0x83 0xee
  #  0xf7 0x0b 0x01 0x1f 0x04 0x40 0x21 0x02 0x02 0x87 0xee (ack)
  # 켜기상태-> 0xF7 0x12 0x01 0x1F 0x04 0x40 0x21 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x9E 0xEE
  # 끄기상태-> 0xF7 0x12 0x01 0x1F 0x04 0x40 0x21 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x9D 0xEE

  - platform: template
    name: Elevator Call
    icon: "mdi:elevator"
    turn_on_action:
      # 엘리베이터 호출 cmd는 최대 30번
      # 점검 등의 사유로 호출이 안될 경우 중단을 위해 최대 카운트 설정
      - globals.set:
          id: EV_CALL_COUNT
          value: '25'
      # 엘리베이터 호출에 성공할 경우 cmd 보내는 것을 중지하기 위한 변수
      # 층수 정보(EV_TEXT)가 업데이트 될 경우 엘리베이터 호출에 성공한 것으로 판단
      - globals.set:
          id: EV_CALLING
          value: 'true'
      # TTS로 엘리베이터 호출 방송
      - homeassistant.service:
          service: media_player.turn_on
          data:
            entity_id: media_player.sigtagyeop
      - homeassistant.service:
          service: tts.google_say
          data:
            entity_id: media_player.sigtagyeop
            message: 엘리베이터를 호출합니다.
      # TTS 방송이 완료될 때 까지 대기
      # 대기하지 않을 경우 층수 정보(EV_TEXT) 방송에 의해 호출 방송이 중단 됨
      - delay: 2s
      # 반복문
      - while:
          # 엘리베이터 호출에 성공하거나, 최대 30번까지만 cmd를 전송
          condition:
            lambda: |-
              return ( 0 < id(EV_CALL_COUNT) ) && ( true == id(EV_CALLING) );
          # 1초마다 한번씩 cmd를 전송
          # cmd를 전송할 때 마다 카운트 변수를 1씩 차감
          then:
            - rs485.write: [0x0B, 0x01, 0x34, 0x04, 0x41, 0x10, 0x00, 0x06]
            #- rs485.write: [0x0B, 0x01, 0x34, 0x04, 0x41, 0x10, 0x00, 0x06]  kks 
            - lambda: |-
                id(EV_CALL_COUNT) -= 1;
            - delay: 1s
      # 엘리베이터 호출에 실패할 경우 TTS로 호출 실패 방송
      - if:
          condition:
            lambda: |-
              return ( 0 == id(EV_CALL_COUNT) );
          then:
            - homeassistant.service:
                service: tts.google_say
                data:
                  entity_id: media_player.sigtagyeop
                  message: 엘리베이터 호출에 실패했습니다.
            - delay: 3s
            - homeassistant.service:
                service: media_player.turn_off
                data:
                  entity_id: media_player.sigtagyeop
 
  - platform: rs485
    name: "Bedroom Power Socket 1"
    icon: "mdi:power-socket-eu"
    device: [0x25, 0x01, 0x1F, 0x04, 0x40, 0x20, 0x00]
    state_on:
      offset: 8
      data: [0x01]
    state_off:
      offset: 8
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x21, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x1f, 0x04, 0x40, 0x21, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x21, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x1f, 0x04, 0x40, 0x21, 0x02, 0x02]
    #command_state: [0x0B, 0x01, 0x1f, 0x01, 0x40, 0x20, 0x00, 0x00] #Option
    #update_interval: 997s #Option(default: 60s)
    
  # 안방2 콘센트
  - platform: rs485
    name: "Bedroom Power Socket 2"
    icon: "mdi:power-socket-eu"
    device: [0x25, 0x01, 0x1F, 0x04, 0x40, 0x20, 0x00]
    state_on:
      offset: 17
      data: [0x01]
    state_off:
      offset: 17
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x22, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x1f, 0x04, 0x40, 0x22, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x22, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x1f, 0x04, 0x40, 0x22, 0x02, 0x02]

  # 안방3 콘센트
  - platform: rs485
    name: "Bedroom Power Socket 3"
    icon: "mdi:power-socket-eu"
    device: [0x25, 0x01, 0x1F, 0x04, 0x40, 0x20, 0x00]
    state_on:
      offset: 26
      data: [0x01]
    state_off:
      offset: 26
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x23, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x1f, 0x04, 0x40, 0x23, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x23, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x1f, 0x04, 0x40, 0x23, 0x02, 0x02]
      
  # 거실1 콘센트
  - platform: rs485
    name: "Livingroom Power Socket 1"
    icon: "mdi:power-socket-eu"
    device: [0x1C, 0x01, 0x1F, 0x04, 0x40, 0x10]
    state_on:
      offset: 8
      data: [0x01]
    state_off:
      offset: 8
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x11, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x1f, 0x04, 0x40, 0x11, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x11, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x1f, 0x04, 0x40, 0x11, 0x02, 0x02]
    #command_state: [0x0B, 0x01, 0x1f, 0x01, 0x40, 0x10, 0x00, 0x00] #Option
    #update_interval: 991s #Option(default: 60s)


  # 거실2 콘센트
  - platform: rs485
    name: "Livingroom Power Socket 2"
    icon: "mdi:power-socket-eu"
    device: [0x1C, 0x01, 0x1F, 0x04, 0x40, 0x10]
    state_on:
      offset: 17
      data: [0x01]
    state_off:
      offset: 17
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x12, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x1f, 0x04, 0x40, 0x12, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x1f, 0x02, 0x40, 0x12, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x1f, 0x04, 0x40, 0x12, 0x02, 0x02]


  # 컴퓨터방 콘센트1
  # 켜기
  #, 0xF7, 0x0B, 0x01, 0x1F, 0x02, 0x40, 0x41, 0x01, 0x00, 0xE0, 0xEE
  #, 0xF7, 0x0B, 0x01, 0x1F, 0x04, 0x40, 0x41, 0x01, 0x01, 0xE7, 0xEE  ack
  # 끄기
  #, 0xF7, 0x0B, 0x01, 0x1F, 0x02, 0x40, 0x41, 0x02, 0x00, 0xE3, 0xEE
  #, 0xF7, 0x0B, 0x01, 0x1F, 0x04, 0x40, 0x41, 0x02, 0x02, 0xE7, 0xEE
  
  - platform: rs485
    name: "Computer Room Power Socket 1"
    icon: "mdi:power-socket-eu"
    device: [0x1C, 0x01, 0x1F, 0x04, 0x40, 0x40, 0x00]
    state_on:
      offset: 8
      data: [0x01]
    state_off:
      offset: 8
      data: [0x02]
    command_on:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x41, 0x01, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x41, 0x01, 0x01]
    command_off:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x41, 0x02, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x41, 0x02, 0x02]
    #command_state: [0x0B, 0x01, 0x1f, 0x01, 0x40, 0x40, 0x00, 0x00] #Option
    #update_interval: 983s #Option(default: 60s)

  # 컴퓨터방 콘센트2
  # 켜기
  #, 0xF7, 0x0B, 0x01, 0x1F, 0x02, 0x40, 0x42, 0x01, 0x00, 0xE3, 0xEE
  #, 0xF7, 0x0B, 0x01, 0x1F, 0x04, 0x40, 0x42, 0x01, 0x01, 0xE4, 0xEE  ack
  # 끄기
  #, 0xF7, 0x0B, 0x01, 0x1F, 0x02, 0x40, 0x42, 0x02, 0x00, 0xE0, 0xEE
  #, 0xF7, 0x0B, 0x01, 0x1F, 0x04, 0x40, 0x42, 0x02, 0x02, 0xE4, 0xEE


  - platform: rs485
    name: "Computer Room Power Socket 2"
    icon: "mdi:power-socket-eu"
    device: [0x1C, 0x01, 0x1F, 0x04, 0x40, 0x40, 0x00]
    state_on:
      offset: 17
      data: [0x01]
    state_off:
      offset: 17
      data: [0x02]
    command_on:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x42, 0x01, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x42, 0x01, 0x01]
    command_off:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x42, 0x02, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x42, 0x02, 0x02]

  # 작은방 콘센트1

  - platform: rs485
    name: "Room3 Power Socket 1"
    icon: "mdi:power-socket-eu"
    device: [0x1C, 0x01, 0x1F, 0x04, 0x40, 0x30, 0x00]
    state_on:
      offset: 8
      data: [0x01]
    state_off:
      offset: 8
      data: [0x02]
    command_on:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x31, 0x01, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x31, 0x01, 0x01]
    command_off:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x31, 0x02, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x31, 0x02, 0x02]
    #command_state: [0x0B, 0x01, 0x1f, 0x01, 0x40, 0x30, 0x00, 0x00] #Option
    #update_interval: 977s #Option(default: 60s)
    
    
  # 작은방 콘센트2

  - platform: rs485
    name: "Room3 Power Socket 2"
    icon: "mdi:power-socket-eu"
    device: [0x1C, 0x01, 0x1F, 0x04, 0x40, 0x30, 0x00]
    state_on:
      offset: 17
      data: [0x01]
    state_off:
      offset: 17
      data: [0x02]
    command_on:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x32, 0x01, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x32, 0x01, 0x01]
    command_off:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x32, 0x02, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x32, 0x02, 0x02]

  # 주방 콘센트1

  - platform: rs485
    name: "Kitchen Power Socket 1"
    icon: "mdi:power-socket-eu"
    device: [0x1C, 0x01, 0x1F, 0x04, 0x40, 0x50, 0x00]
    state_on:
      offset: 8
      data: [0x01]
    state_off:
      offset: 8
      data: [0x02]
    command_on:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x51, 0x01, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x51, 0x01, 0x01]
    command_off:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x51, 0x02, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x51, 0x02, 0x02]
    #command_state: [0x0B, 0x01, 0x1f, 0x01, 0x40, 0x50, 0x00, 0x00] #Option
    #update_interval: 971s #Option(default: 60s)
    
    
  # 주방 콘센트2
  - platform: rs485
    name: "Kitchen Power Socket 2"
    icon: "mdi:power-socket-eu"
    device: [0x1C, 0x01, 0x1F, 0x04, 0x40, 0x50, 0x00]
    state_on:
      offset: 24
      data: [0x01]
    state_off:
      offset: 24
      data: [0x02]
    command_on:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x52, 0x01, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x52, 0x01, 0x01]
    command_off:
      data: [0x0B, 0x01, 0x1F, 0x02, 0x40, 0x52, 0x02, 0x00]
      ack: [0x0B, 0x01, 0x1F, 0x04, 0x40, 0x52, 0x02, 0x02]


# RS485 Light(like Binary Light)
light:
  # [안방1]
  # 켜짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x21, 0x00, 0x01, 0x80, 0xee
  # 꺼짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x21, 0x00, 0x02, 0x83, 0xee
  # 켜짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x21, 0x01, 0x00, 0x86, 0xee
  # 꺼짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x21, 0x02, 0x00, 0x85, 0xee
  - platform: rs485
    name: "Bedroom 1"
    device: [0x0c, 0x01, 0x19, 0x04, 0x40, 0x20, 0x00]
    state_on:
      offset: 7
      data: [0x01]
    state_off:
      offset: 7
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x21, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x21, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x21, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x21, 0x02, 0x02]
#    command_state: [0x0B, 0x01, 0x19, 0x01, 0x40, 0x20, 0x00, 0x00] #Option
#    update_interval: 101s #Option(default: 60s)
    
  # [안방2]
  # 켜짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x22, 0x00, 0x01, 0x83, 0xee
  # 꺼짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x22, 0x00, 0x02, 0x80, 0xee
  # 켜짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x22, 0x01, 0x00, 0x85, 0xee
  # 꺼짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x22, 0x02, 0x00, 0x86, 0xee
  - platform: rs485
    name: "Bedroom 2"
    device: [0x0c, 0x01, 0x19, 0x04, 0x40, 0x20, 0x00]
    state_on:
      offset: 8
      data: [0x01]
    state_off:
      offset: 8
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x22, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x22, 0x01, 0x01]
    command_off: 
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x22, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x22, 0x02, 0x02]


  # [거실1]
  # 켜짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x11, 0x00, 0x01, 0xb0, 0xee
  # 꺼짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x11, 0x00, 0x02, 0xb3, 0xee
  # 켜짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x11, 0x01, 0x00, 0xb6, 0xee
  # 꺼짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x11, 0x02, 0x00, 0xb5, 0xee
  - platform: rs485
    name: "Livingroom 1"
    device: [0x0D, 0x01, 0x19, 0x04, 0x40, 0x10, 0x00]
    state_on:
      offset: 7
      data: [0x01]
    state_off:
      offset: 7
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x11, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x11, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x11, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x11, 0x02, 0x02]
#    command_state: [0x0B, 0x01, 0x19, 0x01, 0x40, 0x10, 0x00, 0x00] #Option
#    update_interval: 103s #Option(default: 60s)
 

  # [거실2]
  # 켜짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x12, 0x00, 0x01, 0xb3, 0xee
  # 꺼짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x12, 0x00, 0x02, 0xb0, 0xee
  # 켜짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x12, 0x01, 0x00, 0xb5, 0xee
  # 꺼짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x12, 0x02, 0x00, 0xb6, 0xee
  - platform: rs485
    name: "Livingroom 2"
    device: [0x0D, 0x01, 0x19, 0x04, 0x40, 0x10, 0x00]
    state_on:
      offset: 8
      data: [0x01]
    state_off:
      offset: 8
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x12, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x12, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x12, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x12, 0x02, 0x02]



  # [발코니]
  # 켜짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x13, 0x00, 0x01, 0xb2, 0xee
  # 꺼짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x13, 0x00, 0x02, 0xb1, 0xee
  # 켜짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x13, 0x01, 0x00, 0xb4, 0xee
  # 꺼짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x13, 0x02, 0x00, 0xb7, 0xee
  - platform: rs485
    name: "Livingroom 3"
    device: [0x0D, 0x01, 0x19, 0x04, 0x40, 0x10, 0x00]
    state_on:
      offset: 9
      data: [0x01]
    state_off:
      offset: 9
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x13, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x13, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x13, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x13, 0x02, 0x02]


  # [작은방]
  # 켜짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x31, 0x01, 0x01, 0x91, 0xee
  # 꺼짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x31, 0x02, 0x02, 0x91, 0xee
  # 켜짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x31, 0x01, 0x00, 0x96, 0xee
  # 꺼짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x31, 0x02, 0x00, 0x95, 0xee
  - platform: rs485
    name: "Room 3"
    device: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x30, 0x00]
    state_on:
      offset: 7
      data: [0x01]
    state_off:
      offset: 7
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x31, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x31, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x31, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x31, 0x02, 0x02]
#    command_state: [0x0B, 0x01, 0x19, 0x01, 0x40, 0x30, 0x00, 0x00] #Option
#    update_interval: 107s #Option(default: 60s)
    
      
  # [컴퓨터방]
  # 켜짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x41, 0x01, 0x01, 0xe1, 0xee
  # 꺼짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x41, 0x02, 0x02, 0xe1, 0xee
  # 켜짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x41, 0x01, 0x00, 0xe6, 0xee
  # 꺼짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x41, 0x02, 0x00, 0xe5, 0xee
  - platform: rs485
    name: "Computer Room"
    device: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x40, 0x00]
    state_on:
      offset: 7
      data: [0x01]
    state_off:
      offset: 7
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x41, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x41, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x41, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x41, 0x02, 0x02]
#    command_state: [0x0B, 0x01, 0x19, 0x01, 0x40, 0x40, 0x00, 0x00] #Option
#    update_interval: 109s #Option(default: 60s)

      
  # [주방]
  # 켜짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x51, 0x01, 0x01, 0xf1, 0xee
  # 꺼짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x51, 0x02, 0x02, 0xf1, 0xee
  # 켜짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x51, 0x01, 0x00, 0xf6, 0xee
  # 꺼짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x51, 0x02, 0x00, 0xf5, 0xee
  - platform: rs485
    name: "Kitchen"
    device: [0x0C, 0x01, 0x19, 0x04, 0x40, 0x50, 0x00]
    state_on:
      offset: 7
      data: [0x01]
    state_off:
      offset: 7
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x51, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x51, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x51, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x51, 0x02, 0x02]
#    command_state: [0x0B, 0x01, 0x19, 0x01, 0x40, 0x50, 0x00, 0x00] #Option
#    update_interval: 113s #Option(default: 60s)
      
      
  # [식탁]
  # 켜짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x52, 0x01, 0x01, 0xf2, 0xee
  # 꺼짐 상태-> 0xf7, 0x0b, 0x01, 0x19, 0x04, 0x40, 0x52, 0x02, 0x02, 0xf2, 0xee
  # 켜짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x52, 0x01, 0x00, 0xf5, 0xee
  # 꺼짐 명령-> 0xf7, 0x0b, 0x01, 0x19, 0x02, 0x40, 0x52, 0x02, 0x00, 0xf6, 0xee
  - platform: rs485
    name: "Table"
    device: [0x0C, 0x01, 0x19, 0x04, 0x40, 0x50, 0x00]
    state_on:
      offset: 8
      data: [0x01]
    state_off:
      offset: 8
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x52, 0x01, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x52, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x19, 0x02, 0x40, 0x52, 0x02, 0x00]
      ack: [0x0b, 0x01, 0x19, 0x04, 0x40, 0x52, 0x02, 0x02]


# RS485 Fan
fan:
  # [환기]
  # 켜짐(강) 상태-> 0xf7, 0x0c, 0x01, 0x2b, 0x04, 0x42, 0x11, 0x07, 0x01, 0x07, 0x87, 0xee
  # 켜짐(중) 상태-> 0xf7, 0x0c, 0x01, 0x2b, 0x04, 0x42, 0x11, 0x03, 0x01, 0x03, 0x87, 0xee
  # 켜짐(약) 상태-> 0xf7, 0x0c, 0x01, 0x2b, 0x04, 0x42, 0x11, 0x01, 0x01, 0x01, 0x87, 0xee
  # 꺼짐     상태-> 0xf7, 0x0c, 0x01, 0x2b, 0x04, 0x40, 0x11, 0x02, 0x02, 0x01, 0x85, 0xee
  # 켜짐(강) 명령-> 0xf7, 0x0b, 0x01, 0x2b, 0x02, 0x42, 0x11, 0x07, 0x00, 0x80, 0xee
  # 켜짐(중) 명령-> 0xf7, 0x0b, 0x01, 0x2b, 0x02, 0x42, 0x11, 0x03, 0x00, 0x84, 0xee
  # 켜짐(약) 명령-> 0xf7, 0x0b, 0x01, 0x2b, 0x02, 0x42, 0x11, 0x01, 0x00, 0x86, 0xee
  # 꺼짐     명령-> 0xf7, 0x0b, 0x01, 0x2b, 0x02, 0x40, 0x11, 0x02, 0x00, 0x87, 0xee
  - platform: rs485
    name: "Ventilation"
    device: [0x0c, 0x01, 0x2b, 0x04, 0x40, 0x11, 0x00]
    state_on:
      offset: 7
      data: [0x01]
    state_off:
      offset: 7
      data: [0x02]
    command_on:
      data: [0x0b, 0x01, 0x2b, 0x02, 0x40, 0x11, 0x01, 0x00]
#      ack: [0x0c, 0x01, 0x2b, 0x04, 0x41, 0x2b, 0x04, 0x40, 0x11, 0x00, 0x01]
      ack: [0x0c, 0x01, 0x2b, 0x04, 0x40, 0x11, 0x01, 0x01, 0x01]
    command_off:
      data: [0x0b, 0x01, 0x2b, 0x02, 0x40, 0x11, 0x02, 0x00]
      ack: [0x0c, 0x01, 0x2b, 0x04, 0x40, 0x11, 0x02, 0x02, 0x01]
    speed: #Option(high, medium, low) -> 없으면 Binary Fan
      high:
        state:
          offset: 7
          data: [0x01, 0x07]
#          data: [0x07, 0x01, 0x07]
        command:
          data: [0x0b, 0x01, 0x2b, 0x02, 0x42, 0x11, 0x07, 0x00]
  #        data: [0x0c, 0x01, 0x2b, 0x04, 0x42, 0x11, 0x07, 0x01, 0X07 ]
          ack: [0x0c, 0x01, 0x2b, 0x04, 0x40, 0x11, 0x00, 0x01, 0x07]
      medium:
        state:
          offset: 7
          data: [0x01, 0x03]
        command:
#          data: [0x0b, 0x01, 0x2b, 0x02, 0x42, 0x11, 0x03, 0x00, 0x84
          data: [0x0b, 0x01, 0x2b, 0x02, 0x42, 0x11, 0x03, 0x00]
          ack: [0x0c, 0x01, 0x2b, 0x04, 0x40, 0x11, 0x00, 0x01, 0x03]
      low:
        state:
          offset: 7
          data: [0x01, 0x01, 0x01]
        command:
          data: [0x0b, 0x01, 0x2b, 0x02, 0x42, 0x11, 0x01, 0x00]
          ack: [0x0c, 0x01, 0x2b, 0x04, 0x40, 0x11, 0x00, 0x01, 0x01]
 #   command_state: [0x0B, 0x01, 0x2b, 0x01, 0x40, 0x11, 0x00, 0x00] #Option
#    update_interval: 107s #Option(default: 60s)


# RS485 Climate
climate:
  # [거실 난방] 0x11
  # 상태 요청: 0xF7, 0x0B, 0x01, 0x18, 0x01, 0x45, 0x11, 0x00, 0x00, 0xB0, 0xEE
  # 켜짐 상태: 0xF7, 0x0D, 0x01, 0x18, 0x04, 0x45, 0x11, 0x00, (0x01, 0x1B, 0x17), 0xBE, 0xEE (상태, 현재온도, 설정온도)
  # 꺼짐 상태: 0xF7, 0x0D, 0x01, 0x18, 0x04, 0x45, 0x11, 0x00, (0x04, 0x1B, 0x17), 0xBB, 0xEE (상태, 현재온도, 설정온도)
  # 외출 상태: 0xF7, 0x0D, 0x01, 0x18, 0x04, 0x45, 0x11, 0x00, (0x07, 0x1B, 0x17), 0xB9, 0xEE
  # 켜짐 명령: 0xF7, 0x0B, 0x01, 0x18, 0x02, 0x46, 0x11, 0x01, 0x00, 0xB1, 0xEE
  #      ACK: 0xF7, 0x0D, 0x01, 0x18, 0x04, 0x46, 0x11, 0x01, 0x01, 0x1B, 0x17, 0xBC, 0xEE
  # 꺼짐 명령: 0xF7, 0x0B, 0x01, 0x18, 0x02, 0x46, 0x11, 0x04, 0x00, 0xB4, 0xEE
  #      ACK: 0xF7, 0x0D, 0x01, 0x18, 0x04, 0x46, 0x11, 0x04, 0x04, 0x1B, 0x17, 0xBC, 0xEE
  # 온도 조절: 0xF7, 0x0B, 0x01, 0x18, 0x02, 0x45, 0x11, (0x18), 0x00, 0xA7, 0xEE (온도 24도 설정)
  #      ACK: 0xF7, 0x0D, 0x01, 0x18, 0x04, 0x45, 0x11, (0x18), 0x01, (0x1A, 0x18), 0xA8, 0xEE
  - platform: rs485
    name: "Livingroom Heater"
    visual:
      min_temperature: 10 °C
      max_temperature: 40 °C
      temperature_step: 1 °C
    device: [0x22, 0x01, 0x18, 0x04, 0x46, 0x10, 0x00]
    state_current: #Required (현재온도 State, RS485 Sensor 설정 참고, sensor:로 대체 가능)
      offset: 8
      length: 1
      precision: 0
    state_target: #Required (설정온도 State)
      offset: 9
      length: 1
      precision: 0
    state_off: #Required (끄기 상태)
      offset: 7
      data: [0x04]
    state_heat: #Option (난방모드, 냉방모드: state_cool, 자동모드: state_auto)
      offset: 7
      data: [0x01]
    state_away: #Option (외출모드)
      offset: 7
      data: [0x07]
    command_off: #Required (끄기 명령)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x11, 0x04, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x11, 0x04, 0x04]
    command_heat: #Option (난방모드 켜기)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x11, 0x01, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x11, 0x01, 0x01]
    command_away: #Option (외출 켜기)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x11, 0x07, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x11, 0x07, 0x07]
    command_temperature: !lambda |-  #Required (온도 조절)
      // @param: const float x
      return {
                {0x0B, 0x01, 0x18, 0x02, 0x46, 0x11, (uint8_t)x, 0x00},
                {0x0D, 0x01, 0x18, 0x04, 0x46, 0x11, (uint8_t)x, 0x01}
             };
             
#    command_state: [0x0B, 0x01, 0x18, 0x01, 0x46, 0x11, 0x00, 0x00] #Option
#    update_interval: 701s #Option(default: 60s)
 #0xF7, 0x0B, 0x01, 0x18, 0x01, 0x46, 0x10, 0x00, 0x00, 0xB2, 0xEE
 #0xF7, 0x22, 0x01, 0x18, 0x04, 0x46, 0x10, 0x00, 0x01, 0x15, 0x15, 0x01, 0x15, 0x16, 0x04, 0x13, 0x17, 0x04, 0x16, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0


  # [안방] 0x12
  # (현재온도 외부 센서 사용 샘플)
  - platform: rs485
    name: "Bedroom Heater"
    visual:
      min_temperature: 10 °C
      max_temperature: 40 °C
      temperature_step: 1 °C
    device: [0x22, 0x01, 0x18, 0x04, 0x46, 0x10, 0x00]
    state_current: #Required (현재온도 State, RS485 Sensor 설정 참고, sensor:로 대체 가능)
      offset: 11
      length: 1
      precision: 0
    state_target:
      offset: 12
      length: 1
      precision: 0
    state_off:
      offset: 10
      data: [0x04]
    state_heat:
      offset: 10
      data: [0x01]
    state_away:
      offset: 10
      data: [0x07]
    command_off: #Required (끄기 명령)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x12, 0x04, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x12, 0x04, 0x04]
    command_heat: #Option (난방모드 켜기)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x12, 0x01, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x12, 0x01, 0x01]
    command_away: #Option (외출 켜기)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x12, 0x07, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x12, 0x07, 0x07]
    command_temperature: !lambda |-  #Required (온도 조절)
      // @param: const float x
      return {
                {0x0B, 0x01, 0x18, 0x02, 0x46, 0x12, (uint8_t)x, 0x00},
                {0x0D, 0x01, 0x18, 0x04, 0x46, 0x12, (uint8_t)x, 0x01}
             };
#    command_state: [0x0B, 0x01, 0x18, 0x01, 0x46, 0x12, 0x00, 0x00] #Option
#    update_interval: 709s #Option(default: 60s)

  # [작은방] 0x14
  - platform: rs485
    name: "Room3 Heater"
    visual:
      min_temperature: 10 °C
      max_temperature: 40 °C
      temperature_step: 1 °C
    device: [0x22, 0x01, 0x18, 0x04, 0x46, 0x10, 0x00]
    state_current: #Required (현재온도 State, RS485 Sensor 설정 참고, sensor:로 대체 가능)
      offset: 14
      length: 1
      precision: 0
    state_target:
      offset: 15
      length: 1
      precision: 0
    state_off:
      offset: 13
      data: [0x04]
    state_heat:
      offset: 13
      data: [0x01]
    state_away:
      offset: 13
      data: [0x07]
    command_off: #Required (끄기 명령)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x13, 0x04, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x13, 0x04, 0x04]
    command_heat: #Option (난방모드 켜기)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x13, 0x01, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x13, 0x01, 0x01]
    command_away: #Option (외출 켜기)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x13, 0x07, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x13, 0x07, 0x07]
    command_temperature: !lambda |-  #Required (온도 조절)
      // @param: const float x
      return {
                {0x0B, 0x01, 0x18, 0x02, 0x46, 0x13, (uint8_t)x, 0x00},
                {0x0D, 0x01, 0x18, 0x04, 0x46, 0x13, (uint8_t)x, 0x01}
             };
#    command_state: [0x0B, 0x01, 0x18, 0x01, 0x46, 0x13, 0x00, 0x00] #Option
#    update_interval: 719s #Option(default: 60s)

  # [컴퓨터방] 0x13
  - platform: rs485
    name: "Computer Room Heater"
    visual:
      min_temperature: 10 °C
      max_temperature: 40 °C
      temperature_step: 1 °C
    device: [0x22, 0x01, 0x18, 0x04, 0x46, 0x10, 0x00]
    state_current:
      offset: 17
      length: 1
      precision: 0
    state_target:
      offset: 18
      length: 1
      precision: 0
    state_off:
      offset: 16
      data: [0x04]
    state_heat:
      offset: 16
      data: [0x01]
    state_away:
      offset: 16
      data: [0x07]
    command_off: #Required (끄기 명령)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x14, 0x04, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x14, 0x04, 0x04]
    command_heat: #Option (난방모드 켜기)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x14, 0x01, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x14, 0x01, 0x01]
    command_away: #Option (외출 켜기)
      data: [0x0B, 0x01, 0x18, 0x02, 0x46, 0x14, 0x07, 0x00]
      ack: [0x0D, 0x01, 0x18, 0x04, 0x46, 0x14, 0x07, 0x07]
    command_temperature: !lambda |-  #Required (온도 조절)
      // @param: const float x
      return {
                {0x0B, 0x01, 0x18, 0x02, 0x45, 0x14, (uint8_t)x, 0x00},
                {0x0D, 0x01, 0x18, 0x04, 0x45, 0x14, (uint8_t)x, 0x01}
             };
#    command_state: [0x0B, 0x01, 0x18, 0x01, 0x46, 0x14, 0x00, 0x00] #Option
#    update_interval: 727s #Option(default: 60s)
반응형