rwblinn Posted January 14, 2020 at 09:26 AM Share Posted January 14, 2020 at 09:26 AM 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? Quote Link to comment Share on other sites More sharing options...
rtrbt Posted January 14, 2020 at 09:58 AM Share Posted January 14, 2020 at 09:58 AM Hi, msg.topic = topicPrefixRequest+brickletUID+"/set_all_input_value_callback_configuration"; msg.payload = {"period": 0, "value_has_to_change": true}; node.send(msg); A period of 0 disables the callback, you have to set it to (at least) 1. Quote Link to comment Share on other sites More sharing options...
rwblinn Posted January 14, 2020 at 10:27 AM Author Share Posted January 14, 2020 at 10:27 AM Got it - overlooked the documentation "A value of 0 turns the callback off." = got mis leaded by the default value 0 (period – Type: int, Unit: 1 ms, Range: [0 to 232 - 1], Default: 0). After changing, its working fine. Thanks for the swift help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.