mysensors / MySensors

MySensors library and examples
https://www.mysensors.org
1.31k stars 892 forks source link

[FEATURE REQUEST] Support RF (RFM69) decoder and parser for IKEA Sparsnäs electricity meter (sensor)? #1034

Closed Hedda closed 6 years ago

Hedda commented 6 years ago

Would it be possible to add this decoder for IKEA Sparsnäs (Ikea Sparnas electricity/energy meter) sensor?

There is already an existing project by @bphermansson for ESP8266 that does this with RFM69 but wondering if decoder code could be ported to MySensors?

https://github.com/bphermansson/EspSparsnasGateway

Some more information and links are posted here which I copy below:

http://www.letscontrolit.com/forum/viewtopic.php?f=10&t=3726

+1 request for IKEA Sparsnäs (Ikea Sparsnas) electricity meter with wireless display

http://www.ikea.com/se/sv/catalog/products/90292645/

At least in Sweden these are often on sale every so often with a large rebate via IKEA FAMILY and as such they can also be found relativly cheap from rebate scalpers on eBay (and its Tradera action-site in Sweden) following closely aften a sale.

http://www.ikea.com/se/sv/manuals/sparsnas-energidisplay__AA-1201480-1.pdf

"[SPARSNÄS energy display assists you to monitor the total usage of electricity in your home. The energy display consists of a transmitter and a display. The transmitter, which you attach to your electricity meter, continuously registers the usage of electricity and transfers the data wireless to the display. Place the display where it becomes a natural part of daily life in your home"

Again, @strigeus created the original an open source RTL-SDR decoder and parser for it:

https://github.com/strigeus/sparsnas_decoder

"SPARSNÄS uses a CC1101 chip configured for GFSK modulation at 868MHz. The two FSK symbol frequencies once downconverted to baseband are roughly 67kHz and 105kHz. (EDIT: It seems like with a different RTL-SDR the baseband frequencies are 12.5khz and 50khz. Maybe my first RTL-SDR was inaccurate). The packet length is 18 bytes, including the length byte, and a 16-bit CRC is appended to the end. The CC1101 sync word is 0xD201. The packet payload byte 5 to 17 are encrypted using a key derived from the sender device's ID. The encryption key is a repeating XOR key"

@tubalainen also has a fork of the above RTL-SDR project which convert and output as JSON to be used to pipe data to MQTT broker:

https://github.com/tubalainen/sparsnas_decoder

@Naesstrom in addition made a node-red flow to pipe/transfer from Sparsnas MQTT data script to InfluxDB for diplaying in for example Grafana. This uses the mqtt script from @tubalainen found here and splits up the json string to each value and puts it in a influxdb database.

https://github.com/Naesstrom/sparsnas_mqtt_nodered_influxdb

"The packet data is encrypted using your sender's ID. The sender ID is the last 6 digits of the serial number located under the battery."

"A BIG thanks to the https://www.facebook.com/groups/SHgruppen on Facebook"

@kodarn also has very detailed information how to decode and record the radio transmission from Sparnas transmitter:

https://github.com/kodarn/Sparsnas

Hedda commented 6 years ago

@mfalkvidd Tip is that Ikea currently have Sparnäs on sale for only 99kr (SEK) in some selected stores:

https://www.sweclockers.com/forum/trad/1506976-tradlos-display-for-99-pa-ikea

These types on tips on sale of Ikea Sparnäs have recently been posted often in this other thread:

http://elektronikforumet.com/forum/viewtopic.php?f=2&t=85006

It is also in that thread that some one the developers working on Sparnäs based solutions have posted.

Hedda commented 6 years ago

Here is also code projects to emulate an electricity meter to to send a signal to Sparnäs wireless display:

https://github.com/MagnusThome/sparsnas-esp8266-01

https://github.com/MagnusThome/sparnas-raspberry

Hedda commented 6 years ago

FYI; here are more detailed information information on how exactly Sparnäs work with power-meters :

https://github.com/kodarn/Sparsnas

@kodarn include a "LedBlinkerHelperToo" to emulate power-meter to help develop without Sparnäs.

@MagnusThome have also created similar LED blinkers for for it to do send a value to Sparnäs display, ex:

https://github.com/MagnusThome/sparsnas-esp8266-01 https://github.com/MagnusThome/sparnas-raspberry

This and other projects for the Sparnäs transmitter and the receiving display in this Swedish forum thread:

http://elektronikforumet.com/forum/viewtopic.php?f=2&t=85006

I think that Sparnäs is still very interesting to people because its really cheap and profesionally buildt.

fallberg commented 6 years ago

Thank you for your suggestion. However, the Sparsnäs uses it's own RF protocol, and it is incompatible with MySensors which uses it's own protocol. There is currently no plan to support multiple RF protocols on the same radio modules in the MySensors framework. However, if you are interested in developing and maintaining such support, you are welcome to file a pull request.