Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINIR4M action triggers twice #1242

Closed
tsemer opened this issue Oct 16, 2023 · 9 comments
Closed

MINIR4M action triggers twice #1242

tsemer opened this issue Oct 16, 2023 · 9 comments
Labels
question Further information is requested

Comments

@tsemer
Copy link

tsemer commented Oct 16, 2023

Thanks so much for adding support for #1227 😄

Looks like the new sensor is called "Action". I'm seeing now in the HA logbook two events fire every time the physical (detached) switch is being pressed:

  1. "<Action sensor name>"
  2. "<Action sensor name> changed to single"

Here's a screenshot:

Was this the intention or is this a bug?

If this was intentional - I have a question about how to create an automation using this new sensor. When I create a simple automation using the sensor as a "state" trigger, then the automation is triggered twice for every physical switch toggle (light goes on and immediately goes off, or vice versa depending on initial state). This is how a simple automation looks:

Obviously, we want the automation to hit only once for every physical switch toggle. I've tried to fill different values in the fields "Attribute", "To" and "From", including to: single and directly in YAML to: (based on HA docs for "trigger on all state changes, but not attributes"). So far I haven't managed to filter a single event.

My current only workaround is to add a 1 second delay using the "For" field, but this is of course sub-optimal, home users expect a physical light switch to work almost immediately.

I don't mind editing the automation in YAML if necessary, there are a few additional fields available that are not supported by the UI.

Thanks in advance!

@tsemer
Copy link
Author

tsemer commented Oct 16, 2023

<Embarrassed> 😵 now the value to: single seems to work. I don't know what I did wrong before. Perhaps I accidentally used a capital "S". Either way, this value seems to be the solution.

@tsemer tsemer closed this as completed Oct 16, 2023
@wishie
Copy link

wishie commented Oct 17, 2023

I initially had the same issue when setting up the automation, but came to the same conclusion as you.

What I have noticed though, is that while the MINIR4 can work in LAN (local) mode, the current implementation of the detached relay action appears to require the cloud.

@AlexxIT is there a way to allow this to also work in local mode?

@AlexxIT
Copy link
Owner

AlexxIT commented Oct 17, 2023

I think device firmware not support local button press. You can try to write to sonoff team.

@SpartanTech
Copy link

SpartanTech commented Dec 22, 2023

tsemer,

how did you get this to work? my Action sensor is always blank when i flip my light switch. it is currently in attached-relay mode until i can program the automation. does the sensor only update when detached?

and if i may ask, what switch mode (not detach relay option) is your switch in? Is your Lan Mode (on the device settings) enabled or disabled?

looking to have my smart lights always powered so i bought these. and handling receiving the signal from the light switch to act as a automation switch via H.A.

The only time Action appears in my Logbook is when I reload the integration (sensor goes from unavailable to empty). Toggling my switch does not trigger a logbook/sensor update

image

@tsemer
Copy link
Author

tsemer commented Dec 22, 2023

does the sensor only update when detached?

I seem to remember so, yes. You can easily test it yourself - just set it to "detached" and see if it starts working.

what switch mode (not detach relay option) is your switch in?

Mine is in edge mode, since that's the type of switch I have - what you might call a "standard" switch.

Is your Lan Mode (on the device settings) enabled or disabled?

If you mean "LAN control" then it's enabled.

Hope this helps!

@tsemer
Copy link
Author

tsemer commented Jan 13, 2024

I think device firmware not support local button press. You can try to write to sonoff team.

I've written to sonoff team. Will update their response.

cc @wishie

@tsemer tsemer reopened this Jan 13, 2024
@AlexxIT AlexxIT added the bug Something isn't working label Feb 13, 2024
@AlexxIT AlexxIT changed the title How to create an automation using the new "Detached switch pressed" sensor of MINIR4M MINIR4M action triggers twice Feb 13, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Feb 13, 2024

Two times trigger is a bug. You need to collect debug logs

@tsemer
Copy link
Author

tsemer commented Feb 13, 2024

Two times trigger is a bug. You need to collect debug logs

Thanks @AlexxIT, but I think this got reopened by accident when I left my last comment. @wishie saw the same behaviour, and filtering the action to: single works, so we figured it's by design no? For me this is good enough. If you still want any logs to debug please tell me exactly how to get them for you and I will. Otherwise feel free to close this again.

For me, I'm only coming back here to follow up on the additional request of @wishie to make this action local (as you suggested above, I wrote to the Sonoff team).

@AlexxIT
Copy link
Owner

AlexxIT commented Feb 13, 2024

Ah. Of course to: single is important in the trigger.

@AlexxIT AlexxIT added question Further information is requested and removed bug Something isn't working labels Feb 13, 2024
@AlexxIT AlexxIT closed this as completed Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants