johnlemonse / homebridge-telldus

36 stars 22 forks source link

Random error reading sensor #58

Closed mknuts closed 6 years ago

mknuts commented 6 years ago

I have a number of sensors attached, and very often when I select a room containgen a number of sensors I get the following error (it seems to be on a random sensor, because if I redo it usally fails on another sensor)

Any idea?

[2017-11-11 19:12:40] [Tells Live!] [Garaget] Getting temp for sensor Garaget [8.4] /usr/lib/node_modules/homebridge-telldus/node_modules/bluebird/js/release/async.js:61 fn = function () { throw arg; }; ^

TypeError: Cannot read property 'value' of undefined at Characteristic.CurrentTemperature.cx.getValueFromDev.dev [as getValueFromDev] (/usr/lib/node_modules/homebridge-telldus/index.js:292:57)

dezral commented 6 years ago

almost the same error as me, what sensor do you have? and is it local API or remote API?

mknuts commented 6 years ago

I use remote API and I have a lot of different sensors (on Telldus Z-wave v2), some of those sensors is not supported by Homebridge (for example energy sensors in Fibaro z-wave switches) but they are still automatically registered. Now I have disabled them by adding a line like the one below for every unsupported sensor and it seems that my problem is gone.

{ "id": 16xxxx1, "disabled": "true" },

mifi commented 6 years ago

so the problem here is that sensors not supported by homebridge-telldus will crash homebridge? What kind of sensors is this? can you share the API output for these sensors? it seems that they are identified as temp sensors?

mifi commented 6 years ago

Try newest version of homebridge-telldus now (1.0.4). I now prevent that crash if there is no value. I dunno what's gonna happen tho, when homebridge gets a NaN passed 🙈

mknuts commented 6 years ago

Ok, I will try the new version this weekend and then also remove alla "disabled" statements in the config file.

About my sensors, I have a large number of Fibaro z-wave Wall plugs and that is basicly an on/off switch and from Telldus point of view it works just like an ordinary Nexa 433 Mhz switch, but it also contains an energy monitor that can measure current consumption (in watts) and over all consumption in kWh. More info here: Fibaro Wall Plug. I also have some Fibaro motion detectors that also contains a temperature sensor and a light sensor (in lumen). The temperature reading from this sensors can be used if you add a row like this in your config file: { "id": 1704549, "model": "EA4C", "manufacturer": "Fibaro", "name": "Ute Söder" }

But of course I can't read the Lum value

I also have weather station that uses sensors that can communicate with Telldus (on 433 MHz) and in addition to temperature and hygrometer it has a rain sensor and UV sensor and a wind sensor.

I'm not really so interested to have the values from this sensors in homebridge and now when I have disabled them everything seems to work, but anyway the api-data looks like this:

Energy monitor from a Fibaro wall plug {"id":"13673464","clientName":"ZNet v2","name":"Kontoret (z)","lastUpdated":1510748142,"ignored":0,"editable":1,"data":[{"name":"watt","value":"2.72","scale":"0","lastUpdated":1510748142.7837},{"name":"watt","value":"0.0","scale":"2","lastUpdated":1510748142.7837}],"protocol":"zwave","sensorId":"150","timezoneoffset":3600,"battery":"254","keepHistory":"1"}

Wind sensor {"id":"11156656","clientName":"ZNet v2","name":"Vindm\u00e4tare","lastUpdated":1510748439,"ignored":0,"editable":1,"data":[{"name":"wdir","value":"225.0","scale":"0","lastUpdated":1510748439.4674},{"name":"wavg","value":"2.1","scale":"0","lastUpdated":1510748439.4674},{"name":"wgust","value":"2.1","scale":"0","lastUpdated":1510748439.4674}],"protocol":"oregon","sensorId":"58","timezoneoffset":3600,"battery":"254","keepHistory":"1"}

UV Sensor {"id":"11021540","clientName":"ZNet v2","name":"UV Str\u00e5lning","lastUpdated":1510748530,"ignored":0,"editable":1,"data":[{"name":"uv","value":"0.0","scale":"0","lastUpdated":1510748530.4181}],"protocol":"oregon","sensorId":"51","timezoneoffset":3600,"battery":"254","keepHistory":"1"}

Rain sensor {"id":"10437206","clientName":"ZNet v2","name":"Regnm\u00e4tare","lastUpdated":1509869995,"ignored":0,"editable":1,"data":[{"name":"rrate","value":"0.0","scale":"0","lastUpdated":1499234717.8977,"max":"36.8","maxTime":1497581617.3415},{"name":"rtot","value":"536.1","scale":"0","lastUpdated":1499234717.8977,"max":"421.2","maxTime":1494448988.4238}],"protocol":"oregon","sensorId":"4","timezoneoffset":3600,"battery":"254","keepHistory":"1"}

Fibaro motion sensor (temp and light) {"id":"12805415","clientName":"ZNet v2","name":"Friggebod (z)","lastUpdated":1510748503,"ignored":0,"editable":1,"data":[{"name":"temp","value":"10.4","scale":"0","lastUpdated":1510748503.2962},{"name":"lum","value":"1378.0","scale":"1","lastUpdated":1510748503.2962}],"protocol":"zwave","sensorId":"141","timezoneoffset":3600,"battery":"59","keepHistory":"1"}

mknuts commented 6 years ago

The lastest version seems to work, I can't get it to crash. The iOS Home App will still (of course) report "Unsupported Device", but no crash!!

mifi commented 6 years ago

Then I'll close this. we can make separate issues for support for new device types