josecastroleon / pimatic-sensortag

Pimatic plugin to retrieve Sensortag sensors
1 stars 1 forks source link

Not getting any values in pimatic #1

Open tjandt opened 9 years ago

tjandt commented 9 years ago

Hi,

I'm having some problems with my SensorTag 2.0 I installed pimatic-ble, pimatic-sensortag (the one from our Devel-Repo) and sensortag 1.0.2

This is my config: plugins

"plugin": "ble" }, { "plugin": "sensortag" }, devices { "id": "balkon", "class": "SensorTagDevice", "name": "Balkon", "type": "CC2650", "uuid": "C4BE8471C100", "interval": 6000 }

But it's not getting any data from my SensorTag Device.

Running node test.js from the sensortag module I'm getting the following information:

discovered: {"uuid":"c4be8471c100","type":"cc2650"} connectAndSetUp readDeviceName device name = SensorTag 2.0 readSystemId system id = c4:be:84:00:00:71:c1:00 readSerialNumber serial number = N.A. readFirmwareRevision firmware revision = 1.12 (Jun 23 2015) readHardwareRevision hardware revision = PCB 1.2/1.3 readSoftwareRevision software revision = PCB 1.2/1.3 readManufacturerName manufacturer name = Texas Instruments enableIrTemperature readIrTemperature object temperature = 19.4 °C ambient temperature = 25 °C disableIrTemperature

So it seems Device is fine, Bleutooth connection is fine, sensortag module is working ... there seems to be a problem with the pimatic plugin.

Could you give me any hints?

josecastroleon commented 9 years ago

Have you tried to connect using gattool directly to the device? Currently I have some issues with my devices, linked to newer kernel versions

tjandt commented 9 years ago

Yes and it's working:

[C4:BE:84:71:C1:00][LE]> connect Attempting to connect to C4:BE:84:71:C1:00 Connection successful [C4:BE:84:71:C1:00][LE]> primary attr handle: 0x0001, end grp handle: 0x0007 uuid: 00001800-0000-1000-8000-00805f9b34fb attr handle: 0x0008, end grp handle: 0x000b uuid: 00001801-0000-1000-8000-00805f9b34fb attr handle: 0x000c, end grp handle: 0x001e uuid: 0000180a-0000-1000-8000-00805f9b34fb attr handle: 0x001f, end grp handle: 0x0026 uuid: f000aa00-0451-4000-b000-000000000000 attr handle: 0x0027, end grp handle: 0x002e uuid: f000aa20-0451-4000-b000-000000000000 attr handle: 0x002f, end grp handle: 0x0036 uuid: f000aa40-0451-4000-b000-000000000000 attr handle: 0x0037, end grp handle: 0x003e uuid: f000aa80-0451-4000-b000-000000000000 attr handle: 0x003f, end grp handle: 0x0046 uuid: f000aa70-0451-4000-b000-000000000000 attr handle: 0x0047, end grp handle: 0x004b uuid: 0000ffe0-0000-1000-8000-00805f9b34fb attr handle: 0x004c, end grp handle: 0x0050 uuid: f000aa64-0451-4000-b000-000000000000 attr handle: 0x0051, end grp handle: 0x0058 uuid: f000ac00-0451-4000-b000-000000000000 attr handle: 0x0059, end grp handle: 0x0060 uuid: f000ccc0-0451-4000-b000-000000000000 attr handle: 0x0061, end grp handle: 0xffff uuid: f000ffc0-0451-4000-b000-000000000000 [C4:BE:84:71:C1:00][LE]> char-write-cmd 0x24 01 [C4:BE:84:71:C1:00][LE]> char-read-hnd 0x21 Characteristic value/descriptor: d4 08 d8 0b [C4:BE:84:71:C1:00][LE]> exit

josecastroleon commented 9 years ago

have you tried to put c4be8471c100 on the config instead of C4BE8471C100 for the uuid?

The discovery is not case insensitive, i may need to fix that...

tjandt commented 9 years ago

not difference at all ... i activated debug logging but the only information i got was:

debug [pimatic-ble]: [ 'c4be8471c100' ] 22:51:35debug [pimatic-ble]: Scan for devices 22:51:25debug [pimatic-ble]: [ 'c4be8471c100' ] 22:51:25debug [pimatic-ble]: Scan for devices 22:51:15debug [pimatic-ble]: [ 'c4be8471c100' ] 22:51:15debug [pimatic-ble]: Scan for devices

nothing else ... No idea how to move on :/

josecastroleon commented 9 years ago

The weird part is that after the scan, if it finds the sensortag, it should send an event to pimatic-sensortag about a new device discovered, this one does the connection. I need to have a look on this, there is new versions of dependencies, and I can improve the discovery function.

tjandt commented 9 years ago

okay so I'll wait and be patient
If I could support you I'm here :)

josecastroleon commented 9 years ago

Could you please try with the latest commit in devel? I missed the service names for the new sensortags

tjandt commented 9 years ago

Hi, not getting any data but at least I'm getting any feedback ... unknown peripheral connected

20:24:06.916 2015-09-14 Monday 20:24:33.155 [pimatic] info: Starting pimatic version 0.8.79 20:24:39.486 [pimatic] info: Loading plugin: "pimatic-cron" (0.8.5) 20:24:42.746 [pimatic] info: Loading plugin: "pimatic-mobile-frontend" (0.8.66) 20:24:48.374 [pimatic] info: Loading plugin: "pimatic-ble" (0.8.0) 20:24:49.837 [pimatic] info: Loading plugin: "pimatic-sensortag" (0.8.4) 20:24:51.136 [pimatic] info: Loading plugin: "pimatic-dht-sensors" (0.8.4) 20:24:51.342 [pimatic] info: Loading plugin: "pimatic-openweather" (0.8.15) 20:24:51.730 [pimatic] info: Loading plugin: "pimatic-sysinfo" (0.8.13) 20:24:52.671 [pimatic-cron] info: the time is: Mon Sep 14 2015 20:24:52 GMT+0200 (CEST) 20:24:53.936 [pimatic] info: New device "Server_Room"... 20:24:54.111 [pimatic] info: New device "Balkon"... 20:24:54.283 [pimatic] info: New device "System"... 20:24:55.376 [pimatic-mobile-frontend] info: packing static assets 20:24:58.247 [pimatic-mobile-frontend] info: packing static assets finished 20:24:58.292 [pimatic-mobile-frontend] info: rendering html 20:25:26.084 [pimatic-mobile-frontend] info: rendering html finished 20:25:26.263 [pimatic] info: Listening for HTTP-request on port 80... noble: unknown peripheral c4be8471c100 connected!

josecastroleon commented 9 years ago

That's something that appears on the newer version of node-sensortag. I don't see it on node-sensortag (1.0.1) or noble (1.0.1). https://github.com/sandeepmistry/node-sensortag/issues/52

I put 1.0.1 on both packages on the manifest, but could you check which version you have?

I was playing with the discovery based on address (provided by noble-device) but I am unable to get it to work. In my case it is not able to find the service GENERIC_ACCESS_UUID.

tjandt commented 9 years ago

i have the actual git branch ... I'm trying to go back to an older version

tjandt commented 9 years ago

Now I tried with a complete clean setup.

22:34:46.889 [pimatic-cron] the time is: Mon Sep 14 2015 22:34:46 GMT+0200 (CEST) coffee-cache: compiling coffee-script file "device-config-schema.coffee"...Done 22:34:48.760 [pimatic] New device "Server_Room"... 22:34:48.935 [pimatic] New device "Balkon"... 22:34:49.108 [pimatic] New device "System"...

/root/pimatic-app/node_modules/pimatic-sensortag/sensortag.coffee:146 return new SensorTag.CC2650(peripheral); ^ TypeError: undefined is not a function at SensorTagDevice. (/root/pimatic-app/node_modules/pimatic-sensortag/sensortag.coffee:93:32) at SensorTagDevice.connect (/root/pimatic-app/node_modules/pimatic-sensortag/sensortag.coffee:91:19) at SensorTagDevice.connect (/root/pimatic-app/node_modules/pimatic-sensortag/sensortag.coffee:1:1) at SensorTagPlugin. (/root/pimatic-app/node_modules/pimatic-sensortag/sensortag.coffee:86:12) at SensorTagPlugin.EventEmitter.emit (events.js:95:17) at BLEPlugin. (/root/pimatic-app/node_modules/pimatic-sensortag/sensortag.coffee:30:14) at BLEPlugin.EventEmitter.emit (events.js:95:17) at Noble. (/root/pimatic-app/node_modules/pimatic-ble/ble.coffee:26:12) at Noble.EventEmitter.emit (events.js:95:17) at Noble.onDiscover (/root/pimatic-app/node_modules/pimatic-ble/node_modules/noble/lib/noble.js:125:10) at EventEmitter.emit (events.js:106:17) at nobleBindings.onDiscover (/root/pimatic-app/node_modules/pimatic-ble/node_modules/noble/lib/linux/bindings.js:74:10) at EventEmitter.emit (events.js:106:17) at HciBle.onStdoutData (/root/pimatic-app/node_modules/pimatic-ble/node_modules/noble/lib/linux/hci-ble.js:174:14) at Socket.EventEmitter.emit (events.js:95:17) at Socket. (_streamreadable.js:746:14) at Socket.EventEmitter.emit (events.js:92:17) at emitReadable (_stream_readable.js:408:10) at emitReadable (_stream_readable.js:404:5) at readableAddChunk (_stream_readable.js:165:9) at Socket.Readable.push (_stream_readable.js:127:10) at Pipe.onread (net.js:526:21)

david-kracht commented 9 years ago

hey there,

i have some similar problem. sensortags can be connected and discovered outside pimatic, but the discovery in the plugin fails:

i changed "sensortag.coffee" line 31 from

if (peripheral.advertisement.localName == 'SensorTag' or peripheral.advertisement.localName == 'TI BLE Sensor Tag')

to

if (peripheral.advertisement.localName == 'CC2650 SensorTag' or peripheral.advertisement.localName == 'TI BLE Sensor Tag')

to match the advertised name of my CC2650.

after this the script continue but fails to connect. here are the debug lines from the gui:

info [pimatic]: Flushing database to disk, please wait... 12:18:36warn [pimatic]: shutting pimatic down... 12:18:36error [pimatic]: A uncaught exception occured: TypeError: Cannot call method 'read' of undefined at SensorTag.readDataCharacteristic (/home/pi/pimatic-app/node_modules/pimatic-sensortag/node_modules/sensortag/index.js:179:31) at SensorTag. (/home/pi/pimatic-app/node_modules/pimatic-sensortag/node_modules/sensortag/index.js:408:10) at Characteristic. (/home/pi/pimatic-app/node_modules/pimatic-sensortag/node_modules/noble/lib/characteristic.js:60:7) at Characteristic.g (events.js:180:16) at Characteristic.EventEmitter.emit (events.js:92:17) at Noble.onWrite (/home/pi/pimatic-app/node_modules/pimatic-sensortag/node_modules/noble/lib/noble.js:279:20) at EventEmitter.emit (events.js:106:17) at nobleBindings.onWrite (/home/pi/pimatic-app/node_modules/pimatic-sensortag/node_modules/noble/lib/linux/bindings.js:257:8) at EventEmitter.emit (events.js:106:17) at null. (/home/pi/pimatic-app/node_modules/pimatic-sensortag/node_modules/noble/lib/linux/l2cap-ble.js:549:14) at L2capBle.onStdoutData (/home/pi/pimatic-app/node_modules/pimatic-sensortag/node_modules/noble/lib/linux/l2cap-ble.js:164:30) at Socket.EventEmitter.emit (events.js:95:17) at Socket. (_streamreadable.js:746:14) at Socket.EventEmitter.emit (events.js:92:17) at emitReadable (_stream_readable.js:408:10) at emitReadable (_stream_readable.js:404:5) at readableAddChunk (_stream_readable.js:165:9) at Socket.Readable.push (_stream_readable.js:127:10) at Pipe.onread (net.js:526:21) This is most probably a bug in pimatic or in a module, please report it! 12:18:35debug [pimatic-sensortag]: launching read on device Sensortag-2 12:18:32debug [pimatic-sensortag]: [ 'b0b448ba2481' ] 12:18:32debug [pimatic-sensortag]: Scan for devices 12:18:29debug [pimatic-sensortag]: Removing device 68c90b066505 12:18:29debug [pimatic-sensortag]: device Sensortag-2 connected 12:18:28debug [pimatic-sensortag]: device Sensortag-2 found 12:18:22debug [pimatic-sensortag]: [ 'b0b448ba2481', '68c90b066505' ] 12:18:22debug [pimatic-sensortag]: Scan for devices 12:18:12debug [pimatic-sensortag]: [ 'b0b448ba2481', '68c90b066505' ] 12:18:12debug [pimatic-sensortag]: Scan for devices 12:18:02debug [pimatic-sensortag]: [ 'b0b448ba2481', '68c90b066505' ] 12:18:02debug [pimatic-sensortag]: Scan for devices 12:17:52debug [pimatic-sensortag]: [ 'b0b448ba2481', '68c90b066505' ] 12:17:52debug [pimatic-sensortag]: Scan for devices

any ideas ?

david-kracht commented 9 years ago

by the way:

pi@raspberrypi ~/pimatic-app/node_modules/pimatic-sensortag/node_modules/noble $ sudo node test.js noble on -> stateChange: poweredOn on -> scanStart on -> discover: {"uuid":"b0b448ba2481","address":"b0:b4:48:ba:24:81","advertisement":{"localName":"CC2650 SensorTag","txPowerLevel":0,"manufacturerData":[13,0,3,0,0],"serviceData":[],"serviceUuids":["aa80"]},"rssi":-66,"state":"disconnected"} on -> scanStop on -> connect on -> RSSI update -61 on -> peripheral services discovered {"uuid":"1800","name":"Generic Access","type":"org.bluetooth.service.generic_access","includedServiceUuids":null},{"uuid":"1801","name":"Generic Attribute","type":"org.bluetooth.service.generic_attribute","includedServiceUuids":null},{"uuid":"180a","name":"Device Information","type":"org.bluetooth.service.device_information","includedServiceUuids":null},{"uuid":"f000aa0004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000aa2004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000aa4004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000aa8004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000aa7004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"ffe0","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000aa6404514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000ac0004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000ccc004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000ffc004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null} on -> service included services discovered on -> service characteristics discovered {"uuid":"2a00","name":"Device Name","type":"org.bluetooth.characteristic.gap.device_name","properties":["read"]},{"uuid":"2a01","name":"Appearance","type":"org.bluetooth.characteristic.gap.appearance","properties":["read"]},{"uuid":"2a04","name":"Peripheral Preferred Connection Parameters","type":"org.bluetooth.characteristic.gap.peripheral_preferred_connection_parameters","properties":["read"]} on -> characteristic read SensorTag 2.0 false <Buffer 53 65 6e 73 6f 72 54 61 67 20 32 2e 30>

and

pi@raspberrypi ~/pimatic-app/node_modules/pimatic-sensortag/node_modules/noble $ sudo node test.js noble on -> stateChange: poweredOn on -> scanStart on -> discover: {"uuid":"68c90b066505","address":"68:c9:0b:06:65:05","advertisement":{"manufacturerData":[13,0,3,0,0],"serviceData":[],"serviceUuids":["aa80"]},"rssi":-68,"state":"disconnected"} on -> scanStop on -> connect on -> RSSI update -63 on -> peripheral services discovered {"uuid":"1800","name":"Generic Access","type":"org.bluetooth.service.generic_access","includedServiceUuids":null},{"uuid":"1801","name":"Generic Attribute","type":"org.bluetooth.service.generic_attribute","includedServiceUuids":null},{"uuid":"180a","name":"Device Information","type":"org.bluetooth.service.device_information","includedServiceUuids":null},{"uuid":"f000aa0004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000aa2004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000aa4004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000aa8004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000aa7004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"ffe0","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000aa6404514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000ac0004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000ccc004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null},{"uuid":"f000ffc004514000b000000000000000","name":null,"type":null,"includedServiceUuids":null} on -> service included services discovered on -> service characteristics discovered {"uuid":"2a00","name":"Device Name","type":"org.bluetooth.characteristic.gap.device_name","properties":["read"]},{"uuid":"2a01","name":"Appearance","type":"org.bluetooth.characteristic.gap.appearance","properties":["read"]},{"uuid":"2a04","name":"Peripheral Preferred Connection Parameters","type":"org.bluetooth.characteristic.gap.peripheral_preferred_connection_parameters","properties":["read"]} on -> characteristic read SensorTag 2.0 false <Buffer 53 65 6e 73 6f 72 54 61 67 20 32 2e 30>

from my command line.

josecastroleon commented 9 years ago

I was aware of the discovery part (fix on the devel branch), test.js is reading the characteristics in the same way i call them in the plugin, I think I need to update the plugin to make it work with the latest version, I am on it

david-kracht commented 9 years ago

i would definitely appreciate it.

josecastroleon commented 9 years ago

I tried today with no success with the latest noble version, I am having some issues on the discovery with the 1.1 branch after the inclusion of the bluetooth-hci-socket (unknown device connected). I will try with the 1.0.2 branch...

tjandt commented 9 years ago

is it possible that this issue could be the problem? https://github.com/sandeepmistry/node-sensortag/issues/55#issuecomment-142457157

tjandt commented 8 years ago

any news on this? sorry I don't want to bother you ... I just picked up my RPI + Pimatic and Sensortag again and gave it a try. So with most current version of noble, sensortag and pimatic-sensortag I still get noble: unknown peripheral c4be8471c100 connected! running all the test.js files is working fine

errtro commented 6 years ago

is this project still alive?