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

ReferenceError: data is not defined #2

Open
elfnino opened this issue May 4, 2017 · 8 comments
Open

ReferenceError: data is not defined #2

elfnino opened this issue May 4, 2017 · 8 comments

Comments

@elfnino
Copy link

elfnino commented May 4, 2017

Hi, I have used a standart config and I am getting following error:

[5/3/2017, 10:17:05 PM] Loaded plugin: homebridge-mqtt-power-consumption-log-tasmota
[5/3/2017, 10:17:05 PM] Registering accessory 'homebridge-mqtt-power-consumption-log-tasmota.mqtt-power-consumption-log -tasmota'
[5/3/2017, 10:17:05 PM] ---
[5/3/2017, 10:17:06 PM] Loaded plugin: homebridge-mqtt-switch-tasmota
[5/3/2017, 10:17:06 PM] Registering accessory 'homebridge-mqtt-switch-tasmota.mqtt-switch-tasmota'
[5/3/2017, 10:17:06 PM] ---
[5/3/2017, 10:17:06 PM] Loaded config.json with 1 accessories and 0 platforms.
[5/3/2017, 10:17:06 PM] ---
[5/3/2017, 10:17:06 PM] Loading 0 platforms...
[5/3/2017, 10:17:06 PM] Loading 1 accessories...
[5/3/2017, 10:17:06 PM] [prvePOW] Initializing mqtt-power-consumption-log-tasmota accessory...
Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

ââââââââââââââ
â 031-45-154 â
ââââââââââââââ

[5/3/2017, 10:17:06 PM] Homebridge is running on port 51826.
[5/3/2017, 10:17:06 PM] [prvePOW] Nothing to change _hourly
[5/3/2017, 10:17:06 PM] [prvePOW] Nothing to change _daily
[5/3/2017, 10:17:06 PM] [prvePOW] Nothing to change _period
**/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/index.js:398
data = null;
^

ReferenceError: data is not defined**
at MqttClient. (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/index.js:398:9 )
at emitThree (events.js:116:13)
at MqttClient.emit (events.js:194:7)
at MqttClient._handlePublish (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_module s/mqtt/lib/client.js:821:12)
at MqttClient._handlePacket (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules /mqtt/lib/client.js:286:12)
at process (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules/mqtt/lib/client. js:242:12)
at Writable.writable._write (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules /mqtt/lib/client.js:252:5)
at doWrite (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules/readable-stream/ lib/_stream_writable.js:338:64)
at writeOrBuffer (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules/readable-s tream/lib/_stream_writable.js:327:5)
at Writable.write (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules/readable- stream/lib/_stream_writable.js:264:11)

@elfnino
Copy link
Author

elfnino commented May 30, 2017

Any suggestion what could be wrong ?

@swilalaa
Copy link

+1 Same issue here

@zhilly
Copy link

zhilly commented Jul 13, 2017

i have the same +2

@AntiHeld889
Copy link

i have the same +3

@ceraz68
Copy link

ceraz68 commented Jan 14, 2018

Hi I also get the same issue. Seems to be linked to the URL statement in json file. I'm running mosquitto server on the synology with homebridge within docker. Tried "url" as "mqtt://IP_address" or "mqtt://IP_address:1883" or "IP_address".

Has someone found a workaround or explanation ?

@ceraz68
Copy link

ceraz68 commented Jan 20, 2018

I validated my MQTT setup using the homebridge-mqtt-switch-tasmota plugin which works fine.
For the homebridge-mqtt-power-consumption-log-tasmota plugin I got access errors as the log files try to write to /root/.homebridge so I changed to the docker folder. When they were resolved back to the original error
**/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/index.js:398
data = null;
^

@Giorgiofox
Copy link
Contributor

same error here:
/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/index.js:398
data = null;
^
ReferenceError: data is not defined
at MqttClient. (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/index.js:398:9)
at emitThree (events.js:116:13)
at MqttClient.emit (events.js:197:7)
at MqttClient._handlePublish (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules/mqtt/lib/client.js:935:12)
at MqttClient._handlePacket (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules/mqtt/lib/client.js:305:12)
at work (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules/mqtt/lib/client.js:261:12)
at Writable.writable._write (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules/mqtt/lib/client.js:271:5)
at doWrite (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules/readable-stream/lib/_stream_writable.js:406:64)
at writeOrBuffer (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules/readable-stream/lib/_stream_writable.js:395:5)
at Writable.write (/usr/local/lib/node_modules/homebridge-mqtt-power-consumption-log-tasmota/node_modules/readable-stream/lib/_stream_writable.js:322:11)
at Socket.ondata (_stream_readable.js:555:20)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:554:20)

@Giorgiofox
Copy link
Contributor

Solved:
https://github.com/MacWyznawca/homebridge-mqtt-power-consumption-log-tasmota/pull/4/commits

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

6 participants