Erroneous JSON: Connected
Metus88 opened this issue · 12 comments
I updeted the plugin.
After in my home assistant log file appears:
2020-10-18 18:14:47 WARNING (MainThread) [homeassistant.components.mqtt] Erroneous JSON: Connected 2020-10-18 18:14:47 WARNING (MainThread) [homeassistant.components.mqtt] Erroneous JSON: Connected 2020-10-18 18:14:47 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: Connected, template: {{value_json._event}})
So I activated the debug to have more information.
2020-10-18 18:14:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on octoPrint/mqtt (retained): b'disconnected'
2020-10-18 18:14:47 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to octoPrint/mqtt, mid: 36
2020-10-18 18:14:47 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to octoPrint/mqtt, mid: 37
2020-10-18 18:14:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on octoPrint/hass/Connected (retained): b'Connected'
2020-10-18 18:14:47 WARNING (MainThread) [homeassistant.components.mqtt] Erroneous JSON: Connected
......
......
.....
.....
2020-10-18 18:14:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on octoPrint/hass/printing (retained): b'{"_timestamp": 1603032794, "offsets": {}, "job": {"estimatedPrintTimeFormatted": "1:00:15.158647", "averagePrintTime": 3328.782501386, "lastPrintTime": 3328.782501386, "user": "metus", "file": {"origin": "local", "name": "CE3PRO_google_home_mini_stand_base.gcode", "date": 1603027615, "path": "CE3PRO_google_home_mini_stand_base.gcode", "display": "CE3PRO_google_home_mini_stand_base.gcode", "size": 618490}, "estimatedPrintTime": 3615.1586471210103, "filament": {"tool0": {"volume": 5.600047024887208, "length": 2328.22900390625}}}, "state": {"text": "Operational", "flags": {"cancelling": false, "paused": false, "operational": true, "pausing": false, "printing": false, "resuming": false, "sdReady": true, "error": false, "ready": true, "finishing": false, "closedOrError": false}}, "currentZ": 10.0, "progress": {"completion": 100.0, "filepos": 618490, "printTimeFormatted": "0:55:28", "printTimeLeftFormatted": "0:00:00", "printTimeLeft": 0, "printTime": 3328, "printTimeLeftOrigin": null}}'
2020-10-18 18:14:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on octoPrint/temperature/tool0 (retained): b'{"_timestamp": 1603032907, "actual": 101.97, "target": 0.0}'
2020-10-18 18:14:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on octoPrint/temperature/tool0 (retained): b'{"_timestamp": 1603032907, "actual": 101.97, "target": 0.0}'
2020-10-18 18:14:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on octoPrint/temperature/bed (retained): b'{"_timestamp": 1603032903, "actual": 38.08, "target": 0.0}'
2020-10-18 18:14:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on octoPrint/hass/Connected (retained): b'Connected'
2020-10-18 18:14:47 WARNING (MainThread) [homeassistant.components.mqtt] Erroneous JSON: Connected
2020-10-18 18:14:47 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: Connected, template: {{value_json._event}})
I don't understand how to solve the problem. Is there some problem with the message "Connected"? and "value_json._event"?
Am I the only one to have this problem?
Hello. I too have the same error appearing in log.
I tried to delate my MQTT retained with these guide. I deleted the file mosquitto.db and maybe the error disappeared. (Better say: it disappears for now).
EDIT:
It appears again:
2020-10-20 16:41:56 WARNING (MainThread) [homeassistant.components.mqtt] Erroneous JSON: Connected
2020-10-20 16:41:56 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: Connected, template: {{value_json._event}})
any news?
I'll take a look this weekend. In the mean time would you goto your integrations, MQTT, and the device for your printer. There is a link for "MQTT Info", could you paste the configuration used for the connected sensor please.
Thanks for the report.
Sorry for the formatting but I not able to do better. Sorry for the Italian language in some part of the info.
And I don't know if I have to expand all
'metus_s_ender Connected' (binary_sensor.metus_s_ender_connected)
MQTT discovery data:
Topic: homeassistant/binary_sensor/415C6D_CONNECTED/config
Payload
payload_on: Connected
payload_available: connected
name: metus_s_ender Connected
device_class: connectivity
unique_id: 415C6D_CONNECTED
json_attributes_topic: octoPrint/hass/Connected
state_topic: octoPrint/hass/Connected
payload_not_available: disconnected
availability_topic: octoPrint/mqtt
device:
manufacturer: Clifford Roche
name: metus_s_ender
model: HomeAssistant Discovery for OctoPrint
sw_version: HomeAssistant Discovery for OctoPrint 3.1.0
identifiers:
- XXXXXX (it's a secret! ahahahahaha)
connections:
- - mac
- 'it's a secret! ahahahahaha'
payload_off: Disconnected
value_template: '{{value_json._event}}'
platform: mqtt
Subscribed topics:
octoPrint/mqtt
10 messaggi ricevuti più di recente
Received 14:11:21
QoS: 0, Retained
Payload: disconnected
Received 14:11:21
QoS: 0, Retained
Payload: disconnected
Received 14:11:21
QoS: 0, Retained
Payload: disconnected
Received 14:11:21
QoS: 0, Retained
Payload: disconnected
Received 14:11:21
QoS: 0, Retained
Payload: disconnected
Received 14:11:21
QoS: 0, Retained
Payload: disconnected
Received 14:11:21
QoS: 0, Retained
Payload: disconnected
Received 14:11:21
QoS: 0, Retained
Payload: disconnected
Received 14:11:21
QoS: 0, Retained
Payload: disconnected
Received 14:11:21
QoS: 0, Retained
Payload: disconnected
octoPrint/hass/Connected
2 messaggi ricevuti più di recente
Received 14:11:21
QoS: 0, Retained
Payload: Connected
Received 14:11:21
QoS: 0, Retained
Payload: Connected
I updated, but is it possible that the problem is not fixed?
2020-10-30 15:13:50 WARNING (MainThread) [homeassistant.components.mqtt] Erroneous JSON: Connected
2020-10-30 15:13:50 WARNING (MainThread) [homeassistant.components.mqtt] Erroneous JSON: Connected
2020-10-30 15:14:02 WARNING (MainThread) [homeassistant.components.mqtt] Erroneous JSON: Connected
Do I have to delate mqtt integration and add the printer again?
Do I have to reinstall mosquito mqtt server?
'metus_s_ender Connected' (binary_sensor.metus_s_ender_connected)
MQTT discovery data:
Topic: homeassistant/binary_sensor/415C6D_CONNECTED/config
Payload
payload_on: Connected
payload_available: connected
name: metus_s_ender Connected
device_class: connectivity
unique_id: 415C6D_CONNECTED
json_attributes_topic: octoPrint/hass/Connected
state_topic: octoPrint/hass/Connected
payload_not_available: disconnected
availability_topic: octoPrint/mqtt
device:
manufacturer: Clifford Roche
name: metus_s_ender
model: HomeAssistant Discovery for OctoPrint
sw_version: HomeAssistant Discovery for OctoPrint 3.1.1
identifiers:
- XXXXXX (it's a secret! ahahahahaha)
connections:
- - mac
- 'XXXXXXX' (it's a secret! ahahahahaha)
payload_off: Disconnected
platform: mqtt
Subscribed topics:
octoPrint/mqtt
10 messaggi ricevuti più di recente
Received 15:16:31
QoS: 0, Retained
Payload: connected
Received 15:16:31
QoS: 0, Retained
Payload: connected
Received 15:16:31
QoS: 0, Retained
Payload: connected
Received 15:16:31
QoS: 0, Retained
Payload: connected
Received 15:16:31
QoS: 0, Retained
Payload: connected
Received 15:16:31
QoS: 0, Retained
Payload: connected
Received 15:16:31
QoS: 0, Retained
Payload: connected
Received 15:16:31
QoS: 0, Retained
Payload: connected
Received 15:16:31
QoS: 0, Retained
Payload: connected
Received 15:16:31
QoS: 0, Retained
Payload: connected
octoPrint/hass/Connected
2 messaggi ricevuti più di recente
Received 15:16:31
QoS: 0, Retained
Payload: Connected
Received 15:16:32
QoS: 0, Retained
Payload: Connected
You should only need to delete the device, and then restart octoprint (to re-register it). I think there is something stuck in the UI cache that leads to this... there is not json using templates now so I don't see a reason for the error.
Thanks! I tried to delete the device but without change name, the error still remains.
To fix my problem I deleted the mosquito database. I followed this instruction .
sudo systemctl stop mosquitto.service
sudo rm /var/lib/mosquitto/mosquitto.db
sudo systemctl start mosquitto.service
I'm sad, the problem is still there.... I delated all my maria database, all my mosquito mqtt server, all my integration.... I uninstalled the plugin from octoprint and I reinstalled it but the error is still there...
I'll see what happens on my printers this weekend. But I'm guessing there is something wrong with the sensor config schema we simply cannot see from the UI.
thanks, I tried also to edit the file in /home/pi/oprint/lib/python2.7/site-packages/octoprint_homeassistant/init.py editing the words "Connected" vs "connected" but no luck... Thanks again