Closed 1technophile closed 6 years ago
Hi Florian,
I don't think it is feasible to implement support for AC protocols as they are simply too many and require quite advanced knowledge for average user. Moreover, the support should be implemented in IRRemote in order for OpenMQTT to recognize the signal.
However, there's an workaround. I think that it should work for most of the AC.
The buttons on my remote are On/Off; Sleep; Fan; Swing; Mode; Temp. As a result, there are 153 different signals sent by the remote.
Create a script with the payload for each button press (153 scripts :) ). The name of the script is important as it includes the button pressed.
livinghvacoff:
alias: off
sequence:
- service: mqtt.publish
data:
topic: "home/GatewayOpenMQTT7/commands/IR_Raw"
payload: "3106,1704,526,..."
livinghvaconnoautofalsecool16:
alias: onnoautoFALSEcool16
sequence:
- service: mqtt.publish
data:
topic: "home/GatewayOpenMQTT7/commands/IR_Raw"
payload: "3052,1702,528,..."
Set component MQTT HVAC; the topics where the component posts the commands are being used in step 4 to be concatenated and matched against scripts names:
- platform: mqtt
name: HVAC Living
modes:
- dry
- cool
- fan
swing_modes:
- yes
- no
fan_modes:
- auto
- high
- medium
- low
hold:
- yes
- no
power_command_topic: "hvac/living/power/set"
mode_command_topic: "hvac/living/mode/set"
temperature_command_topic: "hvac/living/temperature/set"
fan_mode_command_topic: "hvac/living/fan/set"
swing_mode_command_topic: "hvac/living/swing/set"
hold_command_topic: "hvac/living/swing/set"
current_temperature_topic: "hvac/living/state/temperature"
payload_on: "on"
payload_off: "off"
retain: true
initial: 22
Sensors; the first 6 sensors are intermediary and are based on the topics sent by the HVAC component for each of the remote buttons; the next 6 are used for dealing with the error messages after a reboot (5% core code, 95% error handling :) ).
- platform: mqtt
state_topic: "hvac/living/power/set"
name: 'HVACi living power'
- platform: mqtt
state_topic: "hvac/living/mode/set"
name: 'HVACi living mode'
- platform: mqtt
state_topic: "hvac/living/temperature/set"
name: 'HVACi living temperature'
- platform: mqtt
state_topic: "hvac/living/fan/set"
name: 'HVACi living fan'
- platform: mqtt
state_topic: "hvac/living/swing/set"
name: 'HVACi living swing'
- platform: mqtt
state_topic: "hvac/living/sleep/set"
name: 'HVACi living sleep'
- platform: template
sensors:
hvac_living_power:
friendly_name: HVAC living power
value_template: >
{% if is_state('sensor.hvaci_living_power', 'unknown') %}
off
{% else %}
{{ states.sensor.hvaci_living_power.state }}
{% endif %}
- platform: template
sensors:
hvac_living_mode:
friendly_name: HVAC living mode
value_template: >
{% if is_state('sensor.hvaci_living_mode', 'unknown') %}
cool
{% else %}
{{ states.sensor.hvaci_living_mode.state }}
{% endif %}
- platform: template
sensors:
hvac_living_temperature:
friendly_name: HVAC living temperature
value_template: >
{% if is_state('sensor.hvaci_living_temperature', 'unknown') %}
22
{% else %}
{{ states.sensor.hvaci_living_temperature.state }}
{% endif %}
- platform: template
sensors:
hvac_living_fan:
friendly_name: HVAC living fan
value_template: >
{% if is_state('sensor.hvaci_living_fan', 'unknown') %}
auto
{% else %}
{{ states.sensor.hvaci_living_fan.state }}
{% endif %}
- platform: template
sensors:
hvac_living_swing:
friendly_name: HVAC living swing
value_template: >
{% if is_state('sensor.hvaci_living_swing', 'unknown') %}
false
{% else %}
{{ states.sensor.hvaci_living_swing.state }}
{% endif %}
- platform: template
sensors:
hvac_living_sleep:
friendly_name: HVAC living sleep
value_template: >
{% if is_state('sensor.hvaci_living_sleep', 'unknown') %}
no
{% else %}
{{ states.sensor.hvaci_living_sleep.state }}
{% endif %}
- alias: 'HVAC living operation'
initial_state: 'on'
trigger:
- platform: state
entity_id:
- sensor.hvac_living_mode
- sensor.hvac_living_temperature
- sensor.hvac_living_fan
- sensor.hvac_living_swing
action:
- service: homeassistant.turn_on
data_template:
entity_id: script.livinghvac{{states.sensor.hvac_living_power.state|replace("ON","on")|replace("OFF","off")}}{{states.sensor.hvac_living_sleep.state}}{{states.sensor.hvac_living_fan.state}}{{states.sensor.hvac_living_swing.state|replace("False","false")|replace("True","true")}}{{states.sensor.hvac_living_mode.state}}{{states.sensor.hvac_living_temperature.state|replace(".0","")}}
- alias: 'HVAC living off'
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.hvac_living_power
to: "off"
action:
- service: homeassistant.turn_on
entity_id: script.livinghvacoff
- alias: 'HVAC living sleep mode off'
initial_state: 'on'
trigger:
- platform: sun
event: sunrise
offset: "+02:00:00"
action:
- service: mqtt.publish
data:
topic: 'hvac/living/sleep/set'
payload: "no"
- alias: 'HVAC living sleep mode on'
initial_state: 'on'
trigger:
- platform: sun
event: sunset
offset: "+02:00:00"
action:
- service: mqtt.publish
data:
topic: 'hvac/living/sleep/set'
payload: "yes"
Hi there, this is my temporary workaround for my mitsubishi ac(raw code didnt seem to work for me), activates on mqtt topic IR_AIRCON with 0 being off and anything above 10 being on. (I do not see the need to change other parameters but could be a point to start looking into it if you do need them.)
#define IR_AIRCON
#include <ir_Mitsubishi.h>
//test aircon code here
#ifdef IR_AIRCON
if (strstr(topicOri, "IR_AIRCON") != NULL){
IRMitsubishiAC mitsubir(IR_EMITTER_PIN);
mitsubir.begin();
if (data == 0){
mitsubir.off();
mitsubir.setFan(0);
mitsubir.setMode(MITSUBISHI_AC_COOL);
mitsubir.setTemp(data);
mitsubir.setVane(MITSUBISHI_AC_VANE_AUTO);}
else if (data > 10){
mitsubir.on();
mitsubir.setFan(0);
mitsubir.setMode(MITSUBISHI_AC_COOL);
mitsubir.setTemp(data);
mitsubir.setVane(MITSUBISHI_AC_VANE_AUTO);}
#ifdef ESP8266
mitsubir.send();
#endif
signalSent = true;
}
#endif
//end test code
@PetricaM I took the opportunity to add your idea to the wiki thanks
geoisis: Awesome project !!! Although i can't get 433ghz receiver to snif anything, IR works fine. Could you add support for AC's maybe, like Mitsubishi. ex: https://github.com/markszabo/IRremoteESP8266
thank you for work, keep it up :D !