Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

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?

Geschrieben

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.

Geschrieben
  • Autor

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.

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...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.