rwblinn Posted May 8, 2020 at 04:56 PM Share Posted May 8, 2020 at 04:56 PM 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 Quote Link to comment Share on other sites More sharing options...
rtrbt Posted May 11, 2020 at 08:38 AM Share Posted May 11, 2020 at 08:38 AM Hi, I can not reproduce your first problem. The output looks like you are passing something that is not a string, but the type check of the bindings should detect that and print a more helpful error message. Does this happen every time you attempt to call write_line, or only in specific cases? Did you call any other functions before calling write_line? Your second problem should be fixed with the attached version of the bindings. Erik Edit: The first problem happens only when using Python 2. It should be fixed in the attached version. tinkerforge_mqtt_bindings_2_0_9_ee8d2719.zip Quote Link to comment Share on other sites More sharing options...
rwblinn Posted May 11, 2020 at 09:10 AM Author Share Posted May 11, 2020 at 09:10 AM 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"}' Quote Link to comment Share on other sites More sharing options...
rtrbt Posted May 11, 2020 at 10:14 AM Share Posted May 11, 2020 at 10:14 AM Hi, Seems like my edit interleaved with you loading the thread. Can you please try again with the ee8d2719-Version? Quote Link to comment Share on other sites More sharing options...
rwblinn Posted May 11, 2020 at 10:32 AM Author Share Posted May 11, 2020 at 10:32 AM 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) Quote Link to comment Share on other sites More sharing options...
rtrbt Posted May 11, 2020 at 11:51 AM Share Posted May 11, 2020 at 11:51 AM Are you sure that you run the right version of the bindings? I've just tested the attached zip and your script on a Pi 3B+ and it works fine. Quote Link to comment Share on other sites More sharing options...
rwblinn Posted May 11, 2020 at 12:53 PM Author Share Posted May 11, 2020 at 12:53 PM Confirmed working ok. Tested various RPi. Thanks a lot for your help. Appreciated. Quote Link to comment Share on other sites More sharing options...
photron Posted May 11, 2020 at 01:33 PM Share Posted May 11, 2020 at 01:33 PM Fixes have been released as part of MQTT bindings version 2.0.10. 1 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.