1 (edited by 3dnour 2019-04-11 10:08:49)

Topic: External key with mobile key

welcome everybody smile

I'm working on     NodeMCU__ESP8266  V3

How can I add an external key to the light with the application RemoteXY
On the mobile so that I can turn on and turn off the light by mobile
  At the same time I want to turn on and off the light through an external key
  And know the status of the key in mobile ؟


I wish you all the health........ smile
Thanks

2

Re: External key with mobile key

3dnour wrote:

welcome everybody smile

I'm working on     NodeMCU__ESP8266  V3

How can I add an external key to the light with the application RemoteXY
On the mobile so that I can turn on and turn off the light by mobile
  At the same time I want to turn on and off the light through an external key
  And know the status of the key in mobile ؟


I wish you all the health........ smile
Thanks

An old post, yes, but you did not get an answer.

I think by now you have realised that the "controls", e.g. switches, sliders, numerical input etc. cannot be "updated" by the MCU sketch if they are changed elsewhere.

This is a shortcoming of the interface that has been well documented in these forums.

I don't know if you got your issue solved, but one way would be to make the RemoteXY app with a push-button to "toggle" the current state of the light, easy enough to do, and to have an LED showing the current state of the light output.   That would enable the mobile to always display the "status of the key".

And another hint : RemoteXY only writes the push-button input variable back to "0" after the button is released. Your MCU will see this button ON many, many times, when you actually only want to see it once.  Simply write it back to "0" when you see it at a "1", effectively making it a "one-shot". it doesn't matter that the RemoteXY app will write it back to "0" later (even though it already is a "0", you only ever want to see it come on.

if (RemoteXY.button) {
   RemoteXY.button = 0;       // turn the button off
   light = !light;           // toggle the light status
}
2B, or not 2B, that is the pencil ...