david-kasparov / node-red-contrib-pcf8574-cluster

3 stars 2 forks source link

How to get a pin value #1

Open kaypohl opened 6 years ago

kaypohl commented 6 years ago

Hi,

how can i use the pin value node? I can use cluster-in and cluster-out. That works, but i don`t know how to trigger the pin value node. Can you give me an example flow please?

Kay

david-kasparov commented 6 years ago

Hello,

So the pin value node takes current state of the output. I know it's a bit tricky and it's not that user-friendly.

So you can put an inject node before pin value and debug node after it.

When you inject anything into pin value node it will add a field named pin_value (msg.payload.pin_value) which will have the current value of that pin.

Typical use case for me is standard alternating switch. You can have a function node which just reverses current state of the output. msg.payload.value = !msg.payload.pin_value and push this into cluster out.

kaypohl commented 6 years ago

Hi David,

thanks for your fast response. I tried to put a debug node with msg.payload.pin_value after the pin value node, but i always get an "undefined" debug output :-(

Kay

kaypohl commented 6 years ago

When i set the output to complete msg object there is no pin_value available.

Kay

david-kasparov commented 6 years ago

Sorry I was wrong,

pin value node is triggering only when cluster in node is triggered. function node body is msg.payload.value = !msg.payload.pin_value

Check my flow.

blah
kaypohl commented 6 years ago

Ok, so that means i have to use the interrupt to get a trigger right?

david-kasparov commented 6 years ago

yes

kaypohl commented 6 years ago

Ok thanks.

kaypohl commented 6 years ago

Hey David,

i have a PCF8574A Module without an INT pin. Do you see any chance to read the Pin States of this module without an INT pin?

Kay

DeviousPenguin commented 5 years ago

Hi, I'm trying to do the same thing, get the value of a pin.

however the example is a little unclear:

Example : { "interrupts": [{ "index": 1, "pin": 24 }, { "index":2, "pin": 25 }] }

I have my interrupt pin connected to GPIO 10, which is pin 19 on the Raspberry Pi 2.

I'm only using a single pcf8574 right now, so is this how it should be set:

{ "interrupts": [{ "index": 1, "pin": 10 }] }

or should it be:

{ "interrupts": [{ "index": 1, "pin": 19 }] }

Thanks

S-Przybylski commented 5 years ago

I tried this node and found out, that it should be the GPIO number and not the pin number of the Pi layout... Therefore "pin" is missleading

Tebbes-IoT commented 4 years ago

I have two inject node with payload true and false. The output of the Cluster out always switch whether true or false.

Can I Set the output only true or false with a payload from a inject?