Big Timer how to change payload from 1 to 0 and 0 to 1

This my second day learning node-red and I have no coding experience other than Basic (25 years ago).
Here is the question:
Is there a better way to change default payload output of Big Timer than adding 2 “change” nodes in parallel?
image

Here is snap shot of change node

A solution using only one change node:

not

Thanks, Definetly better than 2 nodes.
Is there a tutorial on preinstalled nodes covering all possible options?

You could use output 1 of the bigtimer node and get it to send the values you want. No change node needed at all.

Can't see any possible chance to even create such "There is all covered" tutorials. It's like everybody should have it's own printed version of Google. But here you can safely rely on power of Node-RED community :slight_smile: Always up to date.

1 Like

I’ve tried that and couldn’t get it to work
Node-red v0.19.5
Bigtimer v2.1.8
How do I set output 1 of big timer to output numbers instead of strings?

If you absolutely need numbers then you are right. What are you doing that needs them to be numbers?

Controlling gpio pins on rpi to activate relays.
Since initial state of gpio pin is high(1) I couldn’t use default output2 ( 1 for on, 0 for off) of big timer to control it

I don't know, but have you checked whether GPIO Out works with strings "0" and "1"?

Not 100% sure but I think it’s only 0,1
I could have a change node in front of each pin and have different types of payloads to work with, but at this moment I don’t see any reasons why would I want to use something besides 0 and 1. It is a relay and it’s ether on or off.
Also, ones I’m done with this project I would like it to be as simple as possible and easy to troubleshoot.

I meant that the GPIO node might be perfectly happy with strings instead of numbers so you would simplify the flow by just feeding output 1 of the bigtimer direct to the GPIO node. On the other hand it might be better to say you will always make sure it is numeric 0 and 1, in which case you are stuck with the change nodes.

Just tried. Gpio doesn’t respond
I don’t mind using multiple nodes if I have to.
Big timer is a little too complex for my purposes and It would be the first node to look at if something start malfunctioning. But as of right now it seems to be working properly.
Can’t wait to gut my good old fashioned mechanical timer which currently controls all outdoor lights and replace it with 8 channel relay board.

Thanks for your help everyone

The gpio node should accept both 1/0 (number) and “1”/“0” (string) and true/false (Boolean) so there should be no need to convert. If not then I’d like to understand

In Gpio node properties it says “Tip: For digital output - input must be 0 or 1”
Maybe it will accept other inputs, but it didn’t in my flow.
Maybe there are other gpio nodes out there that will accept various inputs.
I can’t help you to understand, no clue myself how node-red works I’m dragging, dropping, connecting, debugging and see what comes out

Well spotted - it does indeed say that ... though it doesn't actually specify string or number - the implication is that it's a number.

I have just tested and it does work with both strings and numbers (and booleans as well) ... so yes I'll clarify the docs.

You may want to retry in your flow - or share a small part of your flow here so we can try to see why it didn't work for you.

Thanks

Yes, indeed it does work now.
It didn’t at first because when flow was created I started with gpio node, dashboard switch node, and later added big timer.
Dashboard switch was set to output numbers 0,1 pass through enabled.
When string from big timer inputs the switch (set for numbers) the output will always be 1.
When switch is set to output strings, everything works as it should.

1 Like

Maybe node-red-contrib-schedex is the right node for your purpose?

Actually Bigtimer might become more useful. In last 4 days I’ve got myself ESP8266 board to replace RPi as controller of 8ch relay board.
To make it work I’ll have to start using MQTT protocol