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

how to set control over fan speed from web server? #138

Open
Grappa2020 opened this issue Feb 8, 2024 · 2 comments
Open

how to set control over fan speed from web server? #138

Grappa2020 opened this issue Feb 8, 2024 · 2 comments

Comments

@Grappa2020
Copy link

No description provided.

@BenJamesAndo
Copy link

I got it working by using code from the Midea ESPHome YAML.

sensor:
  - platform: template
    name: ${friendly_node_name} fan mode
    id: ${node_id}_fan_mode
    internal: true
    update_interval: 10s
    lambda: !lambda |-
      if (id(${node_id}_my_climate).fan_mode == 2)
      {
        if (id(${node_id}_select_fan_mode).state != "Auto")
        {
          auto call = id(${node_id}_select_fan_mode).make_call();
          call.set_option("Auto");
          call.perform();
        }
      }
      else if (id(${node_id}_my_climate).fan_mode == 3)
      {
        if (id(${node_id}_select_fan_mode).state != "Low")
        {
          auto call = id(${node_id}_select_fan_mode).make_call();
          call.set_option("Low");
          call.perform();
        }
      }
      else if (id(${node_id}_my_climate).fan_mode == 4)
      {
        if (id(${node_id}_select_fan_mode).state != "Medium")
        {
          auto call = id(${node_id}_select_fan_mode).make_call();
          call.set_option("Medium");
          call.perform();
        }
      }
      else if (id(${node_id}_my_climate).fan_mode == 5)
      {
        if (id(${node_id}_select_fan_mode).state != "High")
        {
          auto call = id(${node_id}_select_fan_mode).make_call();
          call.set_option("High");
          call.perform();
        }
      }
      return id(${node_id}_my_climate).fan_mode;


# Select
select:
  - platform: template
    name: "Fan mode"
    id: ${node_id}_select_fan_mode
    icon: mdi:fan
    optimistic: true
    options:
      - Auto
      - Low
      - Medium
      - High
    on_value:
      then:
        - lambda: |-
            auto call = id(${node_id}_my_climate).make_call();
            call.set_fan_mode(x.c_str());
            call.perform();

I need to tidy it up first as I had to also add/change the following to get it to work.

substitutions:
  node_name: mideahvac # Use a unique name.
  node_id: midea_ac    # Use a unique id.
  friendly_node_name: "Midea AC"
climate:
    id: ${node_id}_my_climate   # Use a unique id
    name: ${node_name}  

@RikBast
Copy link

RikBast commented Feb 25, 2024

I tried this, but no luck. A whole lot of messages when flashing to the board. There is no error in the config.
but running the flash generates this error:

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/cu.usbserial-02M3J84W with baud rate 115200
[19:29:41][I][logger:351]: Log initialized
[19:29:41][C][ota:473]: There have been 0 suspected unsuccessful boot attempts.
[19:29:41][D][esp32.preferences:114]: Saving 1 preferences to flash...
[19:29:41][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[19:29:41][D][MitsubishiHeatPump:620]: Ping request received
[19:29:41][I][app:029]: Running through setup()...
[19:29:41][D][template.select:014]: Setting up Template Select
[19:29:41][D][template.select:017]: State from initial: Auto
[19:29:41][D][select:015]: 'Fan mode': Sending state Auto (index 0)
[19:29:41][D][climate:011]: 'mideahvac' - Setting
[19:29:41][D][climate:024]: Fan: AUTO
[19:29:41]Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
[19:29:41]
[19:29:41]Core 1 register dump:
[19:29:41]PC : 0x400f0835 PS : 0x00060e30 A0 : 0x800f08b9 A1 : 0x3ffb2220
WARNING Decoded 0x400f0835: HeatPump::lookupByteMapIndex(char const**, int, char const*) at /Users/rikbastiaens/Documents/ESPHome/.esphome/build/mitsubishi-slaapkamer/.piolibdeps/mitsubishi-slaapkamer/HeatPump/src/HeatPump.cpp:455
[19:29:41]A2 : 0x00000000 A3 : 0x9f31c0cd A4 : 0x00000006 A5 : 0x3f408a76
[19:29:41]A6 : 0x00000000 A7 : 0x00000000 A8 : 0x9f31c0cd A9 : 0x3ffb21a0
[19:29:41]A10 : 0x0003ad10 A11 : 0x00000028 A12 : 0x0000006d A13 : 0x00000028
[19:29:41]A14 : 0x3f4035ca A15 : 0x00000010 SAR : 0x00000004 EXCCAUSE: 0x0000001c
[19:29:41]EXCVADDR: 0x9f31c0cd LBEG : 0x40089965 LEND : 0x40089975 LCOUNT : 0xfffffff5
[19:29:41]
[19:29:41]
[19:29:41]Backtrace:0x400f0832:0x3ffb22200x400f08b6:0x3ffb2240 0x400dc681:0x3ffb2260 0x400dc76c:0x3ffb2280 0x400d9e51:0x3ffb22a0 0x400e7e0b:0x3ffb22c0 0x400e7984:0x3ffb2380 0x400e7889:0x3ffb23c0 0x400e7830:0x3ffb2420 0x400de6bc:0x3ffb24b0 0x400df571:0x3ffb2530 0x400df5b6:0x3ffb2590 0x400e63c4:0x3ffb25b0 0x4017019d:0x3ffb25d0 0x400e5fe4:0x3ffb25f0 0x400e8a7a:0x3ffb2620 0x400f3ada:0x3ffb2820

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

3 participants