17.09.2020, 05:50
Try this, no guarantee that this will work, change MAC to your device MAC. If connect fails try setting random to true.
Another option is to use ZigBee which will be ready for testing soon. There are temperature/humidity sensors (for example CCT593011_AS) which will work without any additional profiles/configuration.
Code:
require('ble')
mac = '01:02:03:04:05:06'
random = false
sock = ble.sock()
ble.settimeout(sock, 10)
res = ble.connect(sock, mac, random)
if res then
humidity = ble.sockreadhnd(sock, 48)
temperature = ble.sockreadhnd(sock, 53)
loghex(humidity)
loghex(temperature)
else
log('ble connect failed')
end
Another option is to use ZigBee which will be ready for testing soon. There are temperature/humidity sensors (for example CCT593011_AS) which will work without any additional profiles/configuration.