This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

BLE profiles
#11
You can use a scheduled script or create a profile. See raiing-temperature.lua for a similar device.

I'm not sure that this conversion is correct:
Code:
temperature = (rx:byte(2) + rx:byte(1)) / 10

The temperature value is probably two bytes, so you need to shift one byte with multiply by 256. Try both ways as byte order is not known.
Code:
temperature = (rx:byte(2) * 256 + rx:byte(1)) / 10
temperature = (rx:byte(2) + rx:byte(1) * 256) / 10

All write functions like ble.sockwritereq return two values:
1. number of bytes written, -1 = error
2. last error number (errno), applicable only when first value is -1, see this for errno number description: https://www.thegeekstuff.com/2010/10/linux-error-codes/
Reply


Messages In This Thread
BLE profiles - by morak - 29.01.2018, 11:37
RE: BLE profiles - by 1114752670@qq.com - 13.03.2019, 07:53
RE: BLE profiles - by Daniel - 13.03.2019, 08:48
RE: BLE profiles - by gjniewenhuijse - 13.03.2019, 11:06
RE: BLE profiles - by admin - 13.03.2019, 11:19
RE: BLE profiles - by benanderson_475 - 13.01.2020, 21:17
RE: BLE profiles - by admin - 14.01.2020, 07:44
RE: BLE profiles - by benanderson_475 - 21.04.2020, 01:00
RE: BLE profiles - by admin - 21.04.2020, 06:23
RE: BLE profiles - by benanderson_475 - 22.04.2020, 00:38
RE: BLE profiles - by admin - 22.04.2020, 10:53
RE: BLE profiles - by benanderson_475 - 12.03.2022, 10:12

Forum Jump: