kakopappa / sinric

Amazon Alexa Smart home skill / Google Home Action for ESP8266 / ESP32 / Arduino
https://sinric.com
285 stars 166 forks source link

add buttons for switches and lights #225

Open osama-Akt opened 5 years ago

osama-Akt commented 5 years ago

Hi , i wanna thank you about this open source iot, i'm running a nodemcu for like a month or more using the switch example sketch controlling 5 lights and 2 switches, it's working flawlessly with the app and with alexa , but i want to attach 5 buttons in nodemcu side (buttonState = digitalRead(buttonPin) or analogread(to save more pins); the button activates the relay so the light turns ON, but i cant figure it out how to send the state of that light turned on manually buck to the Sinric app or Alexa App ? and i noticed that the nodemcu emitted an AP SSID under the name of ESP-xxxxxx (6 char) open network connection !!!!, i cant find in the sketch where is the command responsible of that AP ! thanks again and keep up the sharing (y)

kakopappa commented 5 years ago

hi,

Thanks.. To send the status to server use this sketch.

https://github.com/kakopappa/sinric/blob/master/arduino_examples/how_to_update_server_example.ino

You can see the setPowerStateOnServer at the bottom. Call this ONCE when the status change. Please send it once when it change the state. Do not send it in a loop and overload the server. This is how your ip will end up in blocked ip list

Do not send it in the loop().

i noticed that the nodemcu emitted an AP SSID under the name of ESP-xxxxxx (6 char) open network connection !!!!, i cant find in the sketch where is the command responsible of that AP !

This is not my code... take a look at WIFI_AP, WIFI_STA, WIFI_AP_STA modes

philb1192 commented 5 years ago

Hi , i wanna thank you about this open source iot, i'm running a nodemcu for like a month or more using the switch example sketch controlling 5 lights and 2 switches, it's working flawlessly with the app and with alexa , but i want to attach 5 buttons in nodemcu side (buttonState = digitalRead(buttonPin) or analogread(to save more pins); the button activates the relay so the light turns ON, but i cant figure it out how to send the state of that light turned on manually buck to the Sinric app or Alexa App ? and i noticed that the nodemcu emitted an AP SSID under the name of ESP-xxxxxx (6 char) open network connection !!!!, i cant find in the sketch where is the command responsible of that AP ! thanks again and keep up the sharing (y)

Hi, did you have the code running? I'm trying to build a 3 way using Alexa and a physical switch. I Need a way to change the status of the server with the physical switch so that Alexa will know if the light is on or off. I'm new in coding and i don't know where to start :/