N-R Newbie help - input_boolean state to numeric value modbus:flex write

HEY - absolute NR newbie here. I know how to do this in HA in a template but I want to convert a input_boolean.on_off to a number and I dont know enough about function nodes to work it out.

Essentially I want to pass an ‘on’/‘off’ state of the input bool to the value variable in the modbus:flex write node the value is

For ‘on’ state
'value': 18

For ‘off’ state
'value': 1

Any help is greatly appreciated.

Make an “events: state” that react to the change of the boolean.
Then link that node up to a “switch” where one rule is for == (a…z) On and the other rule is for == (a…z) Off.
Then link the outputs to a “change” and set the values for 18 and one for the corresponding outputs from the “switch”.

Hey thanks @WallyR - I get what you mean.

Slight problem… is there a reason why NO input_bools appear in the entity dropdown/selector in events:state???

Input_number and timer both appear but bools dont???

I have over 100 bools defined in HA

I don’t think they are actually called booleans in HA language.
I can’t remember it exactly, but it could be toggle.