I have successfully got a Midea air con unit connected with the ESPHome and have the web server running on it. I can access the web page and control the device. I can submit GET requests and obtain the temperature back but how do I find out what the other endpoints are? I’ve read the api documentation and looked at my config but am struggling to figure out what the url structure is. I would also like to send POST requests but again can’t work out what the url structure should be.
Get request working
Webserver running
YAML config file for Air Con
substitutions:
node_name: ac2 # Use a unique name.
node_id: mideaac2 # Use a unique id.
friendly_node_name: "Midea AC 2"
esphome:
name: ${node_name}
platform: ESP8266
board: esp01_1m
compile_process_limit: 1
wifi:
ssid: "redacted"
password: "redacted"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Ac2 Fallback Hotspot"
password: "redacted"
captive_portal:
# Enable Home Assistant API
api:
encryption:
key: "redacted"
ota:
password: "redacted"
# Disable logging over UART
logger:
baud_rate: 0
uart:
tx_pin: 1
rx_pin: 3
baud_rate: 9600
# Optional, Enable Web server; start internal webserver so it can be used stand-alone
web_server:
port: 80
# Optional, Sync time with Home Assistant.
time:
- platform: homeassistant
id: ${node_id}_homeassistant_time
# Binary Sensors.
binary_sensor:
- platform: status
name: ${friendly_node_name} Connection Status
id: ${node_id}_connection_status
# Sensors.
sensor:
- platform: uptime
name: Uptime Sensor
id: ${node_id}_uptime_sensor
icon: mdi:clock-start
update_interval: 60s
- platform: wifi_signal
name: ${friendly_node_name} WiFi Signal
id: ${node_id}_wifi_signal
update_interval: 60s
- 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;
# Text Sensors.
text_sensor:
- platform: version
name: ${friendly_node_name} ESPHome Version
id: ${node_id}_esphome_version
- platform: wifi_info
ip_address:
name: ${friendly_node_name} IP Address
id: ${node_id}_ip_address
icon: mdi:ip-network
# 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();
# Switches.
switch:
- platform: restart
name: ${friendly_node_name} Restart
id: ${node_id}_restart
icon: "mdi:restart"
- platform: shutdown
name: ${friendly_node_name} Shutdown
id: ${node_id}_shutdown
- platform: safe_mode
name: ${friendly_node_name} Restart (Safe Mode)"
id: ${node_id}_safe_mode
- platform: template
name: ${friendly_node_name} Beeper
icon: mdi:volume-source
id: ${node_id}_beeper
restore_mode: "RESTORE_DEFAULT_OFF"
optimistic: true
turn_on_action:
midea_ac.beeper_on:
turn_off_action:
midea_ac.beeper_off:
climate:
- platform: midea
id: ${node_id}_my_climate # Use a unique id
name: ${node_name} # Use a unique name
# All capabilities in the section below are detected when autoconf = true:
supported_modes:
- FAN_ONLY
- HEAT_COOL
- COOL
- HEAT
- DRY
custom_fan_modes:
- SILENT
- TURBO
supported_presets: # All capabilities in this section detected by autoconf.
- ECO
- BOOST
- SLEEP
custom_presets: # All capabilities in this section detected by autoconf.
- FREEZE_PROTECTION
supported_swing_modes:
- VERTICAL
- HORIZONTAL
- BOTH
outdoor_temperature: # Optional. Create outdoor unit temperature sensor (may display incorrect values after long inactivity).
name: "Temp"
power_usage: # Optional. Create power usage sensor (only for devices that support this feature).
name: "Power"
humidity_setpoint: # Optional. Create indoor humidity sensor.
name: "Humidity"