Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[haier] text_sensor and button platforms #6780

Merged
merged 10 commits into from
May 23, 2024
Merged

[haier] text_sensor and button platforms #6780

merged 10 commits into from
May 23, 2024

Conversation

paveldn
Copy link
Contributor

@paveldn paveldn commented May 20, 2024

What does this implement/fix?

Multiple changes for Haier climate integration:

  • New component text_sensor added for Haier integration (cleaning status, protocol version, appliance name) (hOn protocol only)
  • New component button added for Haier integration (start self-cleaning, start steri cleaning) (hOn protocol only)
  • New version of HaierProtocol library used
  • Saving and restoring the last selected position of wind direction for non-swing mode
  • For VerticalAirflowAction and HorizontalAirflowAction proxy enum removed and haier protocol values used (hOn protocol only, breaking change)
  • Performance improvements to reduce latency

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#3851

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx

Example entry for config.yaml:

# Example config.yaml
uart:
  - id: uart_haier
    tx_pin: 17
    rx_pin: 16
    baud_rate: 9600

climate:
  - platform: haier
    id: haier_ac
    protocol: hOn
    name: Haier AC
    wifi_signal: true
    answer_timeout: 200ms
    beeper: true
    visual:
      min_temperature: 16 °C
      max_temperature: 30 °C
      temperature_step:
        target_temperature: 1
        current_temperature: 0.5
    supported_modes:
      - 'OFF'
      - HEAT_COOL
      - COOL
      - HEAT
      - DRY
      - FAN_ONLY
    supported_swing_modes:
      - 'OFF'
      - VERTICAL
      - HORIZONTAL
      - BOTH
    supported_presets:
      - AWAY
      - BOOST
      - ECO
      - SLEEP
    on_alarm_start:
      then:
        - logger.log:
            level: DEBUG
            format: "Alarm activated. Code: %d. Message: \"%s\""
            args: [code, message]
    on_alarm_end:
      then:
        - logger.log:
            level: DEBUG
            format: "Alarm deactivated. Code: %d. Message: \"%s\""
            args: [code, message]

sensor:
  - platform: haier
    haier_id: haier_ac
    outdoor_temperature:
      name: Haier outdoor temperature
    humidity:
      name: Haier Indoor Humidity
    compressor_current:
      name: Haier Compressor Current
    compressor_frequency:
      name: Haier Compressor Frequency
    expansion_valve_open_degree:
      name: Haier Expansion Valve Open Degree
    indoor_coil_temperature:
      name: Haier Indoor Coil Temperature
    outdoor_coil_temperature:
      name: Haier Outdoor Coil Temperature
    outdoor_defrost_temperature:
      name: Haier Outdoor Defrost Temperature
    outdoor_in_air_temperature:
      name: Haier Outdoor In Air Temperature
    outdoor_out_air_temperature:
      name: Haier Outdoor Out Air Temperature
    power:
      name: Haier Power

binary_sensor:
  - platform: haier
    haier_id: haier_ac
    compressor_status:
      name: Haier Outdoor Compressor Status
    defrost_status:
      name: Haier Defrost Status
    four_way_valve_status:
      name: Haier Four Way Valve Status
    indoor_electric_heating_status:
      name: Haier Indoor Electric Heating Status
    indoor_fan_status:
      name: Haier Indoor Fan Status
    outdoor_fan_status:
      name: Haier Outdoor Fan Status

button:
  - platform: haier
    haier_id: haier_ac
    self_cleaning:
      name: Haier start self cleaning
    steri_cleaning:
      name: Haier start 56°C steri-cleaning

text_sensor:
  - platform: haier
    haier_id: haier_ac
    appliance_name:
      name: Haier appliance name
    cleaning_status:
      name: Haier cleaning status
    protocol_version:
      name: Haier protocol version

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@probot-esphome
Copy link

Hey there @paveldn,
Thanks for submitting this pull request! Can you add yourself as a codeowner for this integration? This way we can notify you if a bug report for this integration is reported.
In __init__.py of the integration, please add:

CODEOWNERS = ["@paveldn"]

And run script/build_codeowners.py

(message by NeedsCodeownersLabel)

@paveldn paveldn marked this pull request as draft May 20, 2024 05:03
@codecov-commenter
Copy link

codecov-commenter commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.13%. Comparing base (4d8b5ed) to head (fd644c6).
Report is 659 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #6780      +/-   ##
==========================================
+ Coverage   53.70%   54.13%   +0.42%     
==========================================
  Files          50       50              
  Lines        9408     9619     +211     
  Branches     1654     1698      +44     
==========================================
+ Hits         5053     5207     +154     
- Misses       4056     4086      +30     
- Partials      299      326      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@paveldn paveldn marked this pull request as ready for review May 20, 2024 09:32
@jesserockz jesserockz changed the title tesxt_sensor and button components added for Haier integration [haier] text_sensor and button platforms May 22, 2024
@jesserockz jesserockz changed the title [haier] text_sensor and button platforms [haier] text_sensor and button platforms May 22, 2024
esphome/components/haier/climate.py Show resolved Hide resolved
esphome/components/haier/haier_base.cpp Outdated Show resolved Hide resolved
@esphome esphome bot marked this pull request as draft May 22, 2024 01:47
@esphome
Copy link

esphome bot commented May 22, 2024

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@paveldn paveldn marked this pull request as ready for review May 22, 2024 09:22
@esphome esphome bot requested a review from jesserockz May 22, 2024 09:22
@jesserockz jesserockz merged commit aed0593 into esphome:dev May 23, 2024
65 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants