Working with Date and Time

Hi!

I have a field in the dashboard called Time League and Other Field called Time Off, both of type time.

You can compare if the clock time is the same as the Time or Time node Turns it off to perform an action.

I've seen components that turn on and off at pre-set times.
I wanted to leave those values on the dashboard to have more freedom of change.

I am not sure what your question is, can you try and ask it again please?

OK, let's go!

I have one the following component:

[{"id":"7f0ab78e.075048","type":"ui_text_input","z":"6dab2b1d.f7d284","name":"","label":"","group":"d0992582.f6b428","order":0,"width":0,"height":0,"passthru":true,"mode":"time","delay":300,"topic":"","x":1360,"y":860,"wires":[[]]},{"id":"d0992582.f6b428","type":"ui_group","z":"","name":"Componentes para Teste","tab":"ff7880d6.482cd","order":2,"disp":true,"width":"6","collapse":false},{"id":"ff7880d6.482cd","type":"ui_tab","z":"","name":"Testes","icon":"dashboard","order":5}]

I'll come in with some schedule on it.

I would like the current schedule to be the same as the configured schedule would perform an action.

I'm also not sure if I understood correctly what is your question.
As far as I understood you will receive a timestamp on a payload into your "text input" node right? And you don't want that the "text input" node assumes the received payload, right?
If this is the case you can add a "change" node that will remove the payload of the message

Try it:
[{"id":"4564a8ae.809a18","type":"ui_text_input","z":"ee93a7ae.bcaa68","name":"","label":"","group":"40d12c28.d68944","order":0,"width":0,"height":0,"passthru":false,"mode":"time","delay":300,"topic":"","x":660,"y":180,"wires":[[]]},{"id":"5bf5e48e.db6a8c","type":"inject","z":"ee93a7ae.bcaa68","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":180,"wires":[["34aed07d.3ab21"]]},{"id":"34aed07d.3ab21","type":"change","z":"ee93a7ae.bcaa68","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":180,"wires":[["4564a8ae.809a18"]]},{"id":"40d12c28.d68944","type":"ui_group","z":"","name":"Componentes para Teste","tab":"1f2f9754.6dccf9","order":2,"disp":true,"width":"6","collapse":false},{"id":"1f2f9754.6dccf9","type":"ui_tab","z":"","name":"Testes","icon":"dashboard","order":5}]

Obs: também podemos conversar em português se você se sentir mais confortável assim :slight_smile:

Ufa @machadotiago agora vai melhorar bastante.
O tradutor tá quebrando minhas pernas.

Então, deixa eu explicar em português que vai ser mais fácil.

Eu tenho o time input no meu dashboard que irei setar o meu tempo, por exemplo, para ligar a TV.

E gostaria que sempre que chegar no horário configurado no input time eu iria executar uma ação.
Como uso o Home Assistant, sempre que chegar nesse horário ele irá chamar um serviço do Home Assistant.

Boa tarde dedynobre

If you wanted to set the timing dinamically check for schedex https://www.npmjs.com/package/node-red-contrib-schedex

If you look over the forum will find there is another discussion about this topic.

Regards

1 Like

OK,

fiz o seguinte:

[{"id":"a90d4d3d.a505c","type":"ui_text_input","z":"3078e521.688d6a","name":"","label":"","group":"dde7b5.6f265848","order":0,"width":0,"height":0,"passthru":false,"mode":"time","delay":300,"topic":"","x":420,"y":180,"wires":[["45c862b4.64e9ec"]]},{"id":"b9e9a1e7.b2468","type":"inject","z":"3078e521.688d6a","name":"","topic":"","payload":"liga","payloadType":"global","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":240,"wires":[["7e57743d.63f20c"]]},{"id":"5dde8ec9.97193","type":"debug","z":"3078e521.688d6a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":950,"y":240,"wires":[]},{"id":"f9adc51c.d30c38","type":"schedex","z":"3078e521.688d6a","name":"","suspended":false,"lat":"","lon":"","ontime":"00:00","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"goldenHour","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":670,"y":240,"wires":[["5dde8ec9.97193"]]},{"id":"7e57743d.63f20c","type":"change","z":"3078e521.688d6a","name":"","rules":[{"t":"set","p":"payload.ontime","pt":"msg","to":"liga","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":240,"wires":[["f9adc51c.d30c38"]]},{"id":"45c862b4.64e9ec","type":"change","z":"3078e521.688d6a","name":"","rules":[{"t":"set","p":"liga","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":180,"wires":[[]]},{"id":"dde7b5.6f265848","type":"ui_group","z":"","name":"Componentes para Teste","tab":"c4d69d67.5f1c1","order":2,"disp":true,"width":"6","collapse":false},{"id":"c4d69d67.5f1c1","type":"ui_tab","z":"","name":"Testes","icon":"dashboard","order":5}]

Mas nao deu certo.

Eu passei msg.payload.time com o valor do input time mas da erro.

Boa noite dedy

Please read a bit the docu, you will find how to set all options, as example test this:

[{"id":"6b211f47.a1146","type":"debug","z":"45bdc7c3.85f6b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":889,"y":214,"wires":[]},{"id":"4e05f7de.2e01f8","type":"schedex","z":"45bdc7c3.85f6b8","name":"","suspended":false,"lat":"","lon":"","ontime":"00:00","ontopic":"","onpayload":"","onoffset":0,"onrandomoffset":0,"offtime":"goldenHour","offtopic":"","offpayload":"","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":609,"y":214,"wires":[["6b211f47.a1146"]]},{"id":"a1757a9c.6dc8a8","type":"ui_dropdown","z":"45bdc7c3.85f6b8","name":"","label":"ON","place":"Select option","group":"4a87f70d.f8be18","order":0,"width":0,"height":0,"passthru":true,"options":[{"label":"1:00","value":"ontime 1:00","type":"str"},{"label":"2:00","value":"ontime 2:00","type":"str"}],"payload":"","topic":"","x":315,"y":163,"wires":[["4e05f7de.2e01f8"]]},{"id":"b3b357f7.a05f88","type":"ui_dropdown","z":"45bdc7c3.85f6b8","name":"","label":"OFF","place":"Select option","group":"4a87f70d.f8be18","order":0,"width":0,"height":0,"passthru":true,"options":[{"label":"3:00","value":"offtime 3:00","type":"str"},{"label":"4:00","value":"offtime 4:00","type":"str"}],"payload":"","topic":"","x":309,"y":257,"wires":[["4e05f7de.2e01f8"]]},{"id":"4a87f70d.f8be18","type":"ui_group","z":"","name":"Componentes para Teste","tab":"8832090d.208368","order":2,"disp":true,"width":"6","collapse":false},{"id":"8832090d.208368","type":"ui_tab","z":"","name":"Testes","icon":"dashboard","order":5}]

Olá @davidcgu,

O exemplo que voce enviou funcionou conforme gostaria.

Eu li o documento sĂł que nĂŁo consegui passar os parametros corretamente.

Muito obrigado pela ajuda.