-
Notifications
You must be signed in to change notification settings - Fork 638
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
Flip/Flop or slow pulse output while relay is in ON state. #2081
Comments
So I wonder how this will fit with an existing timers. We do have a "pulse once" action, where after defining a "normal" status it will toggle the relay back after a specified time. API call can change the pulse time, but not the required status, because it is always based on the current one. When relay is turned on it's status goes through a bunch of checks and ends up here: So maybe there could be a new |
Scratch that. I got the same idea with flood timers and having a sort-of temporary lock for relays to hold them after switching, but it got real entangled having the same settings in different modes. No reason pulse action should not work for such relay type. |
I presume the Would it be easier to add it as some sort of light mode rather than a relay? |
Buzzer does it's thing only once, and I think it is only available as "buzzer" command? We can do that too and add cli & api command to schedule such action, but relay would not be used as an abstraction, we would just need a GPIO pin number to use. For mqtt, What I though about is to use relay (aka our general ON OFF switch abstraction) as a trigger and continuously do some pattern with the timer. For example, use something like "100,1,200,0" for configuration, which is translated to 100msec wait, digital write 1, 200msec wait, write 0, repeat |
Looks like a good option. Is there a load on the ESP CPU to say hold that timer for 1 second on, 1 second off? From other computer coding I've had experience with, wait timers seem to use processing power or cycles. Would there be a theoretical max 'wait' time? To be really fancy, could the timer be adjusted by an mqtt command? E.g. openHAB would send mqtt command to switch on timer output with "500,1,500,0" then later send "200,1,200,0" as a quicker pulse? This may require the option to define up to say 5 wait sequences and enable them using |
SDK continuously calls espurna/code/espurna/system.ino Lines 205 to 210 in 37763f1
After action completes, we store the timestamp and start again. ON OFF cycle is what LED module does, see the loop function below for each state: (but this condition does not expect that millis() can overflow at some point) Lines 69 to 70 in 37763f1
millis() returns 32 bit value and can represent up to ~48.5 days And I totally forgot that LEDs also accept actions through MQTT (see LED_MODE_MQTT). Maybe one could use Or, if creating another action / module, it likely needs a better name. |
The specific function I was looking for was the house alarm system I have built using a D1 mini. When the device is either in an arming state or armed and then triggered by a sensor, one of the GPIOs triggers a buzzer module. It currently just lets out a single tone. I use openHAB to send a 1 then 0 on a 1 second gap loop while the device is in one of the states above. My original alarm system beeps quicker the closer it gets to the state where the alarm actually fully triggers and sets off a louder sounder. I'm not sure how openHAB or other mqtt system could send "500,1,500,0" for a slow pulse, then "200,1,200,0" for a quicker pulse. If the user could define |
Would the device itself be able to control the pattern switching then, based on some timing / pattern itself encoding the switch? e.g. we can have Can rpn rules module be of any use? |
Yes, I the pattern should be in the device configuration. Either by a My D1 mini device is setup using If there is a way to use the new RPN rules to pulse the GPIO ON/OFF while |
So can relay aka switch #0 be configured as dummy trigger for alarm activation ( Why I am asking about RPN... Compared with an existing integrations for things like thingspeak, we define a single |
The D1 mini is configured like this:
openHAB switches |
I have an
D1 mini
device connected to a buzzer on one of the GPIOs.Is there a way to have the GPIO pulse or flip/flop with a set duty cycle, say 1 second on, 1 second off while the 'RELAY/GPIO' state is ON?
I currently use a rule in openHAB to switch the GPIO output ON/OFF so the buzzer pulses, but it would be nice to just set the device to ON and the
D1 mini
do the pulsing.The text was updated successfully, but these errors were encountered: