About "wipe" effect and usermod stairway basic

I need to implement a very simple function, which is easy to implement in fasted. But when I wanted to implement it in WLED, I found it very difficult.
The function is similar to this: if you press button 1, led strips can be lit one by one.
If you press button 2, the LED strip will turn off one by one in the opposite direction.
In fasted, if the 2 button is triggered within a short time after the 1 button is triggered, the LED strips shows like a pluse effect.
However, in WLED, it is very difficult to achieve this effect. The effect I get is that after triggering 1, the LED strip will light up one by one, When half of the LEDs is on I triggering 2. At this time, the entire led strip will turn on first and then turn off one by one in the opposite direction.
I donā€™t know what good way to solve this problem?

I think there is already a usermod for this.

The usermod is design for using two pir sensor to trigger.But PIR canā€™t detect the directions of people pass through. In my porject, I use two TOF laser sensors to trigger. I test the usermod ā€œstairway basicā€,in some situations itā€™s not work perfect. When people just go into the stairway and then go back out immediately, the led strip couldnā€™t do anything. I made some changes to the original code, but still can not achieve better results. The LED strip will have a full lighting process before the reverse start.

The effect in this video is what I want. I have finished testing the sensor part, and they are working very well. But the LED band part, when I use WLED to do development, always can not achieve the desired effect.
https://youtu.be/X8vHWPlUJSw

1 Like

One PIR canā€™t be used, but two can. :wink:

No,for example, two people go into stair form both side, PIR canā€™t works fine.

PIR at top and PIR at bottom can detect direction because direction is implied.
Just be on the lookout for PIR top (or bottom) going ON, followed by any of these states:

  • Off, and no matching ON at opposite end of stairs to note leaving the stairs

  • Off, back on again, with or without an opposite end of stairs ON which meant they changed their minds

  • Off, back on again, and opposite end of stairs ON once or twice as either 1 or 2 people come out of the stairs

  • Stays on, followed by opposite end of stairs ON, as one person walked up/down the stairs and the other person watched or waited

Trick is to use the timing of the ON/OFF/ON of one end to trigger the chase off effect to start after the last ON->OFF transition, and if it stays on, the chase off effect does not get triggered.

And, the first OFF->ON starts the chase ON in either direction, meaning it can react to both up and down movement at the same time.

Hope this helps.

I did a lot of tests on PIR sensor, but in the end I chose TOF laser sensor as trigger. And this part of the algorithm has been written. TOF laser sensor can accurately know the direction and number of people on both sides of the stairs through the algorithm. This will allow you to calculate the number of people in the stairs and also know the direction of the first person to enter (and the last to leave).

The problem Iā€™m facing now is to use the effect in usermod. When a person enters the stairs and turns away immediately, ā€œStairway basicā€ doesnā€™t respond well. I try to change some code, but there are still some problems.

This is what I want to achieve.
For example, there are 256 LEDs in my whole LED strip, which are lit one by one when someone enters.
In this process, the person turns around and leaves from the direction of entry. At this time, the LED strip just lights up to the 100th led. Then the next effect I hope is that the LED strips will be extinguished one by one from the 100th led in the opposite direction.
But I donā€™t have a good way to implement it through WLED.

Hi, I solved a similar thing with air sensors like you. I used the mentioned usermod for that and I didnā€™t have to modify it, but I solve everything in node red, where it works. Itā€™s not perfect and thereā€™s a video here.

Many things still need to be fine-tuned and the wled itself freezes from time to time or does not work properly and must be restarted. But thatā€™s when Iā€™m playing a lot with other settings.
And otherwise I agree, it canā€™t be done with pir sensors and whoever says yes, then didnā€™t try. Pir wonā€™t recognize if youā€™re coming back or if someone else has entered the stairs. I can share my node red flow anyway and I would like to work on it with someone who solves the same, so you :slight_smile:

Glad to hear that.If itā€™s convenient, can you send a copy of your node red flow to me. I also plan to use node red to process mqtt messages from sensors, and then send corresponding mqtt messages to WLED to trigger corresponding effects. But Iā€™ve tried many times, and I canā€™t use WLED to achieve the perfect effect. When a person enters and immediately turns around and goes out, the LED can not be extinguished one by one in reverse direction. It must first fill the whole LED strip, and then it will extinguish one by one from the other end to the entrance. I donā€™t know how to solve this problem. If you have a good idea, please let me know. Thank you very much.

Do you use TOF sensors with esphome? I can send flow but Iā€™m still reworking it, itā€™s still neat and Iā€™m fine-tuning the features and effects. How much do you understand Node RED?

I use TOF sensors with my own code run with esp32.I just use Node RED for some simple home automation.

Now I have the main lighting of the wiping effect running, following the effect of the side rails.

I could send a flow in the evening.
I use esphome on TOF, the implementation has already been done on it and it works reliably.
Did you write the code yourself for TOF? Does it communicate with the Home Assistant?

Yes,it sends current state to mqtt broker.

Here you will find the flow with the settings as I have the best so far. Sometimes it causes mistakes and I have to tweak it. The mistakes are that if you go one way, then you change your mind and go back and then go up the stairs again, so the standby effect is combined with the trigger effect and it stays cut. I need to debug it with the STOP function when something happens that doesnā€™t. The problem is that it canā€™t be timed well enough. I will be happy for help. If you want a link to esphome TOF, Iā€™ll send it too. I donā€™t know if you build it autonomously or within the Home Assistant.

edit: I fixed it yet, so now it kind of works. Let me know.
edit2: there is still a mistake, if you test the entrance and exit to the stairs quickly, then it may happen that the WIPE is stuck and then goes around all the time. but itā€™s probably more for modifying the user mode.

Thanksļ¼Iā€™ll check your flow later, and this video is what I want to achieve. I donā€™t think it can be achieved only by calling WLED through nodded, so Iā€™ve been trying to modify usermod myself. But so far, as I mentioned above, it hasnā€™t been perfect.

1 Like

exactly according to this video i did it ā€¦ it can only be achieved by calling wled via usermod ā€¦ you found that in the description of usermod there is no mention of one command that will make it easier and i used it. It is a call U0 = 0

Hi,Svrbinek
Iā€™ve looked at your flow and it seems that nodered is calculating the sensor data to calculate the number of people. I didnā€™t do that. My own firmware has allowed the sensor to calculate the current people status through esp32. Now I just need to call WLED through the corresponding state. I was able to use the original version of WLED to achieve 95 percent of the above video. However, what the remaining 5% does not achieve is that when an LED strip is gradually lit up, it receives a message of reverse extinction (U0). At this time, WLED can not extinguish gradually from the current LED, but it needs to wait for the lighting effect to complete before it starts to extinguish.

I donā€™t understand why he receives a shutdown message? What is a trigger?
Do you have your firmware implemented in wled, or do you use another esp32? I have it on two esp32, one is wled and the other is esphome.
Is your fw part of the Home Assistant, or does it run on its own and cannot be easily set up? If you share it, I can try the behavior.

I have two esp32 too.One for wled and one for vl53l1x tof sensor.For now,Itā€™s running on its own,and send the people status through MQTT. I havenā€™t complete this fw for easily setting. So I canā€™t share the code right now:(
The shutdown message comes from one person go pass through the senson(on),and soon he turns back(off). You can see that in 59 seconds of the video which I shared.