dudanov / iot-uni-dongle

An project of universal minimalistic Wi-Fi dongle for various IOT appliances controlled via UART.
293 stars 44 forks source link

IR Commands using TSOP IR #5

Open joemadd3n opened 2 years ago

joemadd3n commented 2 years ago

Connected the TSOP IP to the signal pin of my Midea AC unit for turning off the display. I have my ESPHome configured with remote_transmitter on GPIO13 with a duty cycle of 100% however, it doesn't turn the display off. I can obviously turn the display off with the remote, confirming the functionality is there.

What's the best way to debug the issue here please? I have the longer style USB stick as pictured here: https://github.com/dudanov/iot-uni-dongle/raw/main/images/tsop_stick.jpg

basmeyer commented 2 years ago

I possibly have a similar problem. I have included the necessary part in the configuration file

remote_transmitter:
  pin: GPIO13                       # For iot-uni-stick the value needs to be GPIO13
  carrier_duty_percent: 100%        # 50% for IR LED, 100% for direct connect to TSOP IR receiver output

as well and

sensor:
  - platform: homeassistant
    name: temp_control_ac_by_external_sensor
    entity_id: sensor.external_temp_sensor   # Sensor from Home Assistant
    internal: true
    filters:
      - throttle: 10s
      - heartbeat: 30s                       # Maximum interval between updates is (default): 2min
      - debounce: 1s
    on_value:
      midea_ac.follow_me:
        temperature: !lambda "return x;"
        beeper: false                        # Optional, beep on update is: true - silence is: false

but the Follow Me functionality does not seem to get triggered unless you trigger it with the (real) IR remote controller after which it works nonetheless and temperature values of the external temp sensor are used by the Midea AC, which can be confirmed by looking at the climate entity. This is with the small USB stick and I wired IR- to the IR receiver's signal, like Sergey suggested. I am probably missing something.

burnbabyburn commented 2 years ago

Hey there,

this works for me on Simando SMND-PAC-12. Maybe this helps others with your dongle! tsop out pin ( how to find data pin on unnamed tsop

)

is connected to D2 on my NodeMCU. now the remote control can be used as temp sensor (replacing the reading from the mono block) and to c ontrol the unit. Also HA can control the device now. perfect! thanks for config_example!

_hint: you could also use platform: midea_ir, but this class does not support follow_me function. There is a_ open feature-request

esphome config:

esphome:
  name: klima01

esp8266:
  board: nodemcuv2

web_server:
  port: 80

logger:
  baud_rate: 0

# Enable Home Assistant API
api:
  password: ""

ota:
  password: ""

captive_portal:

uart:
  id: uart_bus
  tx_pin: 1
  rx_pin: 3
  baud_rate: 9600

wifi:
  ssid: "ssid"
  password: "password"
  #ERROR (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
  manual_ip:
    static_ip: 192.168.1.2
    gateway: 192.168.1.1
    subnet: 255.255.255.0
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Fallback Hotspot"
    password: "password"

# Uncomment for use button as AC power control
#binary_sensor:
#  - platform: gpio
#    id: flash_button
#    pin:
#      number: GPIO0
#      inverted: true
#    filters:
#      - delayed_on_off: 50ms
#    on_click:
#        lambda: |-
#            if (id(my_climate).mode == CLIMATE_MODE_OFF)
#              id(my_climate).do_power_on();
#            else
#              id(my_climate).do_power_off();

remote_transmitter:
  id: transmitter
  pin: GPIO13                       # For iot-uni-stick.
  carrier_duty_percent: 100%        # 50% for IR LED, 100% for direct connect to TSOP IR receiver output.

# If not defined the rc won't work anymore
remote_receiver:
  id: rcvr
  pin: 
    number: GPIO12
    inverted: true
    mode:
      input: true
      pullup: true
  dump: all

sensor:
  - platform: homeassistant
    name: follow_me_temp
    entity_id: sensor.myac   # Sensor from HASS
    internal: true
    filters:
      - throttle: 5s
      - heartbeat: 10s             # Maximum interval between updates.
      - debounce: 1s
    on_value:
      midea_ac.follow_me:
        temperature: !lambda "return x;"
        beeper: false               # Optional. Beep on update.

# template buttons for sending display control command and swing step actions
button:
  - platform: template
    name: Display Toggle
    icon: mdi:theme-light-dark
    on_press:
      midea_ac.display_toggle:
  - platform: template
    name: Swing Step
    icon: mdi:tailwind
    on_press:
      midea_ac.swing_step:

switch:
  - platform: template
    name: Beeper
    icon: mdi:volume-source
    optimistic: true
    turn_on_action:
      midea_ac.beeper_on:
    turn_off_action:
      midea_ac.beeper_off:

# Main settings
climate:
  - platform: midea
    name: Klima01        # Use a unique name.
    transmitter_id: transmitter # Optional. Add this option to use IR transmitter.
    period: 1s                  # Optional
    timeout: 2s                 # Optional
    num_attempts: 3             # Optional
    autoconf: true              # Autoconfigure most options.
    beeper: true                # Beep on commands.
    visual:                     # Optional. Example of visual settings override.
      min_temperature: 17 °C    # min: 17
      max_temperature: 30 °C    # max: 30
      temperature_step: 0.5 °C  # min: 0.5
    supported_modes:            # All capabilities in this section detected by autoconf.
      - FAN_ONLY                # This capability is always used.
      - COOL
      - HEAT_COOL
      - DRY
    custom_fan_modes:
      - SILENT
      - TURBO
    supported_presets:          # All capabilities in this section detected by autoconf.
      - ECO
      - BOOST
      - SLEEP                   # This capability is always used.
    custom_presets:             # All capabilities in this section detected by autoconf.
      - FREEZE_PROTECTION
    supported_swing_modes:
      - VERTICAL                # This capability is always used.
      - HORIZONTAL
      - BOTH
optimusprimespace commented 2 years ago

Can you use IR and UART functions at the same time (on the code side of things...i know that you can't control the AC two separate way at the same time)? Or you can use it only IR or UART? Because i want to setup sometimes the follow me temp too.

burnbabyburn commented 2 years ago

Can you use IR and UART functions at the same time (on the code side of things...i know that you can't control the AC two separate way at the same time)? Or you can use it only IR or UART? Because i want to setup sometimes the follow me temp too.

If you use a standard Nodemcu and use one pin for ir send and one for ir recieve, you can control the AC with IR remote and Homeassistant at the same time. Homeassistant also recieves info about changes made by the remote. AFAIR with the dedicated iot dongle one could use the same pin for IR send/recieve.

kuchar91 commented 1 year ago

@basmeyer

Did you solved follow me feature with Sergey dongle?

basmeyer commented 1 year ago

Hello KuChar91, yes I did, and the solution is running beautifully. I will add my config file below, maybe it helps.

mideaaircostudio.yaml.zip

Contents:

substitutions:
  device_name: "midea-airco-studio"
  device_description: "Sergey Dudanov module om Midea airco in studio te koppelen"

esphome:
  name: "${device_name}"
  comment: "${device_description}"
  platform: ESP8266
  board: esp12e

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP, matching the router's IP reservation
    static_ip: 192.168.1.19
    # Set this to the IP address of the router itself
    gateway: 192.168.1.1
    # The subnet of the network. C-class 255.255.255.0 works for most home networks
    subnet: 255.255.255.0
# ap:
#   ssid: "fallbackSSID"
#   password: "fallbackPASSWORD"

captive_portal:

api:                                # Enable Home Assistant API

ota:

logger:
  baud_rate: 0                      # Disable logging over UART (required)

uart:
  tx_pin: 1
  rx_pin: 3
  baud_rate: 9600

# Uncomment for use button as AC power control
#binary_sensor:
#  - platform: gpio
#    id: flash_button
#    pin:
#      number: GPIO0
#      inverted: true
#    filters:
#      - delayed_on_off: 50ms
#    on_click:
#        lambda: |-
#            if (id(my_climate).mode == CLIMATE_MODE_OFF)
#              id(my_climate).do_power_on();
#            else
#              id(my_climate).do_power_off();

climate:
  - platform: midea
    id: my_climate
    name: midea_airco_studio
    transmitter_id:
    period: 1s
    num_attempts: 3
    timeout: 2s
    beeper: false                   # Annoying beeps: true - silence: false
    autoconf: true
    visual:
      min_temperature: 17 °C
      max_temperature: 27 °C
      temperature_step: 0.5 °C
#    supported_modes:
#      - FAN_ONLY
#      - HEAT_COOL
#      - COOL
#      - HEAT
#      - DRY
#    custom_fan_modes:
#      - SILENT
#      - TURBO
#    supported_presets:
#      - ECO
#      - BOOST
#      - SLEEP
#    custom_presets:
#      - FREEZE_PROTECTION
#    supported_swing_modes:
#      - VERTICAL
#      - HORIZONTAL
#      - BOTH
    outdoor_temperature:
      name: Temp buitenunit airco
    power_usage:
      name: Verbruik airco
    humidity_setpoint:
      name: RV

remote_transmitter:
  pin: GPIO13                       # For iot-uni-stick the value needs to be GPIO13
  carrier_duty_percent: 100%        # 50% for IR LED, 100% for direct connect to TSOP IR receiver output

sensor:
  - platform: homeassistant
    name: temp_studio_afzuiging     # Modified, see backup the way it was ... without name: or id: it does not want to install so I added it
# Below, the sensor from HASS the airco unit will use instead of its build in sensor for more accurate temp control, e.g. the Aqara combined sensor
    entity_id: sensor.klimaatsensor_studio_temperature
#   entity_id: sensor.schakelkastje_temp_5_sensor_studio_afzuiging  ... this sensor or the distance did not allow very accurate control
    internal: true
    filters:
      - throttle: 10s               # Default 10s
      - heartbeat: 30s              # Default 30s, maximum interval between updates is 2min
      - debounce: 1s                # Default 1s
    on_value:
      midea_ac.follow_me:           # Modified, see backup the way it was ...
        temperature: !lambda "return x;"
        beeper: false               # Optional, beep on update is: true - silence is: false

# Uncomment for template momentary switches for sending display control command and swing step actions
#switch:
#  - platform: template
#    name: midea_airco_studio_display_toggle
#    icon: mdi:theme-light-dark
#    turn_on_action:
#      midea_ac.display_toggle:
#  - platform: template
#    name: midea_airco_studio_swing_step
#    icon: mdi:tailwind
#    turn_on_action:
#      midea_ac.swing_step:
engrbm87 commented 1 year ago

I am trying to connect to the TSOP data pin to send IR commands. But when I connect it the TSOP doesnt work anymore. If I try the actual remote nothing happens until I disconnect the wire that I soldered to the data pin. I am using a standrad esp-01 and connecting GPIO2 to the data pin. Any idea if I need to do any specific wiring (add a resistor or use a level shifter?)

burnbabyburn commented 1 year ago

I am trying to connect to the TSOP data pin to send IR commands. But when I connect it the TSOP doesnt work anymore. If I try the actual remote nothing happens until I disconnect the wire that I soldered to the data pin. I am using a standrad esp-01 and connecting GPIO2 to the data pin. Any idea if I need to do any specific wiring (add a resistor or use a level shifter?)

Quite unsure what you try to do. TSOPs are receivers. If you want to receive with the tsop and it seems line is blocked all the time, did you try inverted mode? Voltage level is 3.3v so no shifter needed. Bute there are recommended application circuits found in the datasheet or on google, which usually use atleast one resistor and capacitor

remote_receiver:
  id: rcvr
  pin: 
    number: YOURPIN
    inverted: true