Arduino-HomeKit-ESP8266 icon indicating copy to clipboard operation
Arduino-HomeKit-ESP8266 copied to clipboard

AC control

Open CommyD opened this issue 5 years ago • 9 comments
trafficstars

hi all, awesome work on this. 👍 is there a way to change the accessory in order to work as an ON/OFF button to an AC?

cheers

CommyD avatar Sep 14 '20 14:09 CommyD

Did you try it with relay? https://en.wikipedia.org/wiki/Relay

waaraawa avatar Sep 16 '20 05:09 waaraawa

Thanks for the input, but my thought was to use an IR transmitter added to my Wemos D1 mini, and change this code to be seen as a switch in Home.app rather than a light. By having a light accessory, it will also run my AC when I would say “siri, turn off the lights” :)

Best

CommyD avatar Sep 16 '20 07:09 CommyD

Yes you can control any homekit DIY devices by Siri. And you can add your Wemos like AC. You can choose one or more Homekit characteristics of your Wemos as follow link. https://developer.apple.com/documentation/homekit/hmcharacteristic/characteristic_types HOMEKIT_SERVICE_HEATER_COOLER or HOMEKIT_SERVICE_THERMOSTAT are could be used for AC.

I also making AC controller + AQI + temp _humi with this repo. Not finished yet but most functions are working well now:) Photo 2020-09-16 17 08 10 Happy DIY~

waaraawa avatar Sep 16 '20 08:09 waaraawa

At first I think I understood the opposite of what you want to do. If you just want on and off, then perhaps all you need to implement is the Outlet service.

jmbwell avatar Sep 16 '20 12:09 jmbwell

hi @waaraawa @jmbwell, yes, indeed, just wanted an on/off switch, as i'm not too advanced to work on more complicated things yet. :) i've taken the Example02_Switch and added the IR hex code in cha_switch_on_setter() method and it works like a charm.

best regards

CommyD avatar Sep 16 '20 13:09 CommyD

hi guys,

i have a small logic error in my Switch program, and I would appreciate if someone can help.

//Called when the switch value is changed by iOS Home APP void cha_switch_on_setter(const homekit_value_t value) { bool on = value.bool_value; cha_switch_on.value.bool_value = on; //sync the value LOG_D("Switch: %s", on ? "ON" : "OFF"); digitalWrite(IR_SEND_PIN, on ? LOW : HIGH); irsend.sendRaw(rawData, 100, 38); }

As seen above, in cha_switch_on_setter method, i've added the IR code to be sent to my AC; this works fine to turn on/off the AC, but unfortunately, if I put this in an automation, it sends the the code regardless of the state of the switch.

Example: I have an automation to turn off my lights and my AC if I leave my house. In this case, when i leave home, if the AC is already off, the state of the switch remains the same, but it also sends an IR signal to my AC (so actually the AC turns on). :|

thanks

CommyD avatar Sep 19 '20 13:09 CommyD

Hello, wondering if someone can help me out? :)

Thanks

CommyD avatar Sep 24 '20 14:09 CommyD

for ideas on the logic, you may want to have a look in this example which works pretty much ok.

peros550 avatar Sep 24 '20 15:09 peros550

thank you @peros550 :)

CommyD avatar Sep 28 '20 11:09 CommyD