I was able to setup my R4 mini to learn 2 IR commands, how to power off the Aircon and how to power it on at a given setting. Now this is my configuration and it works just fine on Alexa:
What i’d like to add now is the ability to control this not only from alexa but from the UI as well ensuring that also Alexa has the proper state, so i’d like to turn it ON from the UI and turn it OFF from alexa for example.
I guess i should create a switch and then store state somehow? Also i am not sure how to map commands in a switch so the switch sends command to my IR command channel above.
Thanks Larsen, that was not my question maybe i expressed myself incorrectly, i wanted to understand how to create a virtual switch that can both be used by the UI and Alexa while sending commands to a String channel.
I managed to do this myself by doing this:
Created a Switch, exposed this switch to Alexa as AirConditioner.PowerState
Create a rule file that monitors the switch and sends the command to the channels
rule "Maps aircon in living room to commands on IR controller"
when
Item SalottoCondizionatoreSwitch changed
then
if (SalottoCondizionatoreSwitch.state == ON) {
SalottoCondizionatoreComando.sendCommand("DEVICE_ON_27_COOL_AUTO")
} else if (SalottoCondizionatoreSwitch.state == OFF) {
SalottoCondizionatoreComando.sendCommand("DEVICE_OFF")
}
end