And function problem

I have a problem-i do node red just as a hobby but i need help with the switch

I have made a function -if < 90 =true
Else if > 90 false-that works but this function is connectet with an and block- an the switch which is the other input doesnt work it is alwaystrue

1Picture- Button simulates worth over 90 and the Switch is on =true
2Picture- Switch is Off -Received invalid topic
3Picture -Switch is Off Button simulates worth over 90 =True
And i dont know why the „and“ Block doesnt turns off if the Switch says false



I think that you need to have a valid but different msg.topic from the function node and the switch node.

So your switch needs to setup something like this
image

and the function needs to set msg.topic too, eg

msg.topic = "function"