Special adjustable Timer On/Off

Hi Experts,

I work with Node-Red and dashboard and would like to setup an adjustable timer on Raspi 4 B hardware. I tried several attempts but without success so far.

Goal:
1 Slider in dashboard should influence a on/off trigger from 0-100%.
i.e. Slider total 0...10 sec. (so 10 sec. maximum, step 1 sec)

So let's give you 3 examples:
Moving slider to 3 --> 3 sec. Output True, 7 sec. Output false, repeat in loop
Moving slider to 10 --> 10 sec. Output True, 0 sec. Output false, repeat in loop
Moving slider to 0 --> 0 sec. Output True, 10 sec. Output false, repeat in loop

I found a working way with 2 trigger events when using the slider within 1 to 9 seconds. But when using 0 or 10 (the min and maximum of the slider) this is not working any more.
It should also work for 0 and 10 as the requested application sometimes requires continous ON or OFF without switching.

Can you please give me support or some hints. I was also looking for a module in pallette but was not able to find proper one.

Thanks!

Kind regards
Raspi133

What is your end use case? If you are trying to get a time proportioned output for controlling a heater or similar then look at node-red-contrib-timeprop which is designed for exactly this.

Welcome to the forum @Raspi133

When asking for help it pays to help the helpers to help you :wink:

Try to provide as much information as possible and clearly define your question, as this removes the need for lots of back and forth messages.

For example

These 2 paragraphs are not very clear, does this describe it better ?

Moving slider to 3 --> 3 sec. Output True, 7 sec. Output false , repeat in loop
Moving slider to 5 --> 5 sec. Output True, 5 sec. Output false , repeat in loop
Moving slider to 10 --> Continuous Output True
Moving slider to 0 --> Continuous Output False

Can you provide a copy of what you have tried so far, you can paste your flow here.

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

Hi All,
many thanks for your very quick reply. I deleted all my last non working flows but will now try with node-red-contrib. Will let you know if working or will drop copy of my attempt.

CU soon
Thanks!

Hi All,

node-red-contrib-timeprop is exactly what I was looking for. It works already. Many Thanks!

Is it possible to inject variables for cycle time via external value? How to do this?

example:
msg.payload = 20
msg.topic = Cycle time

[
    
    {
        "id": "15182394d389206c",
        "type": "inject",
        "z": "00c736e69239d4d6",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0.5",
        "payloadType": "num",
        "x": 310,
        "y": 640,
        "wires": [
            [
                "52b526e4f73aec07"
            ]
        ]
    },
    {
        "id": "52b526e4f73aec07",
        "type": "timeprop",
        "z": "00c736e69239d4d6",
        "name": "",
        "cycleTime": "20",
        "deadTime": 0,
        "triggerPeriod": "1",
        "invert": false,
        "x": 520,
        "y": 640,
        "wires": [
            [
                "89688a8e5849e761"
            ]
        ]
    },
    {
        "id": "89688a8e5849e761",
        "type": "change",
        "z": "00c736e69239d4d6",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "0",
                "fromt": "num",
                "to": "false",
                "tot": "bool"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "1",
                "fromt": "num",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 750,
        "y": 640,
        "wires": [
            [
                "a40790c551026527"
            ]
        ]
    },
    {
        "id": "a40790c551026527",
        "type": "debug",
        "z": "00c736e69239d4d6",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1000,
        "y": 640,
        "wires": []
    },
   
]

No, sorry. I did not imagine that would be something that would be required when I wrote it.