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

Missing vertical (and horizontal in general) swing mode steps #33

Open
staxDB opened this issue Jun 10, 2021 · 40 comments
Open

Missing vertical (and horizontal in general) swing mode steps #33

staxDB opened this issue Jun 10, 2021 · 40 comments

Comments

@staxDB
Copy link

staxDB commented Jun 10, 2021

Hey there,

thank you so much for the great integration in Home Assistant!
Currently I‘m missing the option to set the fan swing modes of my heatpump.
Mine currently supports a vertical and a horizontal direction in different steps. As I found in the original source code, there are options to customize these kind of settings:

heatpumpSettings settings = {
    "ON",  /* ON/OFF */
    "FAN", /* HEAT/COOL/FAN/DRY/AUTO */
    26,    /* Between 16 and 31 */
    "4",   /* Fan speed: 1-4, AUTO, or QUIET */
    "3",   /* Air direction (vertical): 1-5, SWING, or AUTO —> how to set these in HA? */
    "|"    /* Air direction (horizontal): <<, <, |, >, >>, <>, or SWING  —> how to set these in HA? */
}; 

As far as I understand, I‘m currently only able to set this setting: swing_mode: [OFF, VERTICAL]

Is there a way to integrate these settings via HA?

@geoffdavis
Copy link
Owner

You'll want to fiddle around with the advanced options that were recently added in the 2.x release.

In particular:

  • supports (Optional): Supported features for the device.
    • mode (Optional, list): Supported climate modes for the HeatPump. Default: ['AUTO', 'COOL', 'HEAT', 'DRY', 'FAN_ONLY']
    • fan_mode (Optional, list): Supported fan speeds for the HeatPump. Default: ['AUTO', 'DIFFUSE', 'LOW', 'MEDIUM', 'MIDDLE', 'HIGH']
    • swing_mode (Optional, list): Supported fan swing modes. Most Mitsubishi units only support the default. Default: ['OFF', 'VERTICAL']

@geoffdavis
Copy link
Owner

After digging around in the code for this component, and ESPHome's climate component code, there's no way in Esphome to get granular on the horizontal vane position. There is a way however to say you want either horizontal swing, vertical swing, or both swing, but the HORIZONTAL and BOTH modes [aren't currently supported] (https://github.com/geoffdavis/esphome-mitsubishiheatpump/blob/master/components/mitsubishi_heatpump/espmhp.cpp#L222) in this custom component.

I'm happy to try and add support for HORIZONTAL and BOTH, but I have no way to test it as my equipment doesn't support it.

@geoffdavis
Copy link
Owner

Further research shows that the esphome protocol doesn't support sending custom climate modes to home assistant either, per https://github.com/esphome/esphome/blob/dev/esphome/components/api/api.proto

Any fine-grained swing mode control will require multiple changes in at least the ESPHome code base in order to support either custom swing modes or separate horizontal and vertical swing modes.

@wavswavs
Copy link

wavswavs commented Jul 6, 2021

After digging around in the code for this component, and ESPHome's climate component code, there's no way in Esphome to get granular on the horizontal vane position. There is a way however to say you want either horizontal swing, vertical swing, or both swing, but the HORIZONTAL and BOTH modes [aren't currently supported] (https://github.com/geoffdavis/esphome-mitsubishiheatpump/blob/master/components/mitsubishi_heatpump/espmhp.cpp#L222) in this custom component.

I'm happy to try and add support for HORIZONTAL and BOTH, but I have no way to test it as my equipment doesn't support it.

Hi,
I'm using your integration in four devices, two of them (MSZ-AP35VG wall unit) supports HORIZONTAL, VERTICAL and BOTH modes.
If you add HORIZONTAL and BOTH support I could test it.

I also have an MFZ-KT25VG floor unit with a differet vane behaviour that could be tested.

Do you know how ask esphome dev team to add granular vane position? Could be possible to add some positions in a separate switch?

Great job!

@F43RY
Copy link

F43RY commented Jul 7, 2021

Hi,
I tried to patch core climate esphome in order to add horizontal and vertical position controls. I can't test the code. If someone is intrested and want check can have a look at this issue in esphome github project
esphome#1968

@WeekendWarrior1
Copy link

If esphome/esphome#1998 gets merged then there will be an easy template for your codebase to do this, with esphome/esphome@531f5f7, climate_ir.h will have a function to set supported swing modes.
The Pansonic climate currently has them as yaml options eg:

climate:
  - platform: panasonic
    name: "Lounge AC"
    supports_horizontal_swing: true

@wavswavs
Copy link

Hi,
I tried to patch core climate esphome in order to add horizontal and vertical position controls. I can't test the code. If someone is intrested and want check can have a look at this issue in esphome github project
esphome#1968

I don't know how to test with a development version of esphome. Also, I think that we need the code in this library too in order to can test hvac with esphome, right?

@jhuizingh
Copy link

I have equipment that would work with the vane positions and I am interested in getting this feature implemented. It's been a while since this discussion happened. What's the current state of this? I might be able to help.

@kalosbg
Copy link

kalosbg commented Dec 1, 2021

My ac also supports horizontal and vertical swing if, you need to test something feel free to reach me.

@jhuizingh
Copy link

@kalosbg I asked about this on the developers channel on the ESPHome discord. It seems that the way that the mitsubishi units work doesn't fit in with the model of how Home Assistant (and by extension ESPHome) think about climate devices. So it's unlikely that full support will be added for our devices any time soon. I intend to make a custom controller that can be used by ESPHome that doesn't concern itself with implementing a climate device and instead is completely custom. I'll share it and post back here if I'm able to make that happen in my spare time.

@kalosbg
Copy link

kalosbg commented Dec 2, 2021 via email

@earwin
Copy link
Contributor

earwin commented Dec 2, 2021

I did not dig into HA internals yet, but Mitsubishi cloud integration somehow manages to expose horizontal/vertical vanes, see: https://www.home-assistant.io/integrations/melcloud/#climate

It does it via ... attributes? Which are apparently custom attributes (e.g. not defined by climate device class). And on a second look, climate defines very few attributes, and instead uses properties + service setters. Which is different in HA and mightily confusing! (offtopic: anybody has a link that explains the difference and motivations?)

But anyway, we can do the same and expose attributes for everything that climate misses?

@geoffdavis
Copy link
Owner

geoffdavis commented Dec 3, 2021 via email

@earwin
Copy link
Contributor

earwin commented Dec 3, 2021

Okay, I had a quick look @ ’api.proto’, and there is no attribute support whatsoever.

If we want to implement this given existing model, my vote is on spawning a secondary ’fan’ entity for horizontally-endowed units. It has these nicely fitting oscillation and position fields, and irrelevant ones can be disabled.

I may take a stab at it, but don't hold your breath, I have an attention span of a toothpick.

@cg089
Copy link

cg089 commented Dec 22, 2021

After digging around in the code for this component, and ESPHome's climate component code, there's no way in Esphome to get granular on the horizontal vane position

Hi, I also came across this issue. However, I only have vertical position.
What would be the code to use only those different vertical positions?

@cg089
Copy link

cg089 commented Dec 23, 2021

Is it because in espmhp.cpp in line 221 is commented out?
This is basically just what's missing!

//const char* VANE_MAP[7] = {"AUTO", "1", "2", "3", "4", "5", "SWING"};

@jhuizingh
Copy link

@cg089 the issue as I understand it is that the climate component in esphome can't even represent the possible states of the Mitsubishi units. See Here.

The code to do it exists in the library that interacts with the heat pump units, so that part isn't particularly hard. It's just representing it within esphome in a way that isn't completely counterintuitive that is the challenge.

@cg089
Copy link

cg089 commented Dec 24, 2021

@cg089 the issue as I understand it is that the climate component in esphome can't even represent the possible states of the Mitsubishi units. See Here.

No, I don't think so. I am experimenting with two Mitsubishi AC. Both are integrated in Home Assistant climate, one with this esphome here and the other with mqtt (via https://github.com/gysmo38/mitsubishi2MQTT ).

While the mqtt climate is able to set all vertical positions:
image

the esphome component only shows "Off" and "Vertical".
image

The dropdown field however allows for more options to show in Home Assistant.

Edit: Got you, I was reading climate component in home assistant, not in esphome.
One workaround to use esphome and submit all possible fields would maybe then not using the esphome climate component, but also mqtt and integrate it not via the esphome api to home assistant, but via mqtt. This would at least have the advantage to have the device flashed with esphome already and make an ota update once the climate component in esphome is ready.

@jhuizingh
Copy link

jhuizingh commented Dec 24, 2021

Right, that's exactly what I'm saying. It's entirely possible to control the devices fully with the c++ library that is being used under the covers of this extension. The issue is that esphome has a generic device category called "climate" which is what this package is using.

The climate device type has generic options which they hoped would cover all possible climate devices that people would want to integrate into esphome. Clearly the "off" and "vertical" swing mode options don't cover the 1-5 and auto and swing plus some horizontal choices too that Mitsubishi units need to fully cover the bases. They are unlikely to add additional options into the climate device type because then they'd have to add more for every single other device that also doesn't fit, and it would start to look crazy.

The choices for us are either to be limited to the options within the climate device type, or represent the options that don't fit in a different way.

Here's the discussion in the esphome discord where I was told that they are unlikely to modify the esphome climate component to have all the Mitsubishi options:

https://discord.com/channels/429907082951524364/912376829954891786/912379328350806066

@jamescadd
Copy link

Would a standalone sensor/entity at least expose the functionality? I'd be fine with some jank in the UI just to have the setting available, like a separate drop-down to choose the value.

@cg089
Copy link

cg089 commented Dec 29, 2021

Would a standalone sensor/entity at least expose the functionality? I'd be fine with some jank in the UI just to have the setting available, like a separate drop-down to choose the value.

Yes, I think that would be the only "workaround", which would be sufficent and better than nothing.

@scootec
Copy link

scootec commented Jan 11, 2022

We could use the newish select entity in Home Assistant and ESPHome to make those options available.

@geoffdavis
Copy link
Owner

We could use the newish select entity in Home Assistant and ESPHome to make those options available.

Probably worth a shot. It seems a bit cleaner than using the method described in the stepper motor documentation for esphome.

@jcam
Copy link

jcam commented Jul 27, 2022

As an interim solution, I used swing "vertical" for position 5, "horizontal" for position 2, and "both" for vertical swing.

This doesn't solve the problem of controlling the horizontal position, but at least gives me the two positions i typically use, and I so rarely adjust the horizontal position that I don't mind pulling a remote out of the drawer for that.
jcam@8e4ef6d

In that same branch I also overrode the fan speeds included for passing up to the climate object in home assistant, since there's no way to correctly set the order of the speeds and i didn't want 1, 2, 4, 3, quiet.

I then used the simple thermostat HACS custom component to rename them

image

@jamescadd
Copy link

This is awesome, I can now hack together what I want to get around HA limitations. Thanks for writing this up!

@jcam
Copy link

jcam commented Jul 27, 2022

If you or someone else wants to leverage my work, feel free!

Just update your external component in esphome like so:

external_components:
  - source: github://jcam/esphome-mitsubishiheatpump@overload-vane-names

And, set this for your lovelace card:

type: custom:simple-thermostat
entity: climate.family_room_minisplit
control:
  hvac:
    heat_cool: false
    heat: false
  fan:
    _name: Fan
    _hide_when_off: true
    low:
      name: Quiet
      icon: mdi:fan-minus
    medium:
      name: 1
      icon: mdi:fan-speed-1
    high:
      name: 2
      icon: mdi:fan-speed-2
    focus:
      name: 3
      icon: mdi:fan-speed-3
    diffuse:
      name: 4
      icon: mdi:car-turbocharger
  swing:
    _name: Angle
    _hide_when_off: true
    'off':
      name: Auto
      icon: mdi:autorenew
    vertical:
      name: Vertical
      icon: mdi:dots-vertical
    horizontal:
      name: Horizontal
      icon: mdi:dots-horizontal
    both:
      name: Swing

@mattwolkoff
Copy link

@jcam I just wanted to say thanks! this worked great for me. It's may not be ideal for flexibility, but fits my use case well(set to one position, and leave it for the season).

@jcam
Copy link

jcam commented Aug 23, 2022

Yay! Yeah with the esphome/HA climate entity we get 4 "choices", so I decided to have auto, swing, near vertical and near horizontal, as 95% of the time that's enough.
I might tweak things once we start the heating season, and might also look to add a second entity for horizontal, though i only have horizontal on one of the wall units, so not missing too much there...

@aleksanderlvr
Copy link

As an interim solution, I used swing "vertical" for position 5, "horizontal" for position 2, and "both" for vertical swing.
image

Thanks to both authors. Jesse, is there a way to change the code so that the horizontal position is at 1 and vertical at 2?

@seime
Copy link

seime commented Jun 19, 2023

I've created a PR with this missing functionality if someone would like to test; #103

@Smandurlo
Copy link

With tasmota and mqtt I can use any combination of hvac mode/fan/swing orizzontal and vertical I want. What if we use the mqtt way? Will esphome be able to use those settings from mqtt and setup the ac?

@jhuang0
Copy link

jhuang0 commented Aug 4, 2023

If you or someone else wants to leverage my work, feel free!

Just update your external component in esphome like so:

external_components:
  - source: github://jcam/esphome-mitsubishiheatpump@overload-vane-names

And, set this for your lovelace card:

type: custom:simple-thermostat
entity: climate.family_room_minisplit
control:
  hvac:
    heat_cool: false
    heat: false
  fan:
    _name: Fan
    _hide_when_off: true
    low:
      name: Quiet
      icon: mdi:fan-minus
    medium:
      name: 1
      icon: mdi:fan-speed-1
    high:
      name: 2
      icon: mdi:fan-speed-2
    focus:
      name: 3
      icon: mdi:fan-speed-3
    diffuse:
      name: 4
      icon: mdi:car-turbocharger
  swing:
    _name: Angle
    _hide_when_off: true
    'off':
      name: Auto
      icon: mdi:autorenew
    vertical:
      name: Vertical
      icon: mdi:dots-vertical
    horizontal:
      name: Horizontal
      icon: mdi:dots-horizontal
    both:
      name: Swing

@jcam - I'm literally only hours into my ESP journey so forgive me if I'm not understanding some of the intricacies here. What are your thoughts on setting the thermostat to the midpoint (3 or 4) every time the climate control is turned on? For the average user, this would in effect give an additional state in addition to the ones you've provided. The end user would then be able to override that selection (or employ an automation to select away from it.)

@SGXander
Copy link

Jumping on the bottom of this thread so sorry if I've missed an important bit but is there a list of supported options for "swing_mode:" somewhere? and did anyone manage to get vertical/horizontal vane step control working at all?

@supermarkert
Copy link

supermarkert commented Nov 20, 2023

Yeah, I kind of have the same question. I only need Vertical, but it's unclear what the individual step modes that are supported (if any). My mini-split supports Auto, 1-5, and Swing, but there doesn't seem to be any notes about what can be configured except simply ('OFF', 'VERTICAL').
What will the unit interpret that as? AUTO?

@SGXander
Copy link

I might try setting the ESPHome config swing_modes to the below and see if it works. I'd love to set the fan modes to something custom too as medium and middle are confusing my wife already :D

Output from melcloud integration for one of my splits:

hvac_modes: off, heat, dry, cool, fan_only, heat_cool
min_temp: 10
max_temp: 31
target_temp_step: 0.5
fan_modes: auto, 1, 2, 3, 4, 5
swing_modes: auto, 1_up, 2, 3, 4, 5_down, swing
vane_horizontal_positions: auto, 1_left, 2, 3, 4, 5_right, split, swing
vane_vertical_positions: auto, 1_up, 2, 3, 4, 5_down, swing
supported_features: 41

@rudizl
Copy link

rudizl commented Nov 20, 2023

I'd love to set the fan modes to something custom too as medium and middle are confusing my wife already :D

Your wife is not alone in confusion🤣 Not to mention that the gouges are the same🫤
Screenshot_20231120_230345_Home Assistant
And even worse - in my language someone has decided to translate both the same way 🤣
Screenshot_20231120_230319_Home Assistant

@jcam
Copy link

jcam commented Nov 20, 2023

My mod is still working :)

image

@SGXander
Copy link

SGXander commented Nov 21, 2023

My mod is still working :)

So forgive me for being daft but I can't see what your mod lets you do in practice? Does it allow for vertical and horizontal swings so it will swing back and forth in those directions or both when selecting swing or auto lets the device decide where to aim?
Do we still need your version or is this now in the master for this repo?

If you can explain a bit I'm hoping to mod myself to allow for the stepped vane directions and eventually switches for night mode and the pollen diffusor on my model!

@jcam
Copy link

jcam commented Nov 21, 2023

Because ESPHome + homeassistant together only allow specific things to come through, and individual controls of the vanes aren't part of that, I overloaded its use so that i can choose auto + swing modes as well as stepped vane positions 2 and 5, all on the vertical.
I also changed the names of the fan speed settings so that they are easy to understand for me and my family (quiet and 1-4... no "middle" speed)

@echavet
Copy link

echavet commented Jan 10, 2024

I've just updated my version of the esphome-mitsubishiheatpump component which is so different that I've changed the project name:
https://github.com/echavet/MitsubishiCN105ESPHome
It is not tested as the original project, but I'm currently using it with esp8266 w1 module.
It includes mitsubishi van orientations.
I've had an extraComponents which adds a select component and a compressor_freq one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests