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

The service is not running continuously and stops. #2

Open
yltsa opened this issue Aug 29, 2022 · 10 comments
Open

The service is not running continuously and stops. #2

yltsa opened this issue Aug 29, 2022 · 10 comments

Comments

@yltsa
Copy link

yltsa commented Aug 29, 2022

Hi, the service is not running continuously and stops. Here ere are error messages from the log:

/ruuvigw2ha/index.js:116
humidity: Number(humidity.toFixed(options.decimals.humidity || 2)),
^
TypeError: Cannot read properties of undefined (reading 'toFixed')
at handleData (/ruuvigw2ha/index.js:116:33)
at MqttClient. (/ruuvigw2ha/index.js:39:5)
at MqttClient.emit (node:events:527:28)
at MqttClient._handlePublish (/ruuvigw2ha/node_modules/mqtt/lib/client.js:1277:12)
at MqttClient._handlePacket (/ruuvigw2ha/node_modules/mqtt/lib/client.js:410:12)
at work (/ruuvigw2ha/node_modules/mqtt/lib/client.js:321:12)
at Writable.writable._write (/ruuvigw2ha/node_modules/mqtt/lib/client.js:335:5)
at doWrite (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:409:139)
at writeOrBuffer (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:398:5)
at Writable.write (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:307:11)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

@Kirbo
Copy link
Owner

Kirbo commented Aug 29, 2022

That looks like you have something funky in the configurations. There might be a bug in my code as well, that's not outruled by any means, but I should be able to reproduce this, therefore I'd like to see the configuration you have (without the credentials obviously) 🙂

@Kirbo
Copy link
Owner

Kirbo commented Aug 29, 2022

Here is the example configuration that you should have:

mqtt_protocol: mqtt
mqtt_host: core-mosquitto
mqtt_port: 1883
mqtt_credentials:
  client_id: ruuvi-gw-mqtt-to-ha
  username: 
  password: 
mqtt_ha_topic: homeassistant/
mqtt_ruuvi_topic: ruuvi/#
mqtt_parsed_ruuvi_topic: ruuvi/parsed/
update_interval: 60
decimals:
  humidity: 2
  temperature: 2
  pressure: 2
  battery: 0
  voltage: 2
battery:
  minimum: 2000
  maximum: 3000
  low_battery: 2100
use_prefixes: true

@yltsa
Copy link
Author

yltsa commented Aug 29, 2022

Hi, this was working before.. Or it was running 1-3 months before it stopped and needed a new manual start. My configuration looks the same as yours:

mqtt_protocol: mqtt
mqtt_host: 192.168.0.29
mqtt_port: 1883
mqtt_credentials:
  client_id: ruuvi-gw-mqtt-to-ha
  username: XXXXXX
  password: XXXXXX
mqtt_ha_topic: homeassistant/
mqtt_ruuvi_topic: ruuvi/#
mqtt_parsed_ruuvi_topic: ruuvi/parsed/
update_interval: 60
decimals:
  humidity: 2
  temperature: 2
  pressure: 2
  battery: 0
  voltage: 2
battery:
  minimum: 2000
  maximum: 3000
  low_battery: 2100
use_prefixes: false

@Kirbo
Copy link
Owner

Kirbo commented Aug 30, 2022

Hmm, weird.. It looks as if the ruuvitag didn't have humidity set. Well, anyway, I'll make this a bit more robust soon

@Kirbo
Copy link
Owner

Kirbo commented Aug 30, 2022

I added a bit more logging in the version 2.0.2, if you could try with that and once your service restarts, check the Logs and paste a portion (preferably where the restart occurs) of it here, to help me investigate what's the issue at hand. 🙂

@yltsa
Copy link
Author

yltsa commented Aug 30, 2022

Hi, 2.0.2 is not stopping but there are some error messages in the log:

at Writable.writable._write (/ruuvigw2ha/node_modules/mqtt/lib/client.js:335:5)
at doWrite (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:409:139)
at writeOrBuffer (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:398:5)
at Writable.write (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:307:11)
parsedData {
accelerationX: -828,
accelerationY: -252,
accelerationZ: -448,
battery: 2995,
humidity: undefined,
mac: 'ED:20:26:86:0B:48',
measurementSequenceNumber: 12079,
movementCounter: 236,
pressure: undefined,
temperature: 25.525,
txPower: 4
}
TypeError: Cannot read properties of undefined (reading 'toFixed')
at handleData (/ruuvigw2ha/index.js:119:35)
at MqttClient. (/ruuvigw2ha/index.js:39:5)
at MqttClient.emit (node:events:527:28)
at MqttClient._handlePublish (/ruuvigw2ha/node_modules/mqtt/lib/client.js:1277:12)
at MqttClient._handlePacket (/ruuvigw2ha/node_modules/mqtt/lib/client.js:410:12)
at work (/ruuvigw2ha/node_modules/mqtt/lib/client.js:321:12)
at Writable.writable._write (/ruuvigw2ha/node_modules/mqtt/lib/client.js:335:5)
at doWrite (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:409:139)
at writeOrBuffer (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:398:5)
at Writable.write (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:307:11)
parsedData {
accelerationX: -840,
accelerationY: -256,
accelerationZ: -440,
battery: 2995,
humidity: undefined,
mac: 'ED:20:26:86:0B:48',
measurementSequenceNumber: 12080,
movementCounter: 236,
pressure: undefined,
temperature: 25.51,
txPower: 4
}
TypeError: Cannot read properties of undefined (reading 'toFixed')
at handleData (/ruuvigw2ha/index.js:119:35)
at MqttClient. (/ruuvigw2ha/index.js:39:5)
at MqttClient.emit (node:events:527:28)
at MqttClient._handlePublish (/ruuvigw2ha/node_modules/mqtt/lib/client.js:1277:12)
at MqttClient._handlePacket (/ruuvigw2ha/node_modules/mqtt/lib/client.js:410:12)
at work (/ruuvigw2ha/node_modules/mqtt/lib/client.js:321:12)
at Writable.writable._write (/ruuvigw2ha/node_modules/mqtt/lib/client.js:335:5)
at doWrite (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:409:139)
at writeOrBuffer (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:398:5)
at Writable.write (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:307:11)
parsedData {
TypeError: Cannot read properties of undefined (reading 'toFixed')
at handleData (/ruuvigw2ha/index.js:119:35)
at MqttClient. (/ruuvigw2ha/index.js:39:5)
at MqttClient.emit (node:events:527:28)
at MqttClient._handlePublish (/ruuvigw2ha/node_modules/mqtt/lib/client.js:1277:12)
at MqttClient._handlePacket (/ruuvigw2ha/node_modules/mqtt/lib/client.js:410:12)
at work (/ruuvigw2ha/node_modules/mqtt/lib/client.js:321:12)
at Writable.writable._write (/ruuvigw2ha/node_modules/mqtt/lib/client.js:335:5)
at doWrite (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:409:139)
at writeOrBuffer (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:398:5)
at Writable.write (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:307:11)
accelerationX: -840,
accelerationY: -256,
accelerationZ: -440,
battery: 2995,
humidity: undefined,
mac: 'ED:20:26:86:0B:48',
measurementSequenceNumber: 12080,
movementCounter: 236,
pressure: undefined,
temperature: 25.51,
txPower: 4
}
parsedData {
accelerationX: -828,
accelerationY: -252,
accelerationZ: -444,
battery: 2995,
humidity: undefined,
mac: 'ED:20:26:86:0B:48',
measurementSequenceNumber: 12081,
movementCounter: 236,
pressure: undefined,
temperature: 25.51,
txPower: 4
}
TypeError: Cannot read properties of undefined (reading 'toFixed')
at handleData (/ruuvigw2ha/index.js:119:35)
at MqttClient. (/ruuvigw2ha/index.js:39:5)
at MqttClient.emit (node:events:527:28)
at MqttClient._handlePublish (/ruuvigw2ha/node_modules/mqtt/lib/client.js:1277:12)
at MqttClient._handlePacket (/ruuvigw2ha/node_modules/mqtt/lib/client.js:410:12)
at work (/ruuvigw2ha/node_modules/mqtt/lib/client.js:321:12)
at Writable.writable._write (/ruuvigw2ha/node_modules/mqtt/lib/client.js:335:5)
at doWrite (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:409:139)
at writeOrBuffer (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:398:5)
at Writable.write (/ruuvigw2ha/node_modules/readable-stream/lib/_stream_writable.js:307:11)

@Kirbo
Copy link
Owner

Kirbo commented Aug 30, 2022

Have you updated RuuviTag firmwares or bought new ones or something? It looks as if the ruuvitag-parser is unable to parae both pressure and humidity.
I’ll add more debug at least, so that you get the original message as well, to help me further investigate where the problem is at.
I’m quite sure the ruuvitag-parser (which this addon uses) is somehow not working properly on your case

@yltsa
Copy link
Author

yltsa commented Aug 30, 2022

Hi, the firmwares are the newest available. There are three types of Ruuvitags in the system. Two Pro sensors have no pressure and a third Ruuvi Pro has also no humidity.

These are the sensors:

  • Old tags (maybe 1st generation but FW upgrade is possible) (temperature, pressure, acceleration , humidity)
  • Quite new Ruuvi Pros (temperature, acceleration, humidity)
  • Quite new Ruuvi Pro (temperature, acceleration)

@Kirbo
Copy link
Owner

Kirbo commented Aug 30, 2022

Oooh, okay. I haven't even tried with Pro sensors. These might not work properly..

@Kirbo
Copy link
Owner

Kirbo commented Aug 31, 2022

I wasn't even aware that some of the sensors might not broadcast all the data. I should make it so that if e.g. humidity or pressure doesn't exist, then it wouldn't even try to read it. As per now, it relies on the assumption that every piece of data (humidity, pressure, temperature, battery, acceleration) exists on every RuuviTag.

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