Open yltsa opened 2 years ago
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) 🙂
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
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
Hmm, weird.. It looks as if the ruuvitag didn't have humidity set. Well, anyway, I'll make this a bit more robust soon
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. 🙂
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.
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
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:
Oooh, okay. I haven't even tried with Pro sensors. These might not work properly..
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.
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