Jump to content

MQTT IO-4 v2 Input No Message


rwblinn

Recommended Posts

Hi,

using Node-RED - trying to MQTT listen to input state changes of an IO-4 v2 bricklet having a push-button connected to channel 1 configured as input pull-up.

Issue: When pushing the button, no MQTT message is received - see 2).

Tested first in the Brick Viewer 2.4.11 and the value changes for channel from low to high when pressing the push-button.

Node-RED Nodes Configuration

1) mqtt in with topic tinkerforge/#. Messages are received (see below test channel 0 as output)

Tested OK (MQTT message received) the IO-4 state change of channel 0 (output) - led connected - using in a function node with msg.payload input true or false

//Bricklet: IO-4 - Example to set pin 0 high | low
var brickletUID = "G4d";
var topicPrefix = "tinkerforge/request/io4_v2_bricklet/";
var topicSuffix = "/set_configuration";

msg.topic = topicPrefix+brickletUID+topicSuffix;
msg.payload = {"channel": 0, "direction": "out", "value": msg.payload};
node.status({text:"State:"+msg.payload.value});

return msg;  

2) Channel 1 as Input with a push-button connected.

Configured a function node as follows - no MQTT message received when pushing the button

//IO-4 - example set callback configuration
var brickletUID = "G4d";
var topicPrefixRequest = "tinkerforge/request/io4_v2_bricklet/";
var topicPrefixRegister = "tinkerforge/register/io4_v2_bricklet/";

msg.topic = topicPrefixRequest+brickletUID+"/set_configuration";
msg.payload = {"channel": 1, "direction": "i", "value":true}; 
node.send(msg);

msg.topic = topicPrefixRequest+brickletUID+"/set_all_input_value_callback_configuration";
msg.payload = {"period": 0, "value_has_to_change": true}; 
node.send(msg);

msg.topic = topicPrefixRegister+brickletUID+"/all_input_value";
msg.payload = {"register":true}; 
node.send(msg);

msg.topic = topicPrefixRequest+brickletUID+"/get_configuration";
msg.payload = {"channel":1}; 
node.send(msg);

What is wrong in the configuration?

Link zu diesem Kommentar
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...