Git Product home page Git Product logo

voltcraft-sem-6000's Issues

Sending PIN is not needed for capturing measurement

By accident I found out that after opening the BLE connection to the Voltcraft you can directly transmit a Capture Measurement command and you will recieve a valid BLE notification containing actual values.

I tried and for other requests like setting the power switch/LED ring on/off you will receive a "Authorization invalid/missing PIN" BLE notification but for capture measurement it is just Capture measurement response 0x0400 BLE notification.

Edit: is there an easy way to account for this in the script?

Trying to understand the checksum calculation

Hi, I hope it's ok to ask this question via an 'issue', not sure where else I could ask :)

I'm trying to understand how the checksum calculation works.

I did find the section in your code where i believe it is being calculated. But I can't replicate the checksums given in your api documentation, which must be correct because the commands work.

from your code:

  # add payload and calculate checksum
  set sum 1
  foreach b $bytes {
    lappend full_req $b
    set sum [ expr $sum + [ scan $b %d ] ]
  }
  set sum [ expr $sum & 255 ]
  lappend full_req $sum

Given this example from your documentation
char-write-cmd 0x2b 0f0c170001010203040000000018ffff

My understanding is I have to take the part 0c1700010102030400000000 into account for the checksum calculation

I then loop over the individual bytes and add them to chksm and at the end I have to & 0xFF them, which should net me 0x18, however I'm getting 0x2F, with the following python example

data = bytearray.fromhex('0c1700010102030400000000')
chksm = 1
for d in data:
    chksm += d
print( hex(chksm & 0xff) )

Would be great if you could shine some light on this. I've looked at multiple repos and I can't figure it out :/

edit: After some more attempts: I haven't actually encountered a command that doesn't work when I calculate the checksum excl. the length byte, aside from some examples in your api documentation (e.g. the one above). My guess atm. is that in those cases the checksum is simply not correct in the documentation :?

Power factor not in --status --json output

The --status --print human readable output also shows the calculated the power factor (source) but the --status --json output does not include it (source). I see that the power factor can be calculated from the other values in the JSON output but maybe it would be easier to include it directly? Or is there a downside in doing that?

Also wanted to say: cool project and reverse engineering, thanks!

Time is 1h ahead

After sync, measurement time is +1h:
[date
Sun 20 Nov 19:02:18 CET 2022
jan@raspberrypi:~ $ ./sem-6000.exp p --sync
jan@raspberrypi:~ $ ./sem-6000.exp p --measure header --measure 10
Timestamp Power Volt (V) Ampere (A) Watt (W) Frequency (Hz) Power factor
2022-11-20 20:02:44 1 231 0.0 0.0 49 1
2022-11-20 20:02:45 1 231 0.0 0.0 49 1
2022-11-20 20:02:46 1 231 0.0 0.0 49 1
2022-11-20 20:02:46 1 231 0.0 0.0 49 1
2022-11-20 20:02:47 1 231 0.0 0.0 49 1
2022-11-20 20:02:48 1 230 0.0 0.0 49 1
2022-11-20 20:02:48 1 228 0.0 0.0 49 1
2022-11-20 20:02:49 1 228 0.0 0.0 49 1
2022-11-20 20:02:50 1 230 0.0 0.0 49 1
2022-11-20 20:02:50 1 230 0.0 0.0 49 1
2022-11-20 20:02:51 1 230 0.0 0.0 49 1
2022-11-20 20:02:52 1 230 0.0 0.0 49 1
2022-11-20 20:02:52 1 230 0.0 0.0 49 1
jan@raspberrypi:~ $

Consumption trigger problem

The consumption statistics can be read, start time can be set and it can be reset to 0. But in my case it does not start counting the consumption. The current consumption is read out correctly, but the consumption for the last hour, day, etc. stays 0. I read out via bluetooth with an raspberry pi and the LED ring keeps blinking blue.
But if the voltcraft App once started then the LED ring turns automatically green and I can stop the app again. Now the consumption per hour, day, etc. starts growing. Is there a way to trigger the "voltcraft sem" like the APP to not manually have to activate it (which signal is send to the "voltcraft sem" from the APP)?

Integration into lm_sensors

Hello,
any chance to integrate the --measure command into lm_sensors? If the values like voltage, ampere and power became familiar to sensors, one could easily make nice looking realtime plots with KSysGuard for example.

Total Power always zero

Hoi, I like the work done on the script t decode the data.
Who I compare the information in the Mobile app with the Status command in the script, I see that the total energy is always 0. ( Also in the examples you show)
I have decoded the hex stringiest and see that the location where you read the Total is also 0.

I think we need to look at a different place for the total power used.

Only working with firmware 1.16?

Hi,
first of all: thanks for this great project.
I've used this to get remote access to my power plugs for a long time. For some reason I installed the app and when I connected the plugs, the app told me that there is a firmware update. I did the update, my plugs firmware is now on version 1.22 and I cannot connect with this project :(
Is there any hope for me to get it working again, either by downgrading the firmware (is it possible? if yes, how?) or by an adopted version of this project?
Kind Regards, Mike

Get Wh for shorter period

If I understand README correctly no measurement command measures power consumption (Wh) but just current (W or A). Just recorded data can show power consumption but by hours and days.

Is it possible to get power consumption for shorter periods like 5s or minute?

Auth failed

Using the correct pin (set by smartphone) I still get:

root@pi01:~# ./sem-6000.exp vc1 --verbose --sync
INFO:   Try to connect to 50:51:A9:76:5E:89
INFO:   Connected to 50:51:A9:76:5E:89
INFO:   Synchronize SEM
INFO:   >>>     char-write-req 2b 0f0c01001e370e060707e400005dffff
INFO:   OK
INFO:   <<<     Notification handle = 0x2b 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 50:51:A9:76:5E:89
root@pi01:~# ./sem-6000.exp vc1 --verbose --status
INFO:   Try to connect to 50:51:A9:76:5E:89
INFO:   Connected to 50:51:A9:76:5E:89
INFO:   Auth SEM
INFO:   >>>     char-write-req 2b 0f0c170000010203040000000022ffff
WARN:   Timeout. Notification not received
ERROR:  Notification invalid!
ERROR:  Checksum of notification invalid!
ERROR:  Authorization failed. Check PIN!
ERROR:  Authorization failed. Check PIN!

Any idea what could be wrong? The phone was not connected at the time anymore. Otherwise I would get "Connection failed".

connect error: Function not implemented (38)

Since this week I am getting this error when executing the script.
Is something similar happening to anyone?

connect error: Function not implemented (38)
while executing
"exec gatttool -b $sem(mac) --characteristics > $hndfile"
(procedure "setup_characteristics" line 6)
invoked from within
"setup_characteristics"
(procedure "init_handles" line 11)
invoked from within
"init_handles"
(procedure "init" line 9)
invoked from within
"init $INIT(auth)"
("^sync$" arm line 3)
invoked from within
"switch -regexp $command {

^sync$ {

  init $INIT(auth)
  req_sync

}
^status$ {

  init $INIT(auth)
  capture_measurement..."
(procedure "do_command" line 12)
invoked from within

"do_command $param"
("while" body line 13)
invoked from within
"while { 1 } {

set param [ lindex $argv 0 ]
set argv [ lrange $argv 1 end ]

if { [string range $param 0 1 ] == "--" } {
set param [string r..."
(file "./sem-6000.exp" line 3580)

adding ssh for remote overwatch

Hi!

It works perfectly with my voltcraft.
But i had an idea, would it be to difficult to add an ssh function?
For example:
./sem-6000.exp Voltcraft -r 192.168.0.1 --status --print

Why?
Example; A freebsd server, that has no bluetooth capabilities but still wants to serve energy consumption data to a webpage.
Thanks for great code!

Unable to Authenticate

I am using a Raspberry PI 3B

I Changed the PIN with the smartphone app to 1235

SEM6000 Firmware: 1.17

I used hcitool lescan to discover the mac address of the device

pi@raspberrypi:~ $ sudo hcitool lescan
LE Scan ...
FB:CB:A5:59:9F:40 LHB-EB49174B
FB:CB:A5:59:9F:40 (unknown)
8C:EA:48:FA:38:11 (unknown)
8C:EA:48:FA:38:11 [AV] Samsung Soundbar Q800A
1C:52:16:51:36:7D (unknown)
EB:21:9B:59:43:E1 LHB-415EF7F9
EB:21:9B:59:43:E1 (unknown)
41:F9:9E:FF:62:87 (unknown)
ED:29:F8:84:60:93 (unknown)
A3:00:00:00:1D:80 Voltcraft
A3:00:00:00:1D:80 Voltcraft

I setup the .known_sem6 file

pi@raspberrypi:~ $ cat .known_sem6
A3:00:00:00:1D:80 1235 test

I tried --sync but got the following result

pi@raspberrypi:~ $ ./sem-6000.exp test --verbose --sync
INFO:   Try to connect to A3:00:00:00:1D:80
INFO:   Connected to A3:00:00:00:1D:80
INFO:   Synchronize SEM
INFO:   >>>     char-write-req 2b 0f0c0100083a110e0c07e500005bffff
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:1D:80

I tried to retrieve the status

pi@raspberrypi:~ $ ./sem-6000.exp test --verbose --status
INFO:   Try to connect to A3:00:00:00:1D:80
INFO:   Connected to A3:00:00:00:1D:80
INFO:   Auth SEM
INFO:   >>>     char-write-req 2b 0f0c170000010203050000000023ffff
WARN:   Timeout. Notification not received
ERROR:  Notification invalid!
ERROR:  Checksum of notification invalid!
ERROR:  Authorization failed. Check PIN!
ERROR:  Authorization failed. Check PIN!

I looked through issue #9 and compared the gatt characteristics but they seem to differ

pi@raspberrypi:~ $ gatttool -b A3:00:00:00:1D:80 -I
[A3:00:00:00:1D:80][LE]> connect
Attempting to connect to A3:00:00:00:1D:80
Connection successful
[A3:00:00:00:1D:80][LE]> 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
[A3:00:00:00:1D:80][LE]>

Is it possible that firmware 1.17 is incompatible with the script?
I can get data / control the device using the app without any problems.

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.