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

How to have the Mini R2 report a physical SPDT switch state change #114

Open
hepcat72 opened this issue Aug 30, 2021 · 4 comments
Open

How to have the Mini R2 report a physical SPDT switch state change #114

hepcat72 opened this issue Aug 30, 2021 · 4 comments

Comments

@hepcat72
Copy link

I just implemented a polling strategy to keep my app's button state synced to the actual power state of the switch, but I don't like the polling strategy as a solution. It's too busy.

I would like to know if there's a way to make the mini R2 report state changes so that the power state of the switch in my home app accurately reflects the power state of the actual circuit.

Specifically, I would like to be able to set a webhook URL value in the R2 that it calls when the power state changes.

Ideally, you could specify whether the state change came from the SPDT switch or via webhook call.

Is this already possible and I just overlooked how to do it in the doc?

@VTsuprov
Copy link

VTsuprov commented Sep 5, 2021

I went through the ...Doc v2.pdf and have found nothing about it
updated:
In case of physical button push Sonoff publiches its status in the network. You can see it by calling something like
avahi-browse -a

@VTsuprov
Copy link

VTsuprov commented Sep 5, 2021

For the Nodejs you can use this tool: https://www.npmjs.com/package/multicast-dns

@hepcat72
Copy link
Author

hepcat72 commented Sep 7, 2021

Hmmm, I don't have a push-button. I have an SPDT switch, as mentioned in the user manual.

The eWeLink app reports the state of that switch, because when I flip it, the state of the virtual button in the eWeLink app changes. I would just like to report that state update using DIY mode.

I already implemented a polling strategy to retrieve that state, but polling is a busy implementation - a lot of wasted cycles. It would be much more efficient if I could make the Mini R2 send state change events when they happen. That is what I'm inquiring about here. Is this possible with DIY mode or would I need to flash with tasmota to obtain that functionality?

@hepcat72
Copy link
Author

hepcat72 commented Sep 7, 2021

For example, if there was a webhook URL option in DIY mode that I could set that the Mini R2 could use to report state changes, that would be ideal. Let's call it "reporting_url". I would want to set it to something like http://mynode-red.local:1880/minir2-state-changes. When the state changes on the R2, it would call that URL and my node red instance could update the state of the button in the Home app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants