vintlabs / fauxmoESP

Add voice control of your ESP32 and ESP8266 devices using Amazon Alexa
MIT License
379 stars 70 forks source link

write a variable instead of an output #161

Open sharkyenergy opened 3 years ago

sharkyenergy commented 3 years ago

Hello, thanks for the great library..

question, is it possible to write a variable instead of setting an output? if yes, how?

Thank you!

sebkouba commented 3 years ago

I don't really understand the question. What are you trying to do?

    fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state, unsigned char value) {       
        if (strcmp(device_name, ID_PLUG) == 0 && state){ // match the name and that it was switched on
          myVariable = 22; // writing predetermined variable if it's switched on
         myOtherVariable = value; // this variable is assigned the 0-255 value from the callback function "value"
        }