geoffdavis / esphome-mitsubishiheatpump

ESPHome Climate Component for Mitsubishi Heatpumps using direct serial connection
BSD 2-Clause "Simplified" License
583 stars 156 forks source link

Fix esphome v1.19 changes #38

Closed bulletmark closed 3 years ago

bulletmark commented 3 years ago

Addresses issue #37.

fwestenberg commented 3 years ago

Looks like the change I need too. I'm working on another climate integration which I also had to solve this way.

fwestenberg commented 3 years ago

What am I missing here? I changed the yaml:

external_components:
# - source: github://geoffdavis/esphome-mitsubishiheatpump
  - source: 
      type: git
      url: https://github.com/bulletmark/esphome-mitsubishiheatpump
      ref: esphome1.19

deleted the generated folder and also cleaned up the build and recompiled. But still this error in the log:

  File "/usr/local/lib/python3.8/site-packages/aioesphomeapi/model.py", line 245, in _convert_climate_modes
    return [ClimateMode(val) for val in value]
  File "/usr/local/lib/python3.8/site-packages/aioesphomeapi/model.py", line 245, in <listcomp>
    return [ClimateMode(val) for val in value]
  File "/usr/local/lib/python3.8/enum.py", line 339, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.8/enum.py", line 662, in __new__
    raise ve_exc
ValueError: 6 is not a valid ClimateMode

The folder .esphome/external_components just contains this library with the changes mentioned here.

bulletmark commented 3 years ago

@fwestenberg try this: - source: github://bulletmark/esphome-mitsubishiheatpump@esphome1.19

fwestenberg commented 3 years ago

Already tried that. It's documented here that your format is an "equivalent shorthand for GitHub". Also I can confirm your library is loaded to the external_components folder (no other folders present here).

Also the HEAD file in the .git folder contains: ref: refs/heads/esphome1.19

bulletmark commented 3 years ago

Well I was building mine from local source but I just changed the source line to as I specified, cleaned everything out, rebuilt and uploaded to prove all ok. So not sure what is going on with you.

fwestenberg commented 3 years ago

Here is my YAML file:

substitutions:
  devicename: airconditioning
  upper_devicename: Airconditioning
  name: airconditioning
  friendly_name: Airconditioning

esphome:
  name: $devicename
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  use_address: airconditioning.local
  ap:
    ssid: "${devicename} Fallback"
    password: !secret esphome_fallback_password

captive_portal:
api:
ota:
logger:
  baud_rate: 0

external_components:
  - source: components

climate:
  - platform: mitsubishi_heatpump
    name: "${friendly_name}"
    hardware_uart: UART0
    baud_rate: 2400
    supports:
      mode: [AUTO, COOL, HEAT, FAN_ONLY]
      fan_mode: [AUTO, LOW, MEDIUM, HIGH]
    visual:
      min_temperature: 16
      max_temperature: 31
      temperature_step: 0.5

I downloaded the branch, enzipped "esphome-mitsubishiheatpump-esphome1.19.zip" and moved the content to the esphome folder like this:

image

Removed the folder "airconditioning" (generated when you hit the build button). But still the same result!

fwestenberg commented 3 years ago

It shows up if I edit this line in my YAML:

    supports:
      mode: [HEAT_COOL, COOL, HEAT, FAN_ONLY]

After also changing the baud rate to 2400 I can confim it's working.

bulletmark commented 3 years ago

Sorry, I did not realise you had an explicit "supports" line in your config and thought you were just using the default, as I am. Yes, clearly mode "AUTO" must be changed to "HEAT_COOL". That is the point of this PR change.

fwestenberg commented 3 years ago

I find it confusing the Esphome documentation still describes AUTO. https://esphome.io/components/climate/index.html

bulletmark commented 3 years ago

@fwestenberg read jesserockz's comment on the issue I first referred to here.

geoffdavis commented 3 years ago

Thanks for the changes, @bulletmark

And thanks for the review @jesserockz