2 state widget resets to zero


#1

Hello,

In my case the 2 state widget updates correctly, but when I refresh my dashboard it always comes back to the “zero” state. Is that normal?

Francesco


#2

What device are you using? I have a similar issue with MQTT.


#3

I’m using Python MQTT

Francesco


#4

@rsiegel do you know of any bugs with MQTT states right now? When I was testing the Pi Face a week or two ago I was getting one widget that always changed state to high when I refreshed. The weird thing was that it wasn’t sending that value to the Pi.


#5

It works for me, I’m able to send 0/1 commands to my device through the web interface and the android application too. The switch always changes its status correctly. The only issue is that if I refresh the page the icon always goes to the 0 state, so there is no possibility to know if the device is in on or off state once the page is refreshed.

Francesco


#6

Yep, that’s exactly what I was getting with one of my widgets but mine was always going high. Out of curiosity can you check another browser? Now that I think about it, I seem to remember that I didn’t have that problem on my laptop.


#7

I never got to this thread when you initially asked @adam, so apologies there. We do have a known issue at the moment with MQTT actuators losing value on browser refresh, but I’m not aware of any such issue with MQTT display widgets (like the 2-state widget in question here). Other than perhaps on a very quick refresh the widget showing the wrong state, but this should be resolved on a subsequent refresh unless both are performed very quickly.

@francesco_talotta, was your widget a 2-state or an actuator like a Button widget? I know you mentioned a 2-state above, but I wanted to be sure. If it really is a 2-state widget, I’d be interested in the MQTT code you’re using to pass it a 0 or 1, this might help uncover why it’s not behaving as you’re expecting.


#8

Actually it is a Button not a 2-state widget. In my python script I’m passing 0 and 1 to my Button. Maybe I was wrong saying it is a 2 state widget but I was ‘confused’ by the little icon 0/1 in the dashboard.

Francesco


#9

No worries. It makes more sense then, since we’re aware we have a bug with MQTT Actuators holding state on browser refresh. I’ll update you as soon as we’re aware of a fix on the site.