Git Product home page Git Product logo

Comments (27)

Tobi14601 avatar Tobi14601 commented on June 27, 2024 1

I have written a small script for my self where i poll the current usage periodically.

I write to service 0000fff0-0000-1000-8000-00805f9b34fb

to write the characteristics I use 0000fff3-0000-1000-8000-00805f9b34fb
to receive notifications I use 0000fff4-0000-1000-8000-00805f9b34fb

I send the commands identically to your script.

For this I use Java and https://github.com/weliem/blessed-bluez

01:11:23.411 [main       ] INFO  BluetoothCentralManager                  - using adapter hci0
01:11:23.538 [00:00:1D:80] INFO  BluetoothCentralManager                  - autoconnect to A3:00:00:00:1D:80
01:11:23.832 [tral-signal] INFO  BluetoothCentralManager                  - scan started
01:11:24.057 [tral-signal] INFO  BluetoothCentralManager                  - found peripheral to autoconnect 'A3:00:00:00:1D:80'
01:11:24.094 [tral-signal] INFO  BluetoothCentralManager                  - scan stopped
01:11:24.720 [ntral-queue] INFO  BluetoothPeripheral                      - peripheral is connecting
01:11:24.722 [ntral-queue] INFO  BluetoothPeripheral                      - connecting to 'Voltcraft' (A3:00:00:00:1D:80)
01:11:25.164 [D:80-signal] INFO  BluetoothPeripheral                      - connected to 'Voltcraft' (BOND_NONE) in 0.4s
01:11:25.862 [D:80-signal] INFO  BluetoothPeripheral                      - service discovery completed
01:11:26.365 [D:80-signal] INFO  BluetoothPeripheral                      - discovered 2 services for 'Voltcraft' (A3:00:00:00:1D:80)
01:11:26.389 [1D:80-queue] INFO  BluetoothPeripheral                      - setNotify for characteristic <0000fff4-0000-1000-8000-00805f9b34fb>
01:11:26.528 [D:80-signal] INFO  BluetoothPeripheral                      - characteristic '0000fff4-0000-1000-8000-00805f9b34fb' is notifying
01:11:26.567 [1D:80-queue] INFO  BluetoothPeripheral                      - writing WITHOUT_RESPONSE <0f0c170000010203050000000023ffff> to characteristic <0000fff3-0000-1000-8000-00805f9b34fb>
01:11:26.681 [1D:80-queue] INFO  BluetoothPeripheral                      - writing WITHOUT_RESPONSE <0f050400000005ffff> to characteristic <0000fff3-0000-1000-8000-00805f9b34fb>
230v 0.199a 19.597w 50hz 

I tried your suggested change

set HANDLE(req)                18
set HANDLE(notification)       20

But it is not able to write to the characteristic.

pi@raspberrypi:~ $ ./sem-6000.exp test --debug --verbose  --status
INFO:   Try to connect to A3:00:00:00:1D:80
[                 ][LE]> connect A3:00:00:00:1D:80
Attempting to connect to A3:00:00:00:1D:80
Connection successful
[A3:00:00:00:1D:80][LE]> INFO:  Connected to A3:00:00:00:1D:80
INFO:   Auth SEM
INFO:   >>>     char-write-req 12 0f0c1700003132333500000000e3ffff
char-write-req 12 0f0c1700003132333500000000e3ffff
Error: Characteristic Write Request failed: Attribute can't be written
[A3:00:00:00:1D:80][LE]> WARN:  Timeout. Notification not received
ERROR:  Notification invalid!
ERROR:  Checksum of notification invalid!
ERROR:  Authorization failed. Check PIN!
ERROR:  Authorization failed. Check PIN!

Is it maybe possible that the characteristics are not discovered and it defaults no permission?

I also recorded a hci log from my android device where i connect to the device.
btsnoop_hci.log
hope it helps.

from voltcraft-sem-6000.

Heckie75 avatar Heckie75 commented on June 27, 2024 1

I have taken a look at the attached btsnoop_hci.log by using wireshark

As far as I can see you are right that the android app sends write commands instead of write requests:

Request 1: Authorization

Cmd is sent to handle with 0xfff3 !

Frame 333: 28 bytes on wire (224 bits), 28 bytes captured (224 bits)
Bluetooth
    [Source: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
    [Destination: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 19
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Write Command (0x52)
    Handle: 0x0012 (Unknown: Unknown)
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff3)]
    Value: 0f0c170000010203050000000023ffff

Notification 1: identical to script

Frame 336: 22 bytes on wire (176 bits), 22 bytes captured (176 bits)
Bluetooth
    [Source: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
    [Destination: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 13
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Handle Value Notification (0x1b)
    Handle: 0x0014 (Unknown: Unknown)
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff4)]
    Value: 0f06170000000018ffff

Request 2: Request firmware version

Frame 338: 12 bytes on wire (96 bits), 12 bytes captured (96 bits)
Bluetooth
    [Source: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
    [Destination: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 3
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Read Request (0x0a)
    Handle: 0x0010 (Unknown: Unknown)
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff1)]

Response 2: Firmware is 0x01 0x11 --> 1.17 (identically to my devices)

Frame 339: 26 bytes on wire (208 bits), 26 bytes captured (208 bits)
Bluetooth
    [Source: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
    [Destination: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 17
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Read Response (0x0b)
    [Handle: 0x0010 (Unknown: Unknown)]
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff1)]
    Value: 564f4c43465404000000000111030019
    [Request in Frame: 338]

Request 3: Synchronize SEM

Frame 376: 28 bytes on wire (224 bits), 28 bytes captured (224 bits)
Bluetooth
    [Source: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
    [Destination: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 19
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Write Command (0x52)
    Handle: 0x0012 (Unknown: Unknown)
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff3)]
    Value: 0f0c01001b32170e0c07e500006cffff

Notification 3: ident. script

Frame 377: 20 bytes on wire (160 bits), 20 bytes captured (160 bits)
Bluetooth
    [Source: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
    [Destination: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 11
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Handle Value Notification (0x1b)
    Handle: 0x0014 (Unknown: Unknown)
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff4)]
    Value: 0f0401000002ffff

Request 4: Request settings

Frame 472: 21 bytes on wire (168 bits), 21 bytes captured (168 bits)
Bluetooth
    [Source: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
    [Destination: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 12
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Write Command (0x52)
    Handle: 0x0012 (Unknown: Unknown)
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff3)]
    Value: 0f051000000011ffff

Notification 5:

Frame 474: 32 bytes on wire (256 bits), 32 bytes captured (256 bits)
Bluetooth
    [Source: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
    [Destination: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 23
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Handle Value Notification (0x1b)
    Handle: 0x0014 (Unknown: Unknown)
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff4)]
    Value: 0f0e1000001eff0000007801000e6015ffff0000

Request 6: (unknown)

Frame 481: 21 bytes on wire (168 bits), 21 bytes captured (168 bits)
Bluetooth
    [Source: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
    [Destination: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 12
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Write Command (0x52)
    Handle: 0x0012 (Unknown: Unknown)
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff3)]
    Value: 0f050c0000000dffff

Notification 6: (unknown)

Frame 482: 32 bytes on wire (256 bits), 32 bytes captured (256 bits)
Bluetooth
    [Source: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
    [Destination: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 23
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Handle Value Notification (0x1b)
    Handle: 0x0014 (Unknown: Unknown)
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff4)]
    Value: 0f330c0000000000000000000000000000000000

Request 7: Capture measurement

Frame 484: 21 bytes on wire (168 bits), 21 bytes captured (168 bits)
Bluetooth
    [Source: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
    [Destination: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 12
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Write Command (0x52)
    Handle: 0x0012 (Unknown: Unknown)
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff3)]
    Value: 0f050400000005ffff

Notification 7: Capture measurement

Frame 485: 31 bytes on wire (248 bits), 31 bytes captured (248 bits)
Bluetooth
    [Source: a3:00:00:00:1c:32 (a3:00:00:00:1c:32)]
    [Destination: SamsungE_e4:df:4a (b4:1a:1d:e4:df:4a)]
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
    Length: 22
    CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
    Opcode: Handle Value Notification (0x1b)
    Handle: 0x0014 (Unknown: Unknown)
        [Service UUID: Unknown (0xfff0)]
        [UUID: Unknown (0xfff4)]
    Value: 0f0f040001045d9ae5053d320100000007a80a

... and so on.

May be the solution is just to change the handles (the commit that I have reverted) and the type of request as follows:

proc gatt_char_write_req { handle bytes } {

  global DELAY

  set hnd_hex [ decimal_to_hex $handle ]
  set value ""
  foreach b $bytes {
    append value [ decimal_to_hex $b ]
  }

  log "INFO:\t>>>\tchar-write-cmd $hnd_hex $value"

  send "char-write-cmd $hnd_hex $value\r"

  expect {
   "" {
      log "INFO:\tOK"
    }
#    "Characteristic value was written successfully" {
#      log "INFO:\tOK"
#    }
  }

I have committed this change. Can anybody double-check and confirm this?

from voltcraft-sem-6000.

martijnwb avatar martijnwb commented on June 27, 2024 1

@Heckie75 I don't have any new ideas on the historical data issue. As you mentioned, the official app suffers from the same problem. This would mean the official app is not fully functional in combination with the new devices. I would expect that a new app version and/or new firmware version will be released to solve this. I guess we'll have to wait for that before we can make progress on this issue.

@jrbergen Thanks for creating the usefull test script. I ran the script and took the liberty to make some small changes:

  • Make sure the verbose output of the script also ends up in the logfile (by redirecting stderr of the script to stdout)
  • Print the returncode of the script
  • Add the historical data commands to the list of commands to test
Updated script
#!/usr/bin/bash

FILE="/tmp/heckie75-sem6000script-test.log"
ADDRESS="A3:00:00:00:21:0C"
PIN="1234"
SEMDIR="/path/to/voltcraft-sem-6000"
TEST_INTERVAL_SECONDS="10"

# Note: make sure each line ends w/ space.
ARG_ARRAY=(
  "--status" "--sync" "--settings" 
  "--data day" "--data month" "--data year" 
  "--dump" "--json" 
  "--led on" "--led off" 
  "--overload 2500" 
  "--on" "--off" "--toggle" "--toggle" 
  "--standby 0.01" 
  "--scheduler on 23:00 sMTWtfs 2022-01-05" 
  "--scheduler on +120 sMTWtfs 2022-01-05" 
  "--scheduler" "--scheduler reset" 
  "--scheduler" 
  "--countdown on 2021-05-01 23:05:00" 
  "--countdown" "--countdown reset" "--countdown" 
  "--price 0.24 0.20 20:00 05:00" "--price 0.24" 
  "--statistics reset" "--statistics" 
  "--sleep $((TEST_INTERVAL_SECONDS - 1))"
)

RED="\e[31m"
CYAN="\e[36m"
YELLOW="\e[93m"
GREEN="\e[32m"
END="\e[0m"

NUM_TESTS=${#ARG_ARRAY[@]}

if [ ${TEST_INTERVAL_SECONDS} -lt 2 ]; 
then
  echo "Error: TEST_INTERVAL_SECONDS must be >= 2, was $TEST_INTERVAL_SECONDS."
  exit 1
fi

cd $SEMDIR
echo "" > $FILE

for ii in "${!ARG_ARRAY[@]}"; do

  opts=${ARG_ARRAY[ii]}
  fullcmd="./sem-6000.exp $ADDRESS $PIN --debug --verbose ${opts} >> $FILE"

  echo -e "${RED}Running test command $((ii+1))/${NUM_TESTS}: ${END}${YELLOW}${fullcmd}${END}"
  echo "===========START_SEM6000_TEST w/ options: $opts===========" >> $FILE
  echo "#full command was: ${fullcmd}" >> $FILE

  ./sem-6000.exp $ADDRESS $PIN --debug --verbose ${opts} 2>&1 | sed 's/\x1b\(\[\|(\)[^A-Za-z]*[A-Za-z]//g' | tee -a $FILE
  # sed to filter ANSI codes from comment by Levi Uzodike on SO answer https://stackoverflow.com/a/24005600/8484932
  returncode=${PIPESTATUS[0]}

  [ $returncode -eq 0 ] && echo -en "${GREEN}" || echo -en "${RED}"
  echo "Command returned code ${returncode}" | tee -a $FILE
  echo -en "${END}"

  echo "" >> $FILE
  echo "===========END_SEM6000_TEST_CMD w/ options: $opts===========" >> $FILE
  echo "" >> $FILE
  echo "" >> $FILE
  echo -e "${CYAN}Waiting ${TEST_INTERVAL_SECONDS} seconds before performing next test command...${END}"

  sleep $TEST_INTERVAL_SECONDS
done
cd -

echo -e "${YELLOW}All tests completed! Output was written to: '$FILE'${END}"

Log output:
heckie75-sem6000script-test.log

Some of the commands generate errors in the verbose output !

from voltcraft-sem-6000.

mniehren avatar mniehren commented on June 27, 2024

Same issue here

from voltcraft-sem-6000.

Heckie75 avatar Heckie75 commented on June 27, 2024

It seems that handles are different in the firmware version. This is a problem since at this moment these are hard-coded.

Please do the following:

$ gatttool -b FC:69:47:06:CB:C6 -I
[FC:69:47:06:CB:C6][LE]> connect
Attempting to connect to FC:69:47:06:CB:C6
Connection successful
[FC:69:47:06:CB:C6][LE]> characteristics
...
handle: 0x0024, char properties: 0x06, char value handle: 0x0025, uuid: 0000fff1-0000-1000-8000-00805f9b34fb
handle: 0x0027, char properties: 0x02, char value handle: 0x0028, uuid: 0000fff2-0000-1000-8000-00805f9b34fb
handle: 0x002a, char properties: 0x04, char value handle: 0x002b, uuid: 0000fff3-0000-1000-8000-00805f9b34fb
handle: 0x002d, char properties: 0x10, char value handle: 0x002e, uuid: 0000fff4-0000-1000-8000-00805f9b34fb
handle: 0x0031, char properties: 0x02, char value handle: 0x0032, uuid: 0000fff5-0000-1000-8000-00805f9b34fb
handle: 0x0034, char properties: 0x02, char value handle: 0x0035, uuid: 0000fff6-0000-1000-8000-00805f9b34fb

Get the handle for uuid 0000fff3. In my case it is 0x002b (decimal 43). In your case it is 0x0012(decimal 18)
Get the handle for uuid 0000fff4. In my case it is 0x002e (decimal 46). In your case it is 0x0014(decimal 20)

Open sem-6000.exp with an editor. In line 180 and 181 change the handles to your values. Values are in decimal .

set HANDLE(req)                43
set HANDLE(notification)       46

Check if it works for you. I am going to change the code so that handles will be used dynamically.

from voltcraft-sem-6000.

Heckie75 avatar Heckie75 commented on June 27, 2024

I have changed the code so that hard-coded handles are removed and charactistics are read dynamically. Pls. double-check if this works for you.

from voltcraft-sem-6000.

mniehren avatar mniehren commented on June 27, 2024

Hi Heckie,

i tried out your changes, but it still does not work, sorry.
First, the output of gattool:
diana@diana-NUC8i3BEK:~/Downloads/voltcraft-sem-6000-master$ gatttool -b A3:00:00:00:22:29 --characteristics
handle = 0x0002, char properties = 0x0a, char value handle = 0x0003, uuid = 00002a00-0000-1000-8000-00805f9b34fb
handle = 0x0004, char properties = 0x0a, char value handle = 0x0005, uuid = 00002a01-0000-1000-8000-00805f9b34fb
handle = 0x0006, char properties = 0x02, char value handle = 0x0007, uuid = 00002a02-0000-1000-8000-00805f9b34fb
handle = 0x0008, char properties = 0x02, char value handle = 0x0009, uuid = 00002a04-0000-1000-8000-00805f9b34fb
handle = 0x000b, char properties = 0x22, char value handle = 0x000c, uuid = 00002a05-0000-1000-8000-00805f9b34fb
handle = 0x000f, char properties = 0x06, char value handle = 0x0010, uuid = 0000fff1-0000-1000-8000-00805f9b34fb
handle = 0x0011, char properties = 0x04, char value handle = 0x0012, uuid = 0000fff3-0000-1000-8000-00805f9b34fb
handle = 0x0013, char properties = 0x10, char value handle = 0x0014, uuid = 0000fff4-0000-1000-8000-00805f9b34fb

and the "sync" command:
diana@diana-NUC8i3BEK:~/Downloads/voltcraft-sem-6000-master$ ./sem-6000.exp A3:00:00:00:22:29 0000 --verbose --debug --sync
INFO: Init handles of device
INFO: Handles initialised successfully
INFO: Try to connect to A3:00:00:00:22:29
[ ][LE]> connect A3:00:00:00:22:29
Attempting to connect to A3:00:00:00:22:29
Connection successful
[A3:00:00:00:22:29][LE]> INFO: Connected to A3:00:00:00:22:29
INFO: Synchronize SEM
INFO: >>> char-write-req 0012 0f0c010016060e1a0c07e500003effff
char-write-req 0012 0f0c010016060e1a0c07e500003effff
Error: Characteristic Write Request failed: Attribute can't be written
[A3:00:00:00:22:29][LE]> WARN: Timeout. Notification not received
ERROR: Notification invalid!
ERROR: Checksum of notification invalid!
ERROR: Synchronization of SEM failed
INFO: Disconnect from A3:00:00:00:22:29

This device now has firmware V1.16.
You have to know, that there are currently 2 issues with the devices (i purchase 3, they all have the same problems). With the "normal" App, i can not change the name of the device and the devices did not collect statistics. But i can see the current power consumption and can put it on or off.

best regards,
Michael

from voltcraft-sem-6000.

Heckie75 avatar Heckie75 commented on June 27, 2024

OK, in this case it seems that the problem is not only related to this script. Actually I have no Idea how to help. Sorry.

I also think that I'm going to revert the latest change.

from voltcraft-sem-6000.

Heckie75 avatar Heckie75 commented on June 27, 2024

BTW: Where have you read the firmware version?

I can see that there are two handles. In my case both is V1.00

[FC:69:47:06:CB:C6][LE]> char-read-hnd 1a
Characteristic value/descriptor: 56 31 2e 30 30

[FC:69:47:06:CB:C6][LE]> char-read-hnd 1c
Characteristic value/descriptor: 56 31 2e 30 30

Both is hex for "V1.00" (https://www.binaryhexconverter.com/hex-to-ascii-text-converter)

But according your output in terms of characteristics there aren't any handles for

  • Firmware Revision (2A26)
  • Hardware Revision (2A27)

Could you also double-check that the mac address matches the mac address connected in the official app?

from voltcraft-sem-6000.

mniehren avatar mniehren commented on June 27, 2024

from voltcraft-sem-6000.

jrbergen avatar jrbergen commented on June 27, 2024

I'm having the same trouble as @mniehren. I changed the handles as posted before.

My seemingly equivalent output (firmware version 1.17 according to app):

someuser@raspberrypi:~/opthome/voltcraft-sem-6000 $ gatttool -b A3:00:00:00:21:0C --characteristics

handle = 0x0002, char properties = 0x0a, char value handle = 0x0003, uuid = 00002a00-0000-1000-8000-00805f9b34fb
handle = 0x0004, char properties = 0x0a, char value handle = 0x0005, uuid = 00002a01-0000-1000-8000-00805f9b34fb
handle = 0x0006, char properties = 0x02, char value handle = 0x0007, uuid = 00002a02-0000-1000-8000-00805f9b34fb
handle = 0x0008, char properties = 0x02, char value handle = 0x0009, uuid = 00002a04-0000-1000-8000-00805f9b34fb
handle = 0x000b, char properties = 0x22, char value handle = 0x000c, uuid = 00002a05-0000-1000-8000-00805f9b34fb
handle = 0x000f, char properties = 0x06, char value handle = 0x0010, uuid = 0000fff1-0000-1000-8000-00805f9b34fb
handle = 0x0011, char properties = 0x04, char value handle = 0x0012, uuid = 0000fff3-0000-1000-8000-00805f9b34fb
handle = 0x0013, char properties = 0x10, char value handle = 0x0014, uuid = 0000fff4-0000-1000-8000-00805f9b34fb

someuser@raspberrypi:~/opthome/voltcraft-sem-6000 $ ./sem-6000.exp A3:00:00:00:21:0C 2489 --verbose --debug --sync

INFO:   Try to connect to A3:00:00:00:21:0C
[                 ][LE]> connect A3:00:00:00:21:0C
Attempting to connect to A3:00:00:00:21:0C
Connection successful
[A3:00:00:00:21:0C][LE]> INFO:  Connected to A3:00:00:00:21:0C
INFO:   Synchronize SEM
INFO:   >>>     char-write-req 12 0f0c01002431121c0c07e500007dffff
char-write-req 12 0f0c01002431121c0c07e500007dffff
Error: Characteristic Write Request failed: Attribute can't be written
[A3:00:00:00:21:0C][LE]> WARN:  Timeout. Notification not received
ERROR:  Notification invalid!
ERROR:  Checksum of notification invalid!
ERROR:  Synchronization of SEM failed
INFO:   Disconnect from A3:00:00:00:21:0C

Output from reading handles:

[A3:00:00:00:21:0C][LE]> char-read-uuid  0000fff1-0000-1000-8000-00805f9b34fb
handle: 0x0010   value: 56 4f 4c 43 46 54 04 00 00 00 00 01 11 03 00 19
56 4f 4c 43 46 54 04 00 00 00 00 01 11 03 00 19

"Voltcraft" in ASCII

[A3:00:00:00:21:0C][LE]> char-read-uuid 00002a05-0000-1000-8000-00805f9b34fb
handle: 0x000c   value: 01 00 ff ff 

16842751 in decimal. �ÿÿ in ASCII

[A3:00:00:00:21:0C][LE]> char-read-uuid 00002a04-0000-1000-8000-00805f9b34fb
handle: 0x0009   value: 08 00 0a 00 00 00 58 02

576471747419723778 in decimal. Also nonsense chars in ASCII

[A3:00:00:00:21:0C][LE]> char-read-uuid 00002a02-0000-1000-8000-00805f9b34fb
handle: 0x0007   value: 00 
[A3:00:00:00:21:0C][LE]> char-read-uuid 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x0005   value: 00 00 
[A3:00:00:00:21:0C][LE]> char-read-uuid 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0003   value: 56 6f 6c 63 72 61 66 74 

VOLCFT����� in ASCII

Others can't be read (I presume these are write-only handles or something; I don't really know what I'm doing here as you can probably tell).

[A3:00:00:00:21:0C][LE]> char-read-uuid 0000fff4-0000-1000-8000-00805f9b34fb
Error: Read characteristics by UUID failed: Attribute can't be read
[A3:00:00:00:21:0C][LE]> char-read-uuid 0000fff3-0000-1000-8000-00805f9b34fb
Error: Read characteristics by UUID failed: Attribute can't be read

from voltcraft-sem-6000.

Heckie75 avatar Heckie75 commented on June 27, 2024

From my POV I can´t really help since both of my devices have probably an older firmware and it just works. I think that there is a change related to authorization so that there are no notification events as long as there was some previous request.

The only way to find out is to sniff the communication between the official app and the device. This can be done by setting your android device into developer mode and activte bluetooth HCI-snoop protocol. Then use a tool like Wireshark in order to analyse communication.

The other - but illegial - option is to decompile the official app and take a look at the code.

BTW: Have you tried to pair the device by using bluetoothctl?

from voltcraft-sem-6000.

martijnwb avatar martijnwb commented on June 27, 2024

I ran into the same issue

I have two SEM6000 devices, one of them works fine with the script, the other doesn't work.
They both report firmware version 1.17 in the app

I ran the same commands on both devices using gatttool, using the different handles as mentioned above.

Working device:

/app # gatttool -b B0:B1:13:71:B5:76 -I
[B0:B1:13:71:B5:76][LE]> connect
Attempting to connect to B0:B1:13:71:B5:76
Connection successful
[B0:B1:13:71:B5:76][LE]> char-write-cmd 2b 0f0c170000000000000000000018ffff
Notification handle = 0x002e value: 0f 06 17 00 00 00 00 18 ff ff
[B0:B1:13:71:B5:76][LE]> char-write-cmd 2b 0f050400000005ffff
Notification handle = 0x002e value: 0f 11 04 00 01 00 04 24 e2 00 1f 32 00 00 00 00 00 00 61
[B0:B1:13:71:B5:76][LE]> char-write-cmd 2b 0f050a0000000bffff
Notification handle = 0x002e value: 0f 33 0a 00 00 42 00 41 00 54 00 43 00 43 00 42 00 42 00 42
Notification handle = 0x002e value: 00 42 00 40 00 40 00 40 00 40 00 40 00 40 00 39 00 38 00 36
Notification handle = 0x002e value: 00 32 00 43 00 41 00 40 00 41 00 2f fd ff ff
[B0:B1:13:71:B5:76][LE]> char-write-cmd 2b 0f050b0000000cffff
Notification handle = 0x002e value: 0f 7b 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Notification handle = 0x002e value: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Notification handle = 0x002e value: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Notification handle = 0x002e value: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Notification handle = 0x002e value: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Notification handle = 0x002e value: 00 00 00 00 00 00 00 00 00 00 00 00 00 02 24 00 00 06 01 07
Notification handle = 0x002e value: 00 04 66 09 b3 ff ff
[B0:B1:13:71:B5:76][LE]> char-write-cmd 2b 0f050c0000000dffff
Notification handle = 0x002e value: 0f 33 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Notification handle = 0x002e value: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 59 0a
Notification handle = 0x002e value: 00 01 70 00 00 17 07 07 00 0c 8b 06 ab ff ff
[B0:B1:13:71:B5:76][LE]>

Problematic device:

/app # gatttool -b A3:00:00:00:1B:F5 -I
[A3:00:00:00:1B:F5][LE]> connect
Attempting to connect to A3:00:00:00:1B:F5
Connection successful
[A3:00:00:00:1B:F5][LE]> char-write-cmd 12 0f0c170000000000000000000018ffff
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff
[A3:00:00:00:1B:F5][LE]> char-write-cmd 12 0f050400000005ffff
Notification handle = 0x0014 value: 0f 0f 04 00 01 00 00 00 e5 00 00 32 01 00 00 00 00 00 1e
[A3:00:00:00:1B:F5][LE]> char-write-cmd 12 0f050a0000000bffff
Notification handle = 0x0014 value: 0f 33 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[A3:00:00:00:1B:F5][LE]> char-write-cmd 12 0f050b0000000cffff
Notification handle = 0x0014 value: 0f 7b 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[A3:00:00:00:1B:F5][LE]> char-write-cmd 12 0f050c0000000dffff
Notification handle = 0x0014 value: 0f 33 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[A3:00:00:00:1B:F5][LE]>

Some observations:

  • On the problematic device, using char-write-req gives 'Error: Characteristic Write Request failed: Attribute can't be written' error. However, char-write-cmd does work. (The sem-6000 script using char-write-req)
  • The second command (reading a measurement) reports a different length on the problematic device (0f i.s.o. 11), while the actual responses have the same length.
  • The last three commands (reading data for day,month and year) only return a single notification on the problematic device instead of multiple responses like on the working device
  • The MAC addresses of the devices are very different, which makes me wonder if they might be based on a different hardware platform.

The first issue can be solved quite easily. The second and third issue however seem to be more problematic.
Any ideas anyone ?

from voltcraft-sem-6000.

martijnwb avatar martijnwb commented on June 27, 2024

I tried the code with your patch.
I used both --debug and --verbose to give you as much info as possible

The good news is that authentication is now successful.
Request device metadata works partially (requesting serial doesn't work)
Synchronize, capture measurement and request power consumption return an error (I didn't try any of the other commands)

Request device metadata:

/app # sem-6000.exp A3:00:00:00:1B:F5 0000 --debug --verbose --device --print
INFO:   Init handles of device
INFO:   Handles initialised successfully
INFO:   Try to connect to A3:00:00:00:1B:F5
[                 ][LE]> connect A3:00:00:00:1B:F5
Attempting to connect to A3:00:00:00:1B:F5
Connection successful
[A3:00:00:00:1B:F5][LE]> INFO:  Connected to A3:00:00:00:1B:F5
INFO:   Auth SEM
INFO:   >>>     char-write-cmd 0012 0f0c170000000000000000000018ffff
INFO:   OK
char-write-cmd 0012 0f0c170000000000000000000018ffff
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff
[A3:00:00:00:1B:F5][LE]> INFO:  <<<     Notification handle = 0x0012 value: 0f 06 17 00 00 00 00 18 ff ff
INFO:   Response completed in terms of announced length and end sequence
INFO:   SEM authorized successfully with PIN
INFO:   Read name
INFO:   >>>     char-read-hnd 0003
char-read-hnd 0003
Characteristic value/descriptor: 56 6f 6c 63 72 61 66 74
[A3:00:00:00:1B:F5][LE]> INFO:  <<<     Characteristic value/descriptor: 56 6f 6c 63 72 61 66 74
INFO:   name successfully read
INFO:   Read firmware version
INFO:   >>>     char-read-hnd 0010
char-read-hnd 0010
Characteristic value/descriptor: 56 4f 4c 43 46 54 04 00 00 00 00 01 11 03 00 19
[A3:00:00:00:1B:F5][LE]> INFO:  <<<     Characteristic value/descriptor: 56 4f 4c 43 46 54 04 00 00 00 00 01 11 03 00 19
INFO:   Firmware version requested successfully
INFO:   Request serial number
INFO:   >>>     char-write-cmd 0012 0f051100000012ffff
INFO:   OK
char-write-cmd 0012 0f051100000012ffff
[A3:00:00:00:1B:F5][LE]> WARN:  Timeout. Notification not received
ERROR:  Notification invalid!
ERROR:  Checksum of notification invalid!
ERROR:  Requesting serial failed!
Device:
  Mac:                  A3:00:00:00:1B:F5
  Device PIN:           0000
  Name:                 Volcraft
  Serial:
  Firmware:             1.17
  Alias:

INFO:   Disconnect from A3:00:00:00:1B:F5

Synchronize SEM:

/app # sem-6000.exp A3:00:00:00:1B:F5 0000 --debug --verbose --sync
INFO:   Init handles of device
INFO:   Handles initialised successfully
INFO:   Try to connect to A3:00:00:00:1B:F5
[                 ][LE]> connect A3:00:00:00:1B:F5
Attempting to connect to A3:00:00:00:1B:F5
Connection successful
[A3:00:00:00:1B:F5][LE]> INFO:  Connected to A3:00:00:00:1B:F5
INFO:   Synchronize SEM
INFO:   >>>     char-write-cmd 0012 0f0c01001d200b050107e600003dffff
INFO:   OK
char-write-cmd 0012 0f0c01001d200b050107e600003dffff
[A3:00:00:00:1B:F5][LE]> WARN:  Timeout. Notification not received
ERROR:  Notification invalid!
ERROR:  Checksum of notification invalid!
ERROR:  Synchronization of SEM failed
INFO:   Disconnect from A3:00:00:00:1B:F5

Capture measurement:

/app # sem-6000.exp A3:00:00:00:1B:F5 0000 --debug --verbose --status --print
INFO:   Init handles of device
INFO:   Handles initialised successfully
INFO:   Try to connect to A3:00:00:00:1B:F5
[                 ][LE]> connect A3:00:00:00:1B:F5
Attempting to connect to A3:00:00:00:1B:F5
Connection successful
[A3:00:00:00:1B:F5][LE]> INFO:  Connected to A3:00:00:00:1B:F5
INFO:   Auth SEM
INFO:   >>>     char-write-cmd 0012 0f0c170000000000000000000018ffff
INFO:   OK
char-write-cmd 0012 0f0c170000000000000000000018ffff
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff
[A3:00:00:00:1B:F5][LE]> INFO:  <<<     Notification handle = 0x0012 value: 0f 06 17 00 00 00 00 18 ff ff
INFO:   Response completed in terms of announced length and end sequence
INFO:   SEM authorized successfully with PIN
INFO:   Request measurement
INFO:   >>>     char-write-cmd 0012 0f050400000005ffff
INFO:   OK
char-write-cmd 0012 0f050400000005ffff
Notification handle = 0x0014 value: 0f 0f 04 00 01 00 00 00 e7 00 00 31 01 00 00 00 00 00 1f
[A3:00:00:00:1B:F5][LE]> INFO:  <<<     Notification handle = 0x0012 value: 0f 0f 04 00 01 00 00 00 e7 00 00 31 01 00 00 00 00 00 1f
INFO:   Response not complete, wait for another notification...
WARN:   Timeout. Notification not received
ERROR:  Notification invalid!
ERROR:  Checksum of notification invalid!
ERROR:  Requesting measurement failed
INFO:   Disconnect from A3:00:00:00:1B:F5

Request measured power consumption by year:

/app # sem-6000.exp A3:00:00:00:1B:F5 0000 --debug --verbose --data year --print
INFO:   Init handles of device
INFO:   Handles initialised successfully
INFO:   Try to connect to A3:00:00:00:1B:F5
[                 ][LE]> connect A3:00:00:00:1B:F5
Attempting to connect to A3:00:00:00:1B:F5
Connection successful
[A3:00:00:00:1B:F5][LE]> INFO:  Connected to A3:00:00:00:1B:F5
INFO:   Auth SEM
INFO:   >>>     char-write-cmd 0012 0f0c170000000000000000000018ffff
INFO:   OK
char-write-cmd 0012 0f0c170000000000000000000018ffff
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff
[A3:00:00:00:1B:F5][LE]> INFO:  <<<     Notification handle = 0x0012 value: 0f 06 17 00 00 00 00 18 ff ff
INFO:   Response completed in terms of announced length and end sequence
INFO:   SEM authorized successfully with PIN
INFO:   Request measured power consumption
INFO:   >>>     char-write-cmd 0012 0f050c0000000dffff
INFO:   OK
char-write-cmd 0012 0f050c0000000dffff
Notification handle = 0x0014 value: 0f 33 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[A3:00:00:00:1B:F5][LE]> INFO:  <<<     Notification handle = 0x0012 value: 0f 33 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
INFO:   Response not complete, wait for another notification...
WARN:   Timeout. Notification not received
ERROR:  Notification invalid!
ERROR:  Checksum of notification invalid!
ERROR:  Requesting measured power consumption failed
INFO:   Disconnect from A3:00:00:00:1B:F5

from voltcraft-sem-6000.

Heckie75 avatar Heckie75 commented on June 27, 2024

I have changed s.th. so that there is an explicit authorization before synchronization. Pl.s check if it works now.

I have also changed s.th. so that simple measurement request should work now.

I have no solution in terms of requesting serial no.

If haven't analyzed the other problems yet.

Pls. check latest script.


May be you can try to activate notifications by doing the following:

$ gatttool -b B0:B1:13:61:B1:D1 -I
[B0:B1:13:61:B1:D1][LE]> connect
Attempting to connect to B0:B1:13:61:B1:D1
Connection successful
[B0:B1:13:61:B1:D1][LE]> char-desc
...
handle: 0x002e, uuid: 0000fff4-0000-1000-8000-00805f9b34fb
handle: 0x002f, uuid: 00002902-0000-1000-8000-00805f9b34fb
...

Look at the characteristic for notifcations with uuid fff4 and the it is the next line with uuid 2902. In my case the handle is 2f

Alternatively you can get the correct handle by searching for it ike this (2e is the handle of the uuid fff4):

[B0:B1:13:61:B1:D1][LE]> char-read-uuid 2902 2e
handle: 0x002f   value: 00 00

Then enable notifications like this

[B0:B1:13:61:B1:D1][LE]> char-write-req 2f 0100
Characteristic value was written successfully

Please try to query historical measurement data. Do you get multiple notifications then?

from voltcraft-sem-6000.

martijnwb avatar martijnwb commented on June 27, 2024

I've tried your new version

For the record:

/app/voltcraft-sem-6000 # git log -1 --pretty="%h %s"
2a91c45 [issue-12] Unable to Authenticate - added auth also for sync

Sync (after power cycle of the SEM6000):

/app/voltcraft-sem-6000 # sem-6000.exp A3:00:00:00:1B:F5 0000 --verbose --debug --sync
INFO:   Init handles of device
INFO:   Handles initialised successfully
INFO:   Try to connect to A3:00:00:00:1B:F5
[                 ][LE]> connect A3:00:00:00:1B:F5
Attempting to connect to A3:00:00:00:1B:F5
Connection successful
[A3:00:00:00:1B:F5][LE]> INFO:  Connected to A3:00:00:00:1B:F5
INFO:   Auth SEM
INFO:   >>>     char-write-cmd 0012 0f0c170000000000000000000018ffff
INFO:   OK
char-write-cmd 0012 0f0c170000000000000000000018ffff
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff
[A3:00:00:00:1B:F5][LE]> INFO:  <<<     Notification handle = 0x0012 value: 0f 06 17 00 00 00 00 18 ff ff
INFO:   Response completed in terms of announced length and end sequence
INFO:   SEM authorized successfully with PIN
INFO:   Synchronize SEM
INFO:   >>>     char-write-cmd 0012 0f0c010016070f050107e6000021ffff
INFO:   OK
char-write-cmd 0012 0f0c010016070f050107e6000021ffff
Notification handle = 0x0014 value: 0f 04 01 00 00 02 ff ff
[A3:00:00:00:1B:F5][LE]> INFO:  <<<     Notification handle = 0x0012 value: 0f 04 01 00 00 02 ff ff
INFO:   Response completed in terms of announced length and end sequence
INFO:   SEM successfully synchronized
INFO:   Disconnect from A3:00:00:00:1B:F5

Activate notifications & request historical data for the year:

/app/voltcraft-sem-6000 # gatttool -b A3:00:00:00:1B:F5 -I
[A3:00:00:00:1B:F5][LE]> connect
Attempting to connect to A3:00:00:00:1B:F5
Connection successful
[A3:00:00:00:1B:F5][LE]> char-desc
...
handle: 0x0014, uuid: 0000fff4-0000-1000-8000-00805f9b34fb
handle: 0x0015, uuid: 00002902-0000-1000-8000-00805f9b34fb
[A3:00:00:00:1B:F5][LE]> char-write-req 15 0100
Characteristic value was written successfully
[A3:00:00:00:1B:F5][LE]> char-write-cmd 12 0f0c170000000000000000000018ffff
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff
[A3:00:00:00:1B:F5][LE]> char-write-cmd 12 0f050c0000000dffff
Notification handle = 0x0014 value: 0f 33 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[A3:00:00:00:1B:F5][LE]>

from voltcraft-sem-6000.

Heckie75 avatar Heckie75 commented on June 27, 2024

Ok, according to the attached btsnoop_hci.log the offical app has the same problem. There is also just a single notification per request.

Since I have seen that there is this "enabling notification request" I hoped that this would help.

Frame 331: 14 bytes on wire (112 bits), 14 bytes captured (112 bits)
Bluetooth
Bluetooth HCI H4
Bluetooth HCI ACL Packet
Bluetooth L2CAP Protocol
Bluetooth Attribute Protocol
    Opcode: Write Request (0x12)
        0... .... = Authentication Signature: False
        .0.. .... = Command: False
        ..01 0010 = Method: Write Request (0x12)
    Handle: 0x0015 (Unknown: Unknown: Client Characteristic Configuration)
        [Service UUID: Unknown (0xfff0)]
        [Characteristic UUID: Unknown (0xfff4)]
        [UUID: Client Characteristic Configuration (0x2902)]
    Characteristic Configuration Client: 0x0000
        0000 0000 0000 00.. = Reseved: 0x0000
        .... .... .... ..0. = Indication: False
        .... .... .... ...0 = Notification: False

But it is not the case. Any idea?

from voltcraft-sem-6000.

jrbergen avatar jrbergen commented on June 27, 2024

I don't have any new ideas (apart from adding learning about bluetooth protocol to the to-do list). However, I can confirm the same behaviour which @martijnwb described. I'm very happy that the "--measure" command works . Now I can simply send the data somewhere and do aggregation/statistics somewhere else.

In case it's useful for debugging; I wrote a small bash script to run the various commands and pipe it to some log file:

#!/usr/bin/bash

FILE="/tmp/heckie75-sem6000script-test.log"
ADDRESS="A3:00:00:00:21:0C"
PIN="1234"
SEMDIR="/path/to/voltcraft-sem-6000"
TEST_INTERVAL_SECONDS="10"

# Note: make sure each line ends w/ space.
ARG_ARRAY=(
  "--status" "--sync" "--settings" 
  "--dump" "--json" 
  "--led on" "--led off" 
  "--overload 2500" 
  "--on" "--off" "--toggle" "--toggle" 
  "--standby 0.01" 
  "--scheduler on 23:00 sMTWtfs 2022-01-05" 
  "--scheduler on +120 sMTWtfs 2022-01-05" 
  "--scheduler" "--scheduler reset" 
  "--scheduler" 
  "--countdown on 2021-05-01 23:05:00" 
  "--countdown" "--countdown reset" "--countdown" 
  "--price 0.24 0.20 20:00 05:00" "--price 0.24" 
  "--statistics reset" "--statistics" 
  "--sleep $((TEST_INTERVAL_SECONDS - 1))"
)

RED="\e[31m"
CYAN="\e[36m"
YELLOW="\e[93m"
END="\e[0m"

NUM_TESTS=${#ARG_ARRAY[@]}

if [ ${TEST_INTERVAL_SECONDS} -lt 2 ]; 
then
  echo "Error: TEST_INTERVAL_SECONDS must be >= 2, was $TEST_INTERVAL_SECONDS."
  exit 1
fi

cd $SEMDIR
echo "" > $FILE

for ii in "${!ARG_ARRAY[@]}"; do

  opts=${ARG_ARRAY[ii]}
  fullcmd="./sem-6000.exp $ADDRESS $PIN --debug --verbose ${opts} >> $FILE"

  echo -e "${RED}Running test command $((ii+1))/${NUM_TESTS}: ${END}${YELLOW}${fullcmd}${END}"
  echo "===========START_SEM6000_TEST w/ options: $opts===========" >> $FILE
  echo "#full command was: ${fullcmd}" >> $FILE

  ./sem-6000.exp $ADDRESS $PIN --debug --verbose ${opts} | sed 's/\x1b\(\[\|(\)[^A-Za-z]*[A-Za-z]//g' >> $FILE
  # sed to filter ANSI codes from comment by Levi Uzodike on SO answer https://stackoverflow.com/a/24005600/8484932

  echo "" >> $FILE
  echo "===========END_SEM6000_TEST_CMD w/ options: $opts===========" >> $FILE
  echo "" >> $FILE
  echo "" >> $FILE
  echo -e "${CYAN}Waiting ${TEST_INTERVAL_SECONDS} seconds before performing next test command...${END}"

  sleep $TEST_INTERVAL_SECONDS
done
cd -

echo -e "${YELLOW}All tests completed! Output was written to: '$FILE'${END}"

Resulting in the following output:

Log output

===========START_SEM6000_TEST w/ options: --status===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --status >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f050400000005ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0f 04 00 00 00 00 00 de 00 14 32 01 00 00 00 00 00 2a 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --status===========


===========START_SEM6000_TEST w/ options: --sync===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --sync >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Error: connect to A3:00:00:00:21:0C: Function not implemented (38)
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --sync===========


===========START_SEM6000_TEST w/ options: --settings===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --settings >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f051000000011ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0e 10 00 00 18 18 00 42 00 45 00 00 09 c4 95 ff ff 00 00 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --settings===========


===========START_SEM6000_TEST w/ options: --dump===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --dump >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c0100241e01060107e6000039ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 01 00 00 02 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f051000000011ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0e 10 00 00 18 18 00 42 00 45 00 00 09 c4 95 ff ff 00 00 
[A3:00:00:00:21:0C][LE]> char-read-hnd 0003

[A3:00:00:00:21:0C][LE]> 
Characteristic value/descriptor: 56 6f 6c 63 72 61 66 74 
[A3:00:00:00:21:0C][LE]> char-read-hnd 0010

[A3:00:00:00:21:0C][LE]> 
Characteristic value/descriptor: 56 4f 4c 43 46 54 04 00 00 00 00 01 11 03 00 19 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f051100000012ffff

[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f05090000000affff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0e 09 00 00 00 05 17 01 05 15 00 00 00 00 41 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f06140000000015ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 14 00 00 15 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f051600000017ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0b 16 00 00 ff 14 00 08 00 00 00 32 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f050400000005ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0f 04 00 00 00 00 00 de 00 14 31 01 00 00 00 00 00 29 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --dump===========


===========START_SEM6000_TEST w/ options: --json===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --json >> /tmp/heckie75-sem6000script-test.log
{
  "device" : null,
  "settings" : null,
  "schedulers" : null,
  "countdown" : null,
  "randommode" : null,
  "status" : null,
  "data_per_hour" : [
  ],
  "data_per_day" : [
  ],
  "data_per_month" : [
  ],
  "statistics" : null
}

===========END_SEM6000_TEST_CMD w/ options: --json===========


===========START_SEM6000_TEST w/ options: --led on===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --led on >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f090f0005010000000016ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 0f 00 00 10 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --led on===========


===========START_SEM6000_TEST w/ options: --led off===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --led off >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f090f0005000000000015ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 0f 00 00 10 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --led off===========


===========START_SEM6000_TEST w/ options: --overload 2500===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --overload 2500 >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f07050009c40000d3ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 05 00 00 06 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --overload 2500===========


===========START_SEM6000_TEST w/ options: --on===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --on >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f06030001000005ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 03 00 00 04 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --on===========


===========START_SEM6000_TEST w/ options: --off===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --off >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f06030000000004ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 03 00 00 04 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --off===========


===========START_SEM6000_TEST w/ options: --toggle===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --toggle >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f050400000005ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0f 04 00 00 00 00 00 df 00 00 31 01 00 00 00 00 00 16 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f06030001000005ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 03 00 00 04 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --toggle===========


===========START_SEM6000_TEST w/ options: --toggle===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --toggle >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f050400000005ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0f 04 00 01 00 00 00 df 00 00 31 01 00 00 00 00 00 17 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f06030000000004ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 03 00 00 04 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --toggle===========


===========START_SEM6000_TEST w/ options: --standby 0.01===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --standby 0.01 >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f050400000005ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0f 04 00 00 00 00 00 df 00 00 32 01 00 00 00 00 00 17 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --standby 0.01===========


===========START_SEM6000_TEST w/ options: --scheduler on 23:00 sMTWtfs 2022-01-05===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --scheduler on 23:00 sMTWtfs 2022-01-05 >> /tmp/heckie75-sem6000script-test.log

===========END_SEM6000_TEST_CMD w/ options: --scheduler on 23:00 sMTWtfs 2022-01-05===========


===========START_SEM6000_TEST w/ options: --scheduler on +120 sMTWtfs 2022-01-05===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --scheduler on +120 sMTWtfs 2022-01-05 >> /tmp/heckie75-sem6000script-test.log

===========END_SEM6000_TEST_CMD w/ options: --scheduler on +120 sMTWtfs 2022-01-05===========


===========START_SEM6000_TEST w/ options: --scheduler===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --scheduler >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f06140000000015ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 14 00 00 15 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --scheduler===========


===========START_SEM6000_TEST w/ options: --scheduler reset===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --scheduler reset >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f06140000000015ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 14 00 00 15 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --scheduler reset===========


===========START_SEM6000_TEST w/ options: --scheduler===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --scheduler >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f06140000000015ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 14 00 00 15 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --scheduler===========


===========START_SEM6000_TEST w/ options: --countdown on 2021-05-01 23:05:00===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --countdown on 2021-05-01 23:05:00 >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c080001000517010515000041ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 08 00 00 09 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --countdown on 2021-05-01 23:05:00===========


===========START_SEM6000_TEST w/ options: --countdown===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --countdown >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f05090000000affff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0e 09 00 01 00 05 17 01 05 15 b7 97 b6 00 46 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --countdown===========


===========START_SEM6000_TEST w/ options: --countdown reset===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --countdown reset >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c080000000000000000000009ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 08 00 00 09 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --countdown reset===========


===========START_SEM6000_TEST w/ options: --countdown===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --countdown >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f05090000000affff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0e 09 00 00 00 05 17 01 05 15 00 00 00 00 41 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --countdown===========


===========START_SEM6000_TEST w/ options: --price 0.24 0.20 20:00 05:00===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --price 0.24 0.20 20:00 05:00 >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0a0f000418180000000044ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 0f 00 00 10 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f090f00010104b0012cf3ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 0f 00 00 10 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --price 0.24 0.20 20:00 05:00===========


===========START_SEM6000_TEST w/ options: --price 0.24===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --price 0.24 >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0a0f000418180000000044ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 0f 00 00 10 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f051000000011ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0e 10 00 01 18 18 04 b0 01 2c 00 00 09 c4 f0 ff ff 00 00 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f090f0001000000000011ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 0f 00 00 10 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --price 0.24===========


===========START_SEM6000_TEST w/ options: --statistics reset===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --statistics reset >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f090f0002000000000012ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 0f 00 00 10 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f090f0001000042005eb1ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 04 0f 00 00 10 ff ff 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --statistics reset===========


===========START_SEM6000_TEST w/ options: --statistics===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --statistics >> /tmp/heckie75-sem6000script-test.log
[                 ][LE]> connect A3:00:00:00:21:0C

Attempting to connect to A3:00:00:00:21:0C
[A3:00:00:00:21:0C][LE]> 
Connection successful
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f0c170000010203040000000022ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:21:0C][LE]> char-write-cmd 0012 0f051000000011ffff

[A3:00:00:00:21:0C][LE]> 
Notification handle = 0x0014 value: 0f 0e 10 00 00 18 18 00 42 00 5e 00 00 09 c4 ae ff ff 00 00 
[A3:00:00:00:21:0C][LE]> 
===========END_SEM6000_TEST_CMD w/ options: --statistics===========


===========START_SEM6000_TEST w/ options: --sleep 9===========
#full command was: ./sem-6000.exp A3:00:00:00:21:0C 1234 --debug --verbose --sleep 9 >> /tmp/heckie75-sem6000script-test.log

===========END_SEM6000_TEST_CMD w/ options: --sleep 9===========

Hope this helps!

from voltcraft-sem-6000.

jrbergen avatar jrbergen commented on June 27, 2024

@martijnwb Nice adjustments; handige toevoeging. Will check the verbose output on my end sometime later. I suspect it'd be mostly equal to your output.

from voltcraft-sem-6000.

switchabl avatar switchabl commented on June 27, 2024

First of all, thanks to @Heckie75 for the great work. I have recently bought a SEM6000 and this project has been a goldmine of information (in particular, thank you so much for taking the time to write up API.md). In any case, it turns out I got the "new" version, so I thought I would share my observations in the hope that they will be helpful:

  • A read on characteristic 0xfff1 returns 564f4c43465404000000000111030019. I think byte 13 is the hardware revision, the new one has 0x03. It is possible that the different platforms do not share much code and behave differently even if both have firmware 1.17 (bytes 11, 12).
  • There is now a new version of the Android app that seems to work (4.18). A BLE capture is attached (app_v4_18.log).
  • The new Android app requests an ATT MTU of 160 bytes after checking 0xfff1. The meter can then send a single long notification instead when requesting the history data. If you do not request a larger MTU, the default is 23 bytes and instead of splitting the data (like the old one does) it is simply cut off. iOS always negotiates the largest MTU possible and when they pushed the new firmware they may not have been aware that the same is not true for Android... (in fact some older phones may not support setting MTU at all)
  • gatttool does support setting mtu. If I run mtu 160 after connect, it seems to work just fine.
  • Unfortunately, there seem to be some others quirks as well. The settings request (0x10) will return two additional null bytes that will make the script choke:
    0xfff3 WRITE -> 0f051000000011ffff
    0xfff4 NOTIFY -> 0f0e1000001cff0000007801000e6013ffff0000
    
  • Also the length field for the measurement notification (0x04) is now set to 0x0f instead of 0x11 (the actual length has not changed). This does not seem to cause any immediate problems. But it means naively relying on it to solve the other problem may not work.
    0xfff3 WRITE -> 0f050400000005ffff
    0xfff4 NOTIFY -> 0f0f0400010022dae50061310100000000249e
    
  • Not sure about the serial number. I have never seen the app requesting it. May be gone for good?

from voltcraft-sem-6000.

Heckie75 avatar Heckie75 commented on June 27, 2024

@switchabl
Thanks for these hints. I have added support for MTU but I am not able to test it.

I haven't changed the other quirks yet. Maybe later.

Example:

$ sem-6000 Ent --debug --verbose --device --json
INFO:   Init handles of device
INFO:   Handles initialised successfully
INFO:   Try to connect to FC:69:47:06:CB:C6
[                 ][LE]> connect FC:69:47:06:CB:C6
Attempting to connect to FC:69:47:06:CB:C6
Connection successful
[FC:69:47:06:CB:C6][LE]> INFO:  Connected to FC:69:47:06:CB:C6
INFO:   Try to set MTU to 160 bytes
mtu 160
MTU was exchanged successfully: 23
[FC:69:47:06:CB:C6][LE]> INFO:  <<<     MTU was exchanged to 23 bytes
INFO:   Auth SEM
INFO:   >>>     char-write-cmd 002b 0f0c170000000300090000000024ffff
INFO:   OK
char-write-cmd 002b 0f0c170000000300090000000024ffff
Notification handle = 0x002e value: 0f 06 17 00 00 00 00 18 ff ff
[FC:69:47:06:CB:C6][LE]> INFO:  <<<     Notification handle = 0x002b value: 0f 06 17 00 00 00 00 18 ff ff
INFO:   Response already completed in current notification in terms of announced length. No need to wait for another notification
INFO:   SEM authorized successfully with PIN
INFO:   Read name
INFO:   >>>     char-read-hnd 0003
char-read-hnd 0003
Characteristic value/descriptor: 56 6f 6c 74 63 72 61 66 74
[FC:69:47:06:CB:C6][LE]> INFO:  <<<     Characteristic value/descriptor: 56 6f 6c 74 63 72 61 66 74
INFO:   name successfully read
INFO:   Read firmware/hardware version
INFO:   >>>     char-read-hnd 0025
char-read-hnd 0025
Characteristic value/descriptor: 56 4f 4c 43 46 54 04 00 00 00 00 01 0d 02 00 1e
[FC:69:47:06:CB:C6][LE]> INFO:  <<<     Characteristic value/descriptor: 56 4f 4c 43 46 54 04 00 00 00 00 01 0d 02 00 1e
INFO:   Firmware/hardware version requested successfully
INFO:   Request serial number
INFO:   >>>     char-write-cmd 002b 0f051100000012ffff
INFO:   OK
char-write-cmd 002b 0f051100000012ffff
Notification handle = 0x002e value: 0f 15 11 00 4d 4c 30 31 44 31 30 30 31 32 30 30 30 30 30 30
[FC:69:47:06:CB:C6][LE]> INFO:  <<<     Notification handle = 0x002b value: 0f 15 11 00 4d 4c 30 31 44 31 30 30 31 32 30 30 30 30 30 30
INFO:   Response not complete, wait for another notification...
Notification handle = 0x002e value: 00 00 64 ff ff
[FC:69:47:06:CB:C6][LE]> INFO:  <<<     Notification handle = 0x002b value: 00 00 64 ff ff
INFO:   Response already completed in current notification in terms of announced length. No need to wait for another notification
INFO:   Serial requested successfully
{
  "device" : {
    "mac" : "FC:69:47:06:CB:C6",
    "pin" : "0309",
    "name" : "Voltcraft",
    "vendor" : "VOLCFT",
    "serial" : "ML01D10012000000",
    "firmware" : "1.13",
    "hardware" : "2.0",
    "mtu" : 23,
    "alias" : "Entertainment"
  },
  "settings" : null,
  "schedulers" : null,
  "countdown" : null,
  "randommode" : null,
  "status" : null,
  "data_per_hour" : [
  ],
  "data_per_day" : [
  ],
  "data_per_month" : [
  ],
  "statistics" : null
}
INFO:   Disconnect from FC:69:47:06:CB:C6

cc @jrbergen

from voltcraft-sem-6000.

switchabl avatar switchabl commented on June 27, 2024

@Heckie75 Thanks! I did a quick test and daily and monthly data now works for me:

$ ./sem-6000.exp v --debug --verbose --data month --print
INFO:	Init handles of device
INFO:	Handles initialised successfully
INFO:	Try to connect to A3:00:00:00:1E:52
[                 ][LE]> connect A3:00:00:00:1E:52
Attempting to connect to A3:00:00:00:1E:52
Connection successful
[A3:00:00:00:1E:52][LE]> INFO:	Connected to A3:00:00:00:1E:52
INFO:	Try to set MTU to 160 bytes
mtu 160
MTU was exchanged successfully: 160
[A3:00:00:00:1E:52][LE]> INFO:	<<<	MTU was exchanged to 160 bytes
INFO:	Auth SEM
INFO:	>>>	char-write-cmd 0012 0f0c170000000000000000000018ffff
INFO:	OK
char-write-cmd 0012 0f0c170000000000000000000018ffff
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:1E:52][LE]> INFO:	<<<	Notification handle = 0x0012 value: 0f 06 17 00 00 00 00 18 ff ff 
INFO:	Response already completed in current notification in terms of announced length. No need to wait for another notification
INFO:	SEM authorized successfully with PIN
INFO:	Request measured power consumption
INFO:	>>>	char-write-cmd 0012 0f050b0000000cffff
INFO:	OK
char-write-cmd 0012 0f050b0000000cffff
Notification handle = 0x0014 value: 0f 7b 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7d 00 00 00 51 00 da ff ff 
[A3:00:00:00:1E:52][LE]> INFO:	<<<	Notification handle = 0x0012 value: 0f 7b 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7d 00 00 00 51 00 da ff ff 
INFO:	Response already completed in current notification in terms of announced length. No need to wait for another notification
INFO:	Measured consumption of last day per hour successfully requested
2021-12-12	0
2021-12-13	0
2021-12-14	0
2021-12-15	0
2021-12-16	0
2021-12-17	0
2021-12-18	0
2021-12-19	0
2021-12-20	0
2021-12-21	0
2021-12-22	0
2021-12-23	0
2021-12-24	0
2021-12-25	0
2021-12-26	0
2021-12-27	0
2021-12-28	0
2021-12-29	0
2021-12-30	0
2021-12-31	0
2022-01-01	0
2022-01-02	0
2022-01-03	0
2022-01-04	0
2022-01-05	0
2022-01-06	0
2022-01-07	0
2022-01-08	0
2022-01-09	125
2022-01-10	81
INFO:	Disconnect from A3:00:00:00:1E:52

Hourly fails the checksum verification:

INFO:	Init handles of device
INFO:	Handles initialised successfully
INFO:	Try to connect to A3:00:00:00:1E:52
[                 ][LE]> connect A3:00:00:00:1E:52
Attempting to connect to A3:00:00:00:1E:52
Connection successful
[A3:00:00:00:1E:52][LE]> INFO:	Connected to A3:00:00:00:1E:52
INFO:	Try to set MTU to 160 bytes
mtu 160
MTU was exchanged successfully: 160
[A3:00:00:00:1E:52][LE]> INFO:	<<<	MTU was exchanged to 160 bytes
INFO:	Auth SEM
INFO:	>>>	char-write-cmd 0012 0f0c170000000000000000000018ffff
INFO:	OK
char-write-cmd 0012 0f0c170000000000000000000018ffff
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:1E:52][LE]> INFO:	<<<	Notification handle = 0x0012 value: 0f 06 17 00 00 00 00 18 ff ff 
INFO:	Response already completed in current notification in terms of announced length. No need to wait for another notification
INFO:	SEM authorized successfully with PIN
INFO:	Request measured power consumption
INFO:	>>>	char-write-cmd 0012 0f050a0000000bffff
INFO:	OK
char-write-cmd 0012 0f050a0000000bffff
Notification handle = 0x0014 value: 0f 33 0a 00 00 08 00 06 00 05 00 02 00 0b 00 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 0e 00 08 00 0b 00 0c 00 0a 00 0b 00 07 5c ff ff 
[A3:00:00:00:1E:52][LE]> INFO:	<<<	Notification handle = 0x0012 value: 0f 33 0a 00 00 08 00 06 00 05 00 02 00 0b 00 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 0e 00 08 00 0b 00 0c 00 0a 00 0b 00 07 5c ff ff 
INFO:	Response already completed in current notification in terms of announced length. No need to wait for another notification
ERROR:	Checksum of notification invalid!
ERROR:	Requesting measured power consumption failed
INFO:	Disconnect from A3:00:00:00:1E:52
$ 

This is fully reproducible and not a transmission error (BLE has its own CRC checksum, so that is unlikely to happen anyway). My best explanation is that they somehow managed to break the checksum computation for this message. The app doesn't seem to care, I don't think it verifies the checksum at all.

Everything else I have tried seems to work, apart from --settings (and, for the same reason, --statistics) which fails because of the "0000 quirk"

$ ./sem-6000.exp v --debug --verbose --settings --print
INFO:	Init handles of device
INFO:	Handles initialised successfully
INFO:	Try to connect to A3:00:00:00:1E:52
[                 ][LE]> connect A3:00:00:00:1E:52
Attempting to connect to A3:00:00:00:1E:52
Connection successful
[A3:00:00:00:1E:52][LE]> INFO:	Connected to A3:00:00:00:1E:52
INFO:	Try to set MTU to 160 bytes
mtu 160
MTU was exchanged successfully: 160
[A3:00:00:00:1E:52][LE]> INFO:	<<<	MTU was exchanged to 160 bytes
INFO:	Auth SEM
INFO:	>>>	char-write-cmd 0012 0f0c170000000000000000000018ffff
INFO:	OK
char-write-cmd 0012 0f0c170000000000000000000018ffff
Notification handle = 0x0014 value: 0f 06 17 00 00 00 00 18 ff ff 
[A3:00:00:00:1E:52][LE]> INFO:	<<<	Notification handle = 0x0012 value: 0f 06 17 00 00 00 00 18 ff ff 
INFO:	Response already completed in current notification in terms of announced length. No need to wait for another notification
INFO:	SEM authorized successfully with PIN
INFO:	Request settings
INFO:	>>>	char-write-cmd 0012 0f051000000011ffff
INFO:	OK
char-write-cmd 0012 0f051000000011ffff
Notification handle = 0x0014 value: 0f 0e 10 00 00 19 19 00 00 00 00 01 01 0e 60 b3 ff ff 00 00 
[A3:00:00:00:1E:52][LE]> INFO:	<<<	Notification handle = 0x0012 value: 0f 0e 10 00 00 19 19 00 00 00 00 01 01 0e 60 b3 ff ff 00 00 
INFO:	Response not complete, wait for another notification...
WARN:	Timeout. Notification not received
ERROR:	Notification invalid!
ERROR:	Checksum of notification invalid!
ERROR:	Requesting settings of SEM failed
INFO:	Disconnect from A3:00:00:00:1E:52

from voltcraft-sem-6000.

Heckie75 avatar Heckie75 commented on June 27, 2024

@switchabl

I have changed the parsing of notification. Pls. check if it works for you.

from voltcraft-sem-6000.

mniehren avatar mniehren commented on June 27, 2024

from voltcraft-sem-6000.

Heckie75 avatar Heckie75 commented on June 27, 2024

@mniehren

I have made some changes. Pls. check if it works for you

from voltcraft-sem-6000.

mniehren avatar mniehren commented on June 27, 2024

from voltcraft-sem-6000.

jrbergen avatar jrbergen commented on June 27, 2024

Thanks a lot!

Unfortunately a very busy period has just begun for me so it might take a while before I can help any debugging w/ my output.

from voltcraft-sem-6000.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.