sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
Other
236 stars 125 forks source link

Alexa status update #24

Closed ivanvieirasalles closed 4 years ago

ivanvieirasalles commented 4 years ago

I would like the following help: I ​​am mounting with the ESP-12 a module with light. I felt the need to put the button on / off manually, but could not get the command to update the light state (on or off) in the Alexa application. NOTE: I have assembled other modules like Plugs and I was able to do it, but I didn't find a command that would update when it comes to light.

void ManualCommand () { unsigned long TempoNow = millis ();

if (digitalRead (PinKey_1) == LOW && TimeNow - TimeButton> 1000) {// This prevents button replication if (device_state.powerState) {// Invert the current value device_state.powerState = false; } else { device_state.powerState = true; }

// Here I turn on the light onPowerState (LIGHT_ID, device_state.powerState);

// The following command does not update the Alexa application. setupSinricPro ();

TimeButton = TimeNow; // update last button press variable

} }

Thanks to anyone who can help.

sivar2311 commented 4 years ago

Please see switch example for how to send events to SinricPro server.

Also please check full documentation for all device types and their functions. All devices have the capability to send device specific events.

ivanvieirasalles commented 4 years ago

Thank you. worked properly.