This usermod makes your staircase look cool by illuminating it with an animation. It uses PIR or ultrasonic sensors at the top and bottom of your stairs to:
The Animated Staircase can be controlled by the WLED API. Change settings such as speed, on/off time and distance by sending an HTTP request, see below.
To include this usermod in your WLED setup, you have to be able to compile WLED from source.
Before compiling, you have to make the following modifications:
Edit usermods_list.cpp
:
wled00/usermods_list.cpp
#include "../usermods/Animated_Staircase/Animated_Staircase.h"
to the top of the fileusermods.add(new Animated_Staircase());
to the end of the void registerUsermods()
function.You can configure usermod using the Usermods settings page. Please enter GPIO pins for PIR or ultrasonic sensors (trigger and echo). If you use PIR sensor enter -1 for echo pin. Maximum distance for ultrasonic sensor can be configured as the time needed for an echo (see below).
You may need to use 10k pull-down resistors on the selected PIR pins, depending on the sensor.
The Staircase settings can be changed through the WLED JSON api.
NOTE: We are using curl to send HTTP POSTs to the WLED API.
If you're using Windows and want to use the curl commands, replace the \
with a ^
or remove them and put everything on one line.
Setting | Description | Default |
---|---|---|
enabled | Enable or disable the usermod | true |
bottom-sensor | Manually trigger a down to up animation via API | false |
top-sensor | Manually trigger an up to down animation via API | false |
To read the current settings, open a browser to http://xxx.xxx.xxx.xxx/json/state
(use your WLED
device IP address). The device will respond with a json object containing all WLED settings.
The staircase settings and sensor states are inside the WLED "state" element:
{
"state": {
"staircase": {
"enabled": true,
"bottom-sensor": false,
"top-sensor": false
},
}
By disabling the usermod you will be able to keep the LED's on, independent from the sensor activity. This enables you to play with the lights without the usermod switching them on or off.
To disable the usermod:
curl -X POST -H "Content-Type: application/json" \
-d {"staircase":{"enabled":false}} \
xxx.xxx.xxx.xxx/json/state
To enable the usermod again, use "enabled":true
.
Alternatively you can use Usermod Settings page where you can change other parameters as well.
Using Usermod Settings page you can define different usermod parameters, including sensor pins, delay between segment activation etc.
When an ultrasonic sensor is enabled you can enter maximum detection distance in centimeters separately for top and bottom sensors.
Please note: using an HC-SR04 sensor, particularly when detecting echos at longer distances creates delays in the WLED software, might introduce timing hiccups in your animation or a less responsive web interface. It is therefore advised to keep the detection distance as short as possible.
In addition to activation by one of the stair sensors, you can also trigger the animation manually via the API. To simulate triggering the bottom sensor, use:
curl -X POST -H "Content-Type: application/json" \
-d '{"staircase":{"bottom-sensor":true}}' \
xxx.xxx.xxx.xxx/json/state
Likewise, to trigger the top sensor:
curl -X POST -H "Content-Type: application/json" \
-d '{"staircase":{"top-sensor":true}}' \
xxx.xxx.xxx.xxx/json/state
MQTT
You can publish a message with either up
or down
on topic /swipe
to trigger animation.
You can also use on
or off
for enabling or disabling the usermod.
Have fun with this usermod.
www.rolfje.com
Modifications @blazoncek
2021-04
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Комментарий ( 0 )