Closed PsyKoMari closed 7 years ago
Ops, same discussion here #5, deviceId
is still wrong, but datas are correct.
Afaik deviceId is generated by the client (which means your mac/pi which runs the script) so it's highly possible to see different deviceId in different devices. If you'd like to do sth with device specific id, maybe it'd be better to broadcast the mac address in the payload along with deviceId. I'll put it in the enhancement list.
@demirhanaydin Oh sorry, I thinked that deviceId was the id of the sensor.. btw have you idea why on my mac work properly and on the rpi I had to change the characteristic.write(REALTIME_META_VALUE, false);
?
I couldn't reproduced it with my devices. It'd be helpful if someone shares the raw data just before tranformation of the human readable version. Run the script with 'DEBUG=miflora' flag and it will print raw data to the console. Share it here and I'll try to understand why it's happening when I have a time.
This is what I see on my Macbook (the working app)
miflora no mac address specified, trying to connect available mi flora... +3ms
miflora enabling realtime +2s
miflora data: <Buffer e2 00 00 51 00 00 00 00 00 00 02 3c 00 fb 34 9b> +148ms
miflora temperature: 22.6 °C +3ms
miflora Light: 81 lux +0ms
miflora moisture: 0 % +1ms
miflora fertility: 0 µS/cm +0ms
data DeviceData {
deviceId: 'f31143dde9f749d596a571b481623490',
temperature: 22.6,
lux: 81,
moisture: 0,
fertility: 0 }
miflora firmware data: <Buffer 64 20 32 2e 39 2e 34> +40ms
firmware { deviceId: 'f31143dde9f749d596a571b481623490',
batteryLevel: 100,
firmwareVersion: '2.9.4' }
These are the raw data that I see on my rpi.
miflora device discovered: undefined +223ms
miflora device discovered: undefined +21ms
miflora device discovered: undefined +342ms
miflora device discovered: undefined +134ms
miflora enabling realtime +857ms
miflora data: <Buffer aa bb cc dd ee ff 99 88 77 66 00 00 00 00 00 00> +52ms
miflora temperature: 4804.2 °C +21ms
miflora Light: 2583686877 lux +3ms
miflora moisture: 39304 % +1ms
miflora fertility: 26231 µS/cm +2ms
data DeviceData {
deviceId: 'c47c8d61b312',
temperature: 4804.2,
lux: 2583686877,
moisture: 39304,
fertility: 26231 }
temperatura: 4804.2
moisture: 39304
miflora firmware data: <Buffer 64 20 32 2e 39 2e 34> +103ms
firmware { deviceId: 'c47c8d61b312',
batteryLevel: 100,
firmwareVersion: '2.9.4' }
This is what I get reverting the change to characteristic.write(REALTIME_META_VALUE, true);
Seems the buffer contains bad data. Hope this can help you.
First of all my sensor idk why is called
Flower care
and notFlower mate
so I had to change it in the index.js file. Second when I run the code on my Mac i see right data, this is my output after changing the Flower care string:But if I run the same code on my raspberry pi 0w I see wrong data. The deviceId is different and similar to device macaddress. Temperature, lux, moisture and fertility are random datas, here's my output on raspberry:
My node versions are both 7.9.0 on Mac and Raspberry.