rwblinn Geschrieben May 8, 2020 at 16:56 Share Geschrieben May 8, 2020 at 16:56 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 Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
rtrbt Geschrieben May 11, 2020 at 08:38 Share Geschrieben May 11, 2020 at 08:38 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 Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
rwblinn Geschrieben May 11, 2020 at 09:10 Autor Share Geschrieben May 11, 2020 at 09:10 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"}' Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
rtrbt Geschrieben May 11, 2020 at 10:14 Share Geschrieben May 11, 2020 at 10:14 Hi, Seems like my edit interleaved with you loading the thread. Can you please try again with the ee8d2719-Version? Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
rwblinn Geschrieben May 11, 2020 at 10:32 Autor Share Geschrieben May 11, 2020 at 10:32 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) Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
rtrbt Geschrieben May 11, 2020 at 11:51 Share Geschrieben May 11, 2020 at 11:51 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. Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
rwblinn Geschrieben May 11, 2020 at 12:53 Autor Share Geschrieben May 11, 2020 at 12:53 Confirmed working ok. Tested various RPi. Thanks a lot for your help. Appreciated. Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
photron Geschrieben May 11, 2020 at 13:33 Share Geschrieben May 11, 2020 at 13:33 Fixes have been released as part of MQTT bindings version 2.0.10. 1 Zitieren Link zu diesem Kommentar 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.