Code Monkey home page Code Monkey logo

sparsnas_decoder's People

Contributors

strigeus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sparsnas_decoder's Issues

License

Strigeus, could you please clarify under which license this code is released ?

sparsnas_mqtt.yaml

When using the code in sparsnas_mqtt.yaml i am getting error in HA

Invalid config for [sensor.mqtt]: [hidden] is an invalid option for [sensor.mqtt]. Check: sensor.mqtt->hidden. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/mqtt/
Invalid config for [sensor.mqtt]: [hidden] is an invalid option for [sensor.mqtt]. Check: sensor.mqtt->hidden. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/mqtt/
Invalid config for [sensor.mqtt]: [hidden] is an invalid option for [sensor.mqtt]. Check: sensor.mqtt->hidden. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/mqtt/
Invalid config for [sensor.mqtt]: [hidden] is an invalid option for [sensor.mqtt]. Check: sensor.mqtt->hidden. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/mqtt/
Invalid config for [sensor.mqtt]: [hidden] is an invalid option for [sensor.mqtt]. Check: sensor.mqtt->hidden. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/mqtt/

and this

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 270, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 448, in async_device_update
await self.async_update()
File "/usr/src/homeassistant/homeassistant/components/template/sensor.py", line 248, in async_update
self._state = self._template.async_render()
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 220, in async_render
return compiled.render(kwargs).strip()
File "/usr/local/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "", line 1, in top-level template code
TypeError: unsupported operand type(s) for -: 'float' and 'str'

hope this get an update its a great one love it

Feature request -- Output in JSON

Hello @strigeus !

Finally got things working! Thanks for the code.
My mistakes:

  • Not entering the sender ID correctly, it does not say explicitly in the code "use only the last 6 digits, leave out the 400". Caused confusion for me and about one week troubleshooting.
  • The frequency offset in hard to determine, I entered the value suggested in the screenshot and got a reading, adjusted based upon freq error presented.

Now, to parse more easily to an MQTT broker for use with any home automation tool, could you please add JSON output as an option? Thanks!

Not working with -O3

There seems to an issue when using gcc version 9.2.0 and higher optimization levels. I had to go down to -O0, otherwise the program segfaults. I tried debugging using gdb and simple "printf", and when using gdb it would trace the segfault to the line:

Complex v = {(float)(buf[ei * 2 + 0] - 128), (float)(buf[ei * 2 + 1] - 128)};

even though the index would not point outside the allocated space of buf. When using printf to debug, it appears to segfault in the return from the function run_for_frequencies. Neither makes much sense to me. Anyway, using -O0 solved the problem so that is a workaround.

How to record signal?

Can you please explain how you recorded the signal in the help picture? Which software?

Can't find FSK frequencies

Following the guide I manage to record a sample, but when running --find-frequencies I end up with "Nothing found" whatever I do. Tried both long & short recordings, tried changing antenna and moving the transmitter closer to receiver. I've double checked the ID number.

When running SDR#Sharp or other software I clearly see that i'm capturing something (not sure about the quality though). As I'm on Windows i've struggled to find a good program to measure the FSK frequencies myself.

Not really sure what to try to get further.

Decoded byte 5 is not always 0x0E on my Sparsnäs

Line 179:
if (data_[0] != 0x11 || data_[1] != (SENSOR_ID & 0xFF) || data_[3] != 0x07 || data_[4] != 0x0E || rcv_sensor_id != SENSOR_ID) {

data_[4] toggles seemingly randomly between 0x0D and 0x0E on my Sparsnäs, generating a lot of illegal packets. Perhaps it is a flag?

Problem handling drifting

Have spent some hours trying to get my head a problem with a Sparsnäs not cooperating at all. Very hard to get hold of the base frequencies and when detected it only works for a short while and FreqErr is indicating drifting but not sure on which side. Sharing this in hope someone else might shed some light on the issue.

Including some data from a classical black dongle. Have also tried with a V3 with TXCO which usually is rock solid. No better luck with that one though. Tried to "pre-heat" the dongles before measuring the frequencies. Got a bit more stable results on the fq numbers but not much better decoding.

rtl_sdr -f 868000000 -s 1024000 -g 10 -d 0 - | ./sparsnas_decode
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 07001060

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Sampling at 1024000 S/s.
Tuned to 868000000 Hz.
Tuner gain set to 8.70 dB.
Reading samples in async mode...
[2018-04-11 15:40:05] 1235: 2223.9 W. 2.094 kWh. Batt 100%. FreqErr: 0.73
[2018-04-11 15:40:20] 1236: 2190.1 W. 2.101 kWh. Batt 100%. FreqErr: -1.35
[2018-04-11 15:40:35] 1237: 2228.2 W. 2.108 kWh. Batt 100%. FreqErr: -0.82
[2018-04-11 15:40:50] 1238: 2215.4 W. 2.116 kWh. Batt 100%. FreqErr: -0.62
...
[2018-04-11 15:47:35] 1265: 201.0 W. 2.300 kWh. Batt 100%. FreqErr: -5.89
[2018-04-11 15:47:50] 1266: 120.4 W. 2.300 kWh. Batt 100%. FreqErr: -6.46
[2018-04-11 15:48:05] 1267: 85.9 W. 2.300 kWh. Batt 100%. FreqErr: -6.53
[2018-04-11 15:48:20] Bad: 11 04 74 07 0F A2 30 19 43 D4 56 29 60 47 D0 AA C5 DC
[2018-04-11 15:48:35] Bad: 11 04 75 07 0F A2 30 19 43 D4 57 2A E5 47 D0 AA C4 DC
[2018-04-11 15:48:50] Bad: 11 04 76 07 0F A2 30 19 43 D4 54 2A E5 47 D0 AA C4 DC

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.