Jump to content

Recommended Posts

Geschrieben

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


 

 

 

 

Geschrieben

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

Geschrieben

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"}'

 

Geschrieben

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)

 

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

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...