Coder Social home page Coder Social logo

haier_ir_ac's Introduction

参考

使用方法:

remote_base 需要到 https://github.com/esphome/esphome/releases 下载对应的版本esphome-2024.5.3/esphome/components/remote_base

  1. 将external_components/haier_ir 目录拷贝到 /homeassistant/esphome/external_components/
  2. 拷贝external_components/remote_base/haier_protocol.h和haier_protocol.cpp 拷贝到 /config/esphome/external_components/remote_base/
  3. 将external_components/remote_base/init.py 里面注释是 Haier 的部分复制过去

init.py:

# Haier
HaierData, HaierBinarySensor, HaierTrigger, HaierAction, HaierDumper = declare_protocol(
    "Haier"
)
HaierAction = ns.class_("HaierAction", RemoteTransmitterActionBase)
HAIER_SCHEMA = cv.Schema(
    {
        cv.Required(CONF_CODE): cv.templatable(
            cv.All(
                [cv.Any(cv.hex_uint8_t, cv.uint8_t)],
                cv.Length(min=5, max=5),
            )
        ),
    }
)


@register_binary_sensor("haier", HaierBinarySensor, HAIER_SCHEMA)
def haier_binary_sensor(var, config):
    cg.add(var.set_code(config[CONF_CODE]))


@register_trigger("haier", HaierTrigger, HaierData)
def haier_trigger(var, config):
    pass


@register_dumper("haier", HaierDumper)
def haier_dumper(var, config):
    pass


@register_action(
    "haier",
    HaierAction,
    HAIER_SCHEMA,
)
async def haier_action(var, config, args):
    code_ = config[CONF_CODE]
    if cg.is_template(code_):
        template_ = await cg.templatable(code_, args, cg.std_vector.template(cg.uint8))
        cg.add(var.set_code_template(template_))
    else:
        cg.add(var.set_code_static(code_))

esphome:

sensor:
  - platform: homeassistant
    id: ac_temperature
    entity_id: sensor.living_room_temperature

remote_receiver:
  id: rr1
  pin:
    number: 25
    inverted: True
  dump: raw

remote_transmitter:
  pin: 26
  carrier_duty_percent: 50%

external_components:
  - source:
      type: local
      path: external_components
    components: [ remote_base, haier_ir ]

climate:
  - platform: haier_ir
    name: "Living Room AC"
    sensor: ac_temperature
    receiver_id: rr1

haier_ir_ac's People

Contributors

julen8 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.