"Failed to parse JSON string"

I am trying to repeat the steps from this instruction: https://flows.nodered.org/flow/b50779ea99f3daf38acc1ee6bed16c5b
But, I get errors all the time: "Failed to parse JSON string"

I installed "zigbee2mqtt" on "Ubuntu 20.04" following this instruction. https://www.zigbee2mqtt.io/getting_started/running_zigbee2mqtt.html
Node-Red I installed following this instruction https://nodered.org/docs/getting-started/local
Everything was established normally.

my configuration.yaml

homeassistant: false
permit_join: false
advanced:
  channel: 26
  soft_reset_timeout: 3000
  log_level: debug
  report: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://192.168.18.101:1883'
serial:
  port: /dev/ttyACM0
  disable_led: false
experimental:
  livolo: true
devices:
  '0x680ae2fffe2ec6fd':
    friendly_name: '0x680ae2fffe2ec6fd'
  '0xccccccfffea4972a':
    friendly_name: '0xccccccfffea4972a'
  '0x588e81fffe4d159b':
    friendly_name: '0x588e81fffe4d159b'
  '0x588e81fffe36a343':
    friendly_name: '0x588e81fffe36a343'
  '0x000b3cfffef7c423':
    friendly_name: '0x000b3cfffef7c423'

The screenshot shows that the connection to "MQTT" is successful https://ibb.co/fGjw9YC
But I don't understand why the data is not parsed! :frowning:

FYI, in configuration.yaml, change the "friendly_name"'s to something that is "friendly", then you will receive the friendly names in node-red (restart zigbee2mqtt once done), you don't have to parse the yaml file.

First connect a debug node to the zigbee mqtt node, set the output to "complete msg object" and post the output here. The reason why you get the "Failed to parse JSON string" errors is because the debug node is set to display the msg.payload. The mqtt node however, outputs strings of data, hence the error.

I will change the "friendly_name" later. Or it is important?

I did as you said and made a screen. Only the coordinator is seen.
the screen: https://ibb.co/SNLTtzW

I will change the "friendly_name" later. Or it is important?

Well you are creating a flow that reads the yaml file to translate the names, which is unnecessary.

What topic are you subscribed to ?
Use zigbee2mqtt/# and you might have to wait for your devices to emit data.

Yes, I am subscribed to "zigbee2mqtt/#"
I have been in this state for a long time and nothing changes!
screen: https://ibb.co/FW8gMgj

set the mqtt node output to autodetect.

note that you can drag screenshots in edit window directly.

It started working! now I think need just wait for when all the devices to start displayed!
THANK YOU!!!


It worked yesterday! And today it's writes an error: "TypeError: Cannot read property 'length' of undefined"
I just in configuration.yaml, changed the "friendly_name" and rebooted.
my "new" configuration.yaml

homeassistant: false
permit_join: false
advanced:
  channel: 26
  soft_reset_timeout: 3000
  log_level: debug
  report: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://192.168.18.101:1883'
serial:
  port: /dev/ttyACM0
  disable_led: false
experimental:
  livolo: true
devices:
  '0x680ae2fffe2ec6fd':
    friendly_name: dimmer_round
  '0xccccccfffea4972a':
    friendly_name: dimmer_quadratic
  '0x588e81fffe4d159b':
    friendly_name: motion_sensor
  '0x588e81fffe36a343':
    friendly_name: color_lamp
  '0x000b3cfffef7c423':
    friendly_name: wall_socket

my code: https://pastebin.com/fxS5dZ82

The friendly name should be a string “blabla”.

The error comes from the “update chart” node.

Thanks for the answer! I will keep in mind for the next time then I will rename my devices.
now I returned to yesterday's value i.e. to the original default name.
And still doesn't work!

And yes i see that the error comes from the “update chart” node. But, this knowledge does not help me!

now my configuration.yaml

homeassistant: false
permit_join: false
advanced:
  channel: 26
  soft_reset_timeout: 3000
  log_level: debug
  report: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://192.168.18.101:1883'
serial:
  port: /dev/ttyACM0
  disable_led: false
experimental:
  livolo: true
devices:
  '0x680ae2fffe2ec6fd':
    friendly_name: '0x680ae2fffe2ec6fd'
  '0xccccccfffea4972a':
    friendly_name: '0xccccccfffea4972a'
  '0x588e81fffe4d159b':
    friendly_name: '0x588e81fffe4d159b'
  '0x588e81fffe36a343':
    friendly_name: '0x588e81fffe36a343'
  '0x000b3cfffef7c423':
    friendly_name: '0x000b3cfffef7c423'

You post your flow (as a screenshot). I point out where the error comes from, how can it not help you ?

Who created the flow ?

sorry!
I do not understand why the node "update chart" don't get data of the battery.
my code of flow: https://pastebin.com/t1zgvsrd
I am beginer in "Node-Red" and I trying to repeat the steps from this instruction: https://flows.nodered.org/flow/b50779ea99f3daf38acc1ee6bed16c5b

That flow seems to be setup in an odd way.
I would delete all nodes and start from scratch to start learning node-red.

Start with the mqtt node and a debug node, determine the data you receive and after that, watch all the videos in this playlist to get an understanding of node-red and how it works.

1 Like

ok, thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.