Generic Zigbee Switch - Strange Behaviour

Having so much fun today. After battling to get a Sonoff ZBMINIR2 working after pairing (had to bring it to the hub) my button rule that controls the device is not working. Here is the rule:

A push of button 3 turns on the device as expected:

...and the device state is correctly updated to on:

However when I press the button again. Despite the device state being 'on', the button rule thinks it is off and so commands it on again:

Any ideas why that would occur? I originally had the button rule set to toggle the switch but it just turned on with the first button push and remained on with subsequent pushes.

The pushed attribute does not "reset". I take it you are triggering off pushed changing to 3 to activate the rule. It will not change it you press the same button number twice.

You may want to think about resenting pushed to a number you are not using, like 0, in the rule that responds to it being pushed. Just end the rule with a manual push 0.

Hmmm. Each time button 3 is pushed it triggers the rule. I've been using it this way triggering a different (z wave) switch for about a year so it does work. I still have the button on the opposite side of the bed working that way so it seems to be an issue with this device and driver combination.

I deleted the 'Johns Bedside' switch and paired it to Hue. If I set a button 3 rule with the same actions or to 'toggle' the switch it works perfectly through the built in Hue integration:

I've now deleted it again from Hue, added it back to Hubitat and used @kkossev Tuya Zigbee Switch driver and it's working correctly there also. This is another identical device using the rule with that driver:

I was going to add my Zigbee devices entirely via Hue where possible but thought it might be better to have a healthy Hubitat mesh also.

Good point, the event can still be sent without updating the attribute, if the driver is set to do that. It is usually switches and such that save hub resources by not sending an event if the switch is already in that state, for example. Most button drivers should send the event no matter what, however, so my bad.

I've had a fish around through a few posts regarding this end device (Sonoff ZBMINIR2). I think the consensus was that although it paired and worked with 'Generic Zigbee Switch' there was some issues with states being updated. As I could see them updated in the device panel I thought all was well but it appears to not to be the case.

Sonoff … and Generic ? :slightly_smiling_face:

The Sonoff 'specific' is handling the toggle command.

is it possible your rule is faulty? If you use 'Toggle' instead of on off - the button will act like a switch - is that what you are really after?

The rule is fine - toggle is what I want (if I have to send an on and an off I lose another button) I've a 4 button Sonoff Orb at each side of the bed and button 3 push toggles that sides bedside reading light - 1 tap on, next tap off. Previously the controlled devices were Z Wave Dimmers (Fibaro Dimmer 2) It's always worked since installing and I do the same other buttons around the house. It's simply the controlled device that has changed.

This is doing my head in! Each Side of the bed is identical. A Sonoff ZBMINIR2 and a Sonoff Orb. Both ZBMINIR2s are using your driver. Both devices have a button tap rule to toggle the device.

RHS: Button 3 push > Toggle John Bedside (the ZBMINIR2)
LHS: Button 4 push > Toggle Clare Bedside (the ZBMINIR2)

On the RHS it works - push button 3 light on, push button 3 light off
On the LHS it does not - push button 4 light on, push button 4 no change

The rule is triggering and the hub sends the toggle command. However on the LHS it does not toggle back off because although the state shows 'on' it tries to turn it on not off.

OK Ive got it working and toggling correctly. It makes no sense as all I've changed is the highlighted from none to switch. I though that was only for visibility in the device list?

Is this an RM rule or basic button controller?

If RM maybe try it in basic button controller and see if problem follows it there.

Also I think instead of conditional logic to test lamp state you could take all of that out and just use the toggle command.

Could also try a delay in the actions in case of multiple firing of the trigger (problem in device driver? improper debounce in handheld device firmware, ...). Possibly just a debug step to test the theory, put a 1 second delay as first action before the toggle. You might not want the lag but if it helps pinpoint the root cause it might be helpful as a debug test.. does improper triggering go away if you put a delay in?

Check whether the LSH 'Device Profile' is set as ZBMINIR2 or is UNKNOWN or something else... Sometimes the Zigbee devices may pair incompletely, and important data (Zigbee model/manufacturer) may be missing. This happens often with Aqara sensors.

ZBMINIR2 requires a non-standard response/acknowledge of the toggle() command, thats why the first command succeeds, but all subsequent toggle commands will fail.

The inbuilt 'Generic Zigbee Switch' driver, being generic, should work with the ZBMINIR2 generic on/off commands, but toggle() should fail.

All I've changed is 'Default current state' clicked save and it started working correctly.

Come lights out tonight I hope it works as I'm within striking distance of my wife!

Yes it was working with on/off and the states were showing on/off, however when the state was displayed 'on' a rule with "IF switch is ON" would be FALSE

This is probably just another Sonoff weirdness. They seem to be competing with Tuya over who can make the most non-standard Zigbee implementation, but I don’t think Sonoff has any chance of taking the top spot. That position is reserved for Tuya! :rofl:

Oh no. Perhaps my decision to swap Z Wave for Zigbee is a bad one! Out of the frying pan and into the fire....