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

No data when executing on raspberry pi #8

Closed
PsyKoMari opened this issue May 10, 2017 · 5 comments
Closed

No data when executing on raspberry pi #8

PsyKoMari opened this issue May 10, 2017 · 5 comments

Comments

@PsyKoMari
Copy link

PsyKoMari commented May 10, 2017

First of all my sensor idk why is called Flower care and not Flower 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:

data DeviceData {
  deviceId: 'f31143dde9f749d596a571b481623490',
  temperature: 21.2,
  lux: 140,
  moisture: 0,
  fertility: 0 }
firmware { deviceId: 'f31143dde9f749d596a571b481623490',
  batteryLevel: 100,
  firmwareVersion: '2.9.4' }

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:

data DeviceData {
  deviceId: 'c47c8d61b312',
  temperature: 4804.2,
  lux: 2583686877,
  moisture: 39304,
  fertility: 26231 }
firmware { deviceId: 'c47c8d61b312',
  batteryLevel: 100,
  firmwareVersion: '2.9.4' }

My node versions are both 7.9.0 on Mac and Raspberry.

@PsyKoMari
Copy link
Author

Ops, same discussion here #5, deviceId is still wrong, but datas are correct.

@demirhanaydin
Copy link
Owner

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.

@PsyKoMari
Copy link
Author

@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); ?

@demirhanaydin
Copy link
Owner

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.

@PsyKoMari
Copy link
Author

PsyKoMari commented May 12, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants