Coder Social home page Coder Social logo

esphome_gree_ac_turbo's Introduction

Control Gree AC using ESPHome and IRremoteESP8266 - EXAMPLE

IR remote - Avatto S06, Geeklink IR Bridge

  • Create file "gree_ir.h" in folder "config\esphome\gree", where "config" is HA configuration folder.
  • Set remote transmitter pin const uint16_t kIrLed = 14;
  • Edit your ".yaml" file like "ir_bedroom.yaml".

UART:

  • port 3v3 of the device to the 3v3 of the converter.
  • port TXD of the device to the RXD of the converter.
  • port RXD of the device to the TXD of the converter.
  • port GND of the device to the GND of the converter.
  • port IO0 of the device to the GND of the converter.

Flash using ESPHome-Flasher https://github.com/esphome/esphome-flasher/releases. First flash with UART, other flashes on air.

Result:

Bedroom AC

Service esphome.ir_bedroom_set_data - set all data to AC with one 'beep':

- service: esphome.ir_bedroom_set_data
  data:
    hvac: 'cool'
    temp: 22
    fan: 'auto'
    swing: 'off'
    light: True

Service esphome.ir_bedroom_set_current_tempareture - set current temperature from external temperature sensor:

automation:
  - alias: "Bedroom AC current temp"
    trigger:
      - platform: state
        entity_id: sensor.bedroom_temperature
    mode: queued
    action:
      - service: esphome.ir_bedroom_set_current_tempareture
        data:
          temp: >-
            {{ states('sensor.bedroom_temperature') | float }}

Switch switch.bedroom_ac_light - current AC light switch.

Remember and sync states after node restart

Add to HA configuration an input_number to store the target temperature:

input_number:
  status_climate_bedroom_temp:
    min: 0
    max: 50

Add to HA configuration a few input_text to store operation mode, fan mode, swing mode:

input_text:
  status_climate_bedroom_hvac:
  status_climate_bedroom_fan:
  status_climate_bedroom_swing:

Use automations to sync climate states with the statuses:

automation:
- id: sync_climate_bedroom_hvac
  alias: Sync Climate Bedroom HVAC mode
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: climate.bedroom_ac
  condition:
    condition: not
    conditions:
      - condition: state
        entity_id: climate.bedroom_ac
        state: "unavailable"
  action:
    - service: input_text.set_value
      target:
        entity_id: input_text.status_climate_bedroom_hvac
      data:
        value: "{{ states('climate.bedroom_ac') }}"

- id: sync_climate_bedroom_fan
  alias: Sync Climate Bedroom Fan
  trigger:
    - platform: state
      entity_id: climate.bedroom_ac
      attribute: fan_mode
  condition:
    condition: not
    conditions:
      - condition: state
        entity_id: climate.bedroom_ac
        attribute: fan_mode
        state: 'on'
  action:
    - service: input_text.set_value
      target:
        entity_id: input_text.status_climate_bedroom_fan
      data:
        value: "{{ state_attr('climate.bedroom_ac','fan_mode') }}"

- id: sync_climate_bedroom_swing
  alias: Sync Climate Bedroom Swing
  trigger:
    - platform: state
      entity_id: climate.bedroom_ac
      attribute: swing_mode
  action:
    - service: input_text.set_value
      target:
        entity_id: input_text.status_climate_bedroom_swing
      data:
        value: "{{ state_attr('climate.bedroom_ac','swing_mode') }}"

- id: sync_climate_bedroom_temp
  alias: Sync Climate Bedroom Temp
  trigger:
    - platform: state
      entity_id: climate.bedroom_ac
      attribute: temperature
  condition:
    condition: not
    conditions:
      - condition: state
        entity_id: climate.bedroom
        attribute: temperature
        state: 0
  action:
    - service: input_number.set_value
      target:
        entity_id: input_number.status_climate_bedroom_temp
      data:
        value: "{{ state_attr('climate.bedroom_ac','temperature') }}"



- id: sync_climate_bedroom_irblaster
  alias: Sync Climate Bedroom back to IR Blaster
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: climate.bedroom_ac
    from: 'unavailable'
  action:
    - service: esphome.ir_bedroom_set_data
      data:
        temp: "{{ states('input_number.status_climate_bedroom_temp') }}"
        hvac: "{{ states('input_text.status_climate_bedroom_hvac') }}"
        fan: "{{ states('input_text.status_climate_bedroom_fan') }}"
        swing: "{{ states('input_text.status_climate_bedroom_swing') }}"
        light: "{{ false if is_state('input_text.status_climate_bedroom_hvac', 'off') else true }}"

esphome_gree_ac_turbo's People

Contributors

hagakurje avatar maretodoric avatar nagyrobi 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.