Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT Bridge crash : TypeError: Cannot convert undefined or null to object #17

Open
jmbinette opened this issue Jan 20, 2020 · 3 comments

Comments

@jmbinette
Copy link

jmbinette commented Jan 20, 2020

Hi to all,

MQTT bridge service is continuoulsy restarting and I have the error :

2020-01-20 11:06:42 AM info: Listening at http://localhost:8082
2020-01-20 11:06:42 AM debug: From MQTT: smartthings/maison-rpi4/winesensor_cellier_1/battery/set_state = 97
/usr/local/lib/node_modules/mqtt-bridge-smartthings/mbs-server.js:477
Object.keys(subscribe[topic]).forEach(function(name) {
^
TypeError: Cannot convert undefined or null to object
at Function.keys ()
at MqttClient.parseMQTTMessage (/usr/local/lib/node_modules/mqtt-bridge-smartthings/mbs-server.js:477:10)
at MqttClient.emit (events.js:189:13)
at MqttClient._handlePublish (/usr/local/lib/node_modules/mqtt-bridge-smartthings/node_modules/mqtt/lib/clie
at MqttClient._handlePacket (/usr/local/lib/node_modules/mqtt-bridge-smartthings/node_modules/mqtt/lib/clien
at work (/usr/local/lib/node_modules/mqtt-bridge-smartthings/node_modules/mqtt/lib/client.js:283:12)
at process._tickCallback (internal/process/next_tick.js:61:11)
mqtt-bridge-smartthings.service: Main process exited, code=exited, status=1/FAILURE
mqtt-bridge-smartthings.service: Failed with result 'exit-code'.
[+] 0.2.197 20-01-2020 11:06:48 am [CMD-ERRO] fatal mqtt error - messages may not be delivered as intended (network is down. e
mqtt-bridge-smartthings.service: Service RestartSec=10s expired, scheduling restart.
mqtt-bridge-smartthings.service: Scheduled restart job, restart counter is at 183.
Stopped SmartThings - MQTT Bridge.
Started SmartThings - MQTT Bridge.

@jmbinette jmbinette reopened this Jan 20, 2020
@jmbinette
Copy link
Author

jmbinette commented Jan 20, 2020

I deleted state.json and restarted the bridge.

Any code modifications possible to prevent crashing on wrong data type ?

@sgupta999
Copy link
Owner

I think you might be on an older version of the server. Could you please update to latest version and let me know if you are still seeing the error?

@jmbinette
Copy link
Author

Hi,

I just updated my version, we will see

For my other issue on the SmartThings forum, I will open another issue right away

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants