Dashboard switch button does not change status when change initially happens on Device

Hi @alvarolb

When performing tests with the Switch button everything works fine when commands are sent from the DashBoard to the Device.
But, when the change is made in the Device (eg, pressing a button; or changing the pin status by the code), there is no change in the Dashboard. (Dashborad ← Device)
You can only view the button status correctly after refreshing the web page. But this is not suitable. Ideally, the button status update should happen in “real time” in the Dashboard Widget.

(Dashborad [command] → Device) = OK. Dashboard and synced devices
(Dashborad ← [command]*** Device) = Failed. Dashboard does not sync power button status

*** In the tests I performed, I did not use attachInterrupt interrupts. Just common triggers on loop() with digitalWrite.
*** I’ve seen the same behavior on the Device API screen. That is, if the pin change initially occurs on the device, the API switch button does not change its status. I can only get the correct status if I refresh the entire web page.

When analyzing the function inline void digital_pin(protoson::pson& in, int pin) I identified that the parameter is just in would a function with out parameter be necessary? Or are status changes sent by the Arduino-Thinger library but not captured by the Dashboard?

Is this an easy-to-fix “bug” or is it a feature that needs to be developed in the Arduino-Thinger library?

Can anyone reproduce this same behavior?

I investigated a bit more with the “Event Inspector” functionality.
NOTE: Excellent functionality for debugging.

I identified that the commands sent from the Dashboard to the Device are successfully captured.
However, when the pin change is initially on the Device there is no out event to update the Dashboard.

Is this an easy-to-fix “bug” or is it a feature that needs to be developed in the Arduino-Thinger library?

My code does the following routine: When the button is pressed on the Dashboard to turn ON/HIGHT a pin (activate a relay), there is a routine in the device that changes the pin to OFF/LOW (turns off the relay) after 60 seconds.
The “problem” I identified is that the Dashboard does not “live” update the widget when the Device pin changes to off/LOW internally by the code. I can only see the correct status if I refresh the entire Dashboard web page

Hi @George_Santiago, the library does not monitor the GPIO states. If you detect the event in your code, i.e., via interrupt or in the loop, you could perform a stream over the button resource, which should update the dashboard state.

1 Like