Jump to content

rwblinn

Members
  • Content Count

    106
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Confirmed working ok. Tested various RPi. Thanks a lot for your help. Appreciated.
  2. Tested = same error - running Python 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0] on linux2 on a Raspberry Pi 3B+ (Buster) 2020-05-11 12:30:39,165 <DEBUG> MQTT bindings: Calling function write_line for device rTS of type lcd_20x4_bricklet. 2020-05-11 12:30:39,167 <ERROR> MQTT bindings: argument for 's' must be a string (call of write_line of lcd_20x4_bricklet rTS) 2020-05-11 12:30:39,169 <DEBUG> MQTT bindings: Calling function write_line for device rTS of type lcd_20x4_bricklet succedded. 2020-05-11 12:30:39,170 <DEBUG> MQTT bindings: Publishing response to tinkerforge/response/lcd_20x4_bricklet/rTS/write_line 2020-05-11 12:30:39,172 <DEBUG> paho.mqtt.client: Sending PUBLISH (d0, q0, r0, m5), 'tinkerforge/response/lcd_20x4_bricklet/rTS/write_line', ... (2 bytes)
  3. Thanks for the update. 1/ Confirmed get_identity working. tinkerforge/request/lcd_20x4_bricklet/rTS/get_identity (null) tinkerforge/response/lcd_20x4_bricklet/rTS/get_identity {"connected_uid": "5VGrDJ", "uid": "rTS", "device_identifier": "lcd_20x4_bricklet", "hardware_version": [1, 2, 0], "position": "b", "firmware_version": [2, 0, 6], "_display_name": "LCD 20x4 Bricklet"} 2/ Write_line not working. Does this happen every time you attempt to call write_line? YES, tried on two different RPi's running latest bindings or only in specific cases? NO Did you call any other functions before calling write_line? Using bash script (tested on the two systems): cat lcd2004_write_line.sh #!/bin/bash mosquitto_pub -t tinkerforge/request/lcd_20x4_bricklet/rTS/backlight_on -m '' mosquitto_pub -t tinkerforge/request/lcd_20x4_bricklet/rTS/clear_display -m '' mosquitto_pub -t tinkerforge/request/lcd_20x4_bricklet/rTS/write_line -m '{"line": 0, "position": 0, "text":"Hello World"}'
  4. Environment: Raspberry Pi (Raspian Buster), Python 2.7.16, MQTT Bindings 2.0.9 Issue: Publishing sample text is not displayed: mosquitto_pub -t tinkerforge/request/lcd_20x4_bricklet/rTS/write_line -m '{"line": 0, "position": 0, "text":"TEST"}' Ran Tinkerforge_mqtt with debug flag - shows an error 2020-05-08 18:42:57,560 <DEBUG> MQTT bindings: Calling function write_line for device rTS of type lcd_20x4_bricklet. 2020-05-08 18:42:57,562 <ERROR> MQTT bindings: argument for 's' must be a string (call of write_line of lcd_20x4_bricklet rTS) 2020-05-08 18:42:57,563 <DEBUG> MQTT bindings: Calling function write_line for device rTS of type lcd_20x4_bricklet succedded. 2020-05-08 18:42:57,564 <DEBUG> MQTT bindings: Publishing response to tinkerforge/response/lcd_20x4_bricklet/rTS/write_line 2020-05-08 18:42:57,569 <DEBUG> paho.mqtt.client: Sending PUBLISH (d0, q0, r0, m8), 'tinkerforge/response/lcd_20x4_bricklet/rTS/write_line', ... (2 bytes) 2020-05-08 18:42:57,572 <DEBUG> MQTT bindings: Tested the same with a) brick viewer: text is displayed, b) Python bindings = text is displayed. Also tried other lcd20x4 mqtt functions: backlight_on & off = OK get_identity = error 2020-05-08 18:55:50,901 <DEBUG> MQTT bindings: Calling function get_identity for device rTS of type lcd_20x4_bricklet. 2020-05-08 18:55:50,909 <DEBUG> MQTT bindings: Calling function get_identity for device rTS of type lcd_20x4_bricklet succedded. Traceback (most recent call last): File "/usr/local/bin/tinkerforge_mqtt", line 7366, in on_message response = self.dispatch_call(request_type, device, uid, function, payload, response_path) File "/usr/local/bin/tinkerforge_mqtt", line 7717, in dispatch_call return self.device_call(device, device_class_name, uid, fnName, fnInfo, json_args) File "/usr/local/bin/tinkerforge_mqtt", line 7823, in device_call d["_display_name"] = display_names[dev_id] NameError: global name 'display_names' is not defined
  5. [SOLVED] Rebooted the Raspberry Pi and the MQTT Bindings are working ok. Tested from the CLI and also using Node-RED flow. Thanks for help anyhow.
  6. Please find the output of running the bindings with parameter --debug. Changed the period to 5000. 2020-01-24 10:10:29,786 <DEBUG> paho.mqtt.client: Sending PUBLISH (d0, q0, r0, m582), 'b'tinnse/air_quality_bricklet/Jvj/get_all_values_callback_configuration'', ... (46 bytes) 2020-01-24 10:10:48,678 <DEBUG> paho.mqtt.client: Sending PUBLISH (d0, q0, r0, m586), 'b'tinkerforge/callback/air_quality_bricklet/Jvj/all_values'', ... (109 bytes) 2020-01-24 10:10:53,637 <DEBUG> paho.mqtt.client: Sending PUBLISH (d0, q0, r0, m587), 'b'tinkerforge/callback/air_quality_bricklet/Jvj/all_values'', ... (109 bytes) 2020-01-24 10:10:58,600 <DEBUG> paho.mqtt.client: Sending PUBLISH (d0, q0, r0, m588), 'b'tinkerforge/callback/air_quality_bricklet/Jvj/all_values'', ... (109 bytes) 2020-01-24 10:11:03,561 <DEBUG> paho.mqtt.client: Sending PUBLISH (d0, q0, r0, m589), 'b'tinkerforge/callback/air_quality_bricklet/Jvj/all_values'', ... (109 bytes) 2020-01-24 10:11:08,513 <DEBUG> paho.mqtt.client: Sending PUBLISH (d0, q0, r0, m590), 'b'tinkerforge/callback/air_quality_bricklet/Jvj/all_values'', ... (109 bytes) 2020-01-24 10:11:13,478 <DEBUG> paho.mqtt.client: Sending PUBLISH (d0, q0, r0, m591), 'b'tinkerforge/callback/air_quality_bricklet/Jvj/all_values'', ... (109 bytes)
  7. Hi, tried to setup an Air Quality Bricklet for MQTT Callback with a Raspberry Pi 4 running mosquito and the Tinkerforge MQTT Binding 2.0.6. The Brick Viewer shows all data; An MQTT request provides also the data (see below …/get_all_values request with response), but with MQTT callback no response. Question: what is wrong in below configuration? pi@4dev:~ $ mosquitto_pub -t tinkerforge/request/air_quality_bricklet/Jvj/set_all_values_callback_configuration -m '{"period": 100, "value_has_to_change":false}' pi@4dev:~ $ mosquitto_pub -t tinkerforge/register/air_quality_bricklet/Jvj/all_values -m '{"register": true}' OUTPUT pi@4dev:~ $ mosquitto_sub -v -t tinkerforge/# tinkerforge/request/air_quality_bricklet/Jvj/set_all_values_callback_configuration {"period":10,"value_has_to_change":false} tinkerforge/register/air_quality_bricklet/Jvj/all_values {"register":true} tinkerforge/request/air_quality_bricklet/Jvj/get_all_values {} tinkerforge/response/air_quality_bricklet/Jvj/get_all_values {"iaq_index": 26, "iaq_index_accuracy": "low", "temperature": 2100, "humidity": 5403, "air_pressure": 102912}
  8. OK = thanks for the update. Tested successfully: lcd.writeLine((short)0, (short)0, "Battery: " + "\u0008");
  9. Just a suggestion for a small change regarding writing a custom character with Java. Test Java Snippet // Custom Char battery assigned to index 0 (from max 7) short[] battery = new short[]{14,27,17,17,17,17,17,31}; lcd.setCustomCharacter((short)0, battery); // Display the custom char with some text lcd.writeLine((short)0, (short)0, "Battery: " + (char)0x08); Suggestion Java documentation: For section void BrickletLCD20x4.setCustomCharacter(short index, short[] character) change the line: The characters can later be written with writeLine() by using the characters with the byte representation 8 ("x08") to 15 ("x0F"). to The characters can later be written with writeLine() by using the characters with the byte representation 8 ( (char)0x08 ) to 15 ( (char)0x0F ).
  10. 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.
  11. 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?
  12. For those interested, based on previous learning's, created an Indoor Air Quality Node-RED Dashboard using MQTT. Please find on GitHub.
  13. That was a great hint. The log showed no topic, only payload, means error in node-red creating topic. The log: first line using terminal, second via node-red. tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value {"r":255,"g":0,"b":0} {"r":255,"g":0,"b":0} Changed the node-red function node creating topic with payload //Example to set a green color = RGB (0, 255, 0) var r = 0; var g = 255; var b = 0; //Mosquitto Command: //mosquitto_pub -t tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value -m '{"r":0, "g":255, "b":0}' //Translated to JavaScript Message with Topic and Payload msg.topic = "tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value"; msg.payload = {"r":r,"g":g,"b":b}; return msg; resulting in log: tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value {"r":0,"g":255,"b":0} That was good learning = again thanks for help.
  14. Yes, noted the difference in string and json from mqtt out. To note is that this node-red example setup has been used without issues using mqtt proxy v1.0. Tried to a JSON node, but again no change. Tried a string, i.e. "R",... but also no change. Output of mosquitto_sub -t tinkerforge/# {"r":0, "g":0, "b":123} Debug pi@4dev:~ $ tinkerforge_mqtt --debug 2019-09-06 14:51:22,144 <DEBUG> MQTT bindings: Configuring connection to MQTT broker at localhost:1883 2019-09-06 14:51:22,145 <DEBUG> MQTT bindings: Connected to MQTT broker at localhost:1883 2019-09-06 14:51:22,147 <DEBUG> paho.mqtt.client: Sending CONNECT (u0, p0, wr0, wq0, wf1, c1, k60) client_id= 2019-09-06 14:51:22,148 <DEBUG> paho.mqtt.client: Received CONNACK (0, 0) 2019-09-06 14:51:22,148 <DEBUG> MQTT bindings: Connected to mqtt broker. 2019-09-06 14:51:22,148 <DEBUG> paho.mqtt.client: Sending SUBSCRIBE (d0, m1) [('tinkerforge/request/#', 0)] 2019-09-06 14:51:22,149 <DEBUG> paho.mqtt.client: Sending SUBSCRIBE (d0, m2) [('tinkerforge/register/#', 0)] 2019-09-06 14:51:22,149 <DEBUG> paho.mqtt.client: Sending PUBLISH (d0, q0, r0, m3), 'tinkerforge/callback/bindings/restart', ... (4 bytes) 2019-09-06 14:51:22,149 <DEBUG> paho.mqtt.client: Sending SUBSCRIBE (d0, m4) [('tinkerforge/callback/bindings/restart', 0)] 2019-09-06 14:51:22,150 <DEBUG> MQTT bindings: Connecting to brickd at localhost:4223 2019-09-06 14:51:22,152 <DEBUG> paho.mqtt.client: Received SUBACK 2019-09-06 14:51:22,153 <DEBUG> MQTT bindings: Connected to Brick Daemon: Connection established after request from user. 2019-09-06 14:51:22,153 <DEBUG> MQTT bindings: Connected to brickd at localhost:4223 2019-09-06 14:51:22,153 <DEBUG> paho.mqtt.client: Received SUBACK 2019-09-06 14:51:22,198 <DEBUG> paho.mqtt.client: Received SUBACK 2019-09-06 14:51:28,094 <DEBUG> paho.mqtt.client: Received PUBLISH (d0, q0, r0, m0), 'tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value', ... (23 bytes) 2019-09-06 14:51:28,094 <DEBUG> MQTT bindings: 2019-09-06 14:51:28,095 <DEBUG> MQTT bindings: Calling function set_rgb_value for device Jng of type rgb_led_v2_bricklet. 2019-09-06 14:51:28,096 <DEBUG> MQTT bindings: Calling function set_rgb_value for device Jng of type rgb_led_v2_bricklet succedded. Node-RED MQTT out node In the terminal no entry subscribing tinkerforge/# In debug pi@4dev:~ $ tinkerforge_mqtt --debug 2019-09-06 14:53:50,026 <DEBUG> MQTT bindings: Configuring connection to MQTT broker at localhost:1883 2019-09-06 14:53:50,026 <DEBUG> MQTT bindings: Connected to MQTT broker at localhost:1883 2019-09-06 14:53:50,028 <DEBUG> paho.mqtt.client: Sending CONNECT (u0, p0, wr0, wq0, wf1, c1, k60) client_id= 2019-09-06 14:53:50,029 <DEBUG> paho.mqtt.client: Received CONNACK (0, 0) 2019-09-06 14:53:50,029 <DEBUG> MQTT bindings: Connected to mqtt broker. 2019-09-06 14:53:50,030 <DEBUG> paho.mqtt.client: Sending SUBSCRIBE (d0, m1) [('tinkerforge/request/#', 0)] 2019-09-06 14:53:50,030 <DEBUG> paho.mqtt.client: Sending SUBSCRIBE (d0, m2) [('tinkerforge/register/#', 0)] 2019-09-06 14:53:50,030 <DEBUG> paho.mqtt.client: Sending PUBLISH (d0, q0, r0, m3), 'tinkerforge/callback/bindings/restart', ... (4 bytes) 2019-09-06 14:53:50,031 <DEBUG> paho.mqtt.client: Sending SUBSCRIBE (d0, m4) [('tinkerforge/callback/bindings/restart', 0)] 2019-09-06 14:53:50,031 <DEBUG> MQTT bindings: Connecting to brickd at localhost:4223 2019-09-06 14:53:50,032 <DEBUG> paho.mqtt.client: Received SUBACK 2019-09-06 14:53:50,033 <DEBUG> paho.mqtt.client: Received SUBACK 2019-09-06 14:53:50,034 <DEBUG> MQTT bindings: Connected to Brick Daemon: Connection established after request from user. 2019-09-06 14:53:50,034 <DEBUG> MQTT bindings: Connected to brickd at localhost:4223 2019-09-06 14:53:50,078 <DEBUG> paho.mqtt.client: Received SUBACK
  15. Thanks for help. Using mosquito for this test is ok: Terminal 1 subscribing to all topics: mosquitto_sub -t tinkerforge/# Terminal 2 setting the color: mosquitto_pub -t tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value -m '{"r":0, "g":0, "b":123}' Terminal 1 shows: {"r":0, "g":0, "b":123} Next step is to obtain the same in Node-RED. Defined a simple flow. mqtt in node with topic tinkerforge/# and broker localhost port 1883. The mqtt in node outputs to a debug node. When changing the color via terminal, then the debug node shows: 06/09/2019, 14:15:01node: DEBUG TF ALL tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value : msg.payload : string[23] "{"r":0, "g":0, "b":123}" Now, to test changing the color via mqtt out node (and debug node) using a function node: //Example to set a green color = RGB (0, 255, 0) var r = 0; var g = 255; var b = 0; //Mosquitto Command: //mosquitto_pub -t tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value -m '{"r":255, "g":0, "b":0}' //Translated to JavaScript Message with Topic and Payload var msgmqtt = {topic: "tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value", payload:{"r":r,"g":g,"b":b} }; return msgmqtt; The debug node shows: 06/09/2019, 14:16:30node: 65847a3b.80f134 tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value : msg.payload : Object { r: 0, g: 255, b: 0 } BUT the color is not changed. Any hint what is missing in this setup?
×
×
  • Create New...