Homey Community

Convert sensor binary data to Homey Signal definition


#1

Hi there,

I have been playing with an sdr dongle to read the signal of my KR-P861 motion sensor. I have the data and am a little bit stuck now. How can I convert the binary data to a homey signal definition?

The motion sensor is a Kerui P861 Wireless Outdoor Motion sensor

  • Transmission Frequency 433.920Mhz
  • Modulation ASK

Any help would be greatly appreciated.


#2

It looks like the program you’re using has already decoded the signal. Can it export some sort of signal definition?


#3

Playing with SDR is good for general knowledge but of no real use for developing of an app.
Create a signal definition according to the Athom developer site.
https://developer.athom.com/docs/apps/tutorial-Signals.html
And then create a Homey app with that signal definition for your devices.


#4

I don’t see why it wouldn’t be. The most difficult part of creating a Homey signal definition is finding the correct timings, and SDR tools are great at automating that (as the screenshot is showing).

If the program can show/export the timings, you should be able to create a Homey signal definition from it.


#5

Thanks a lot for the feedback. I will delve into the Signals tutorial right away.
Btw the app I’m using is the Universal Radio Hacker


#6

After reviewing the tutorial Creating a Signal and trying to understand what the numerical values of sof/words were. I guess it should be possible to determine the signal definitions for Homey using Universal Radio Hacker. The modulated ASK signal can be viewed in a demodulated form as shown in the lower part of the screenshot. The timings can be determined by zooming and panning in the tool. Maybe there is a plugin or another app that does this automatically?


#7

I have no experience with Universal Radio Hacker whatsoever, but if you’re willing to share your recorded data I’d be happy to take a look as well.


#8

Not a lot of experience here either. I have been using the app for 2 days now.
You can download a copy of the recorded signal here RTL-SDR-433_920MHz-1MSps-1MHz-battery-removed.zip

So far I came up with this signal definition:

{
	"sof": [327, 946],
	"eof": [307],
	"words": [
		[966, 307],
		[327, 946],
	],
	"interval": 9720,
	"sensitivity": 0.5,
	"repetitions": 36,
	"minimalLength": 97,
	"maximalLength": 97
}

Determining the timing is pretty straight forward using the Signal View. Selecting the desired bits in the signal view highlights the signal and displays the total amount of μs/ms for the selected bits. It’s a lot easier than using audacity to determine the timings.

I’m not really sure if the timings are correct but this was the idea.


#9

From that signal definition, and the waveform you posted, it doesn’t look like the signal actually has a SOF or EOF, it just sends the words. Typically, a SOF/EOF has completely different timings.

I’ll take a closer at the actual data tomorrow.


#10

I’ve created a simple tool to create a Homey signal definition. Maybe its useful? https://github.com/harriedegroot/Athom-Homey-RF-Signal-Analyzer


#11

Harrie,

I did use your tool to generate a signal but wasn’t sure if the result would work with my sensor. Thanks anyways! But I thought it would also be fun to figure out how to decompose the signal by hand and understand how this works.

Motion alarm
10001110 11101000 10001000 10001110 11101110 11101110 10001110 11101000 10001110 11101000 11101000 11101000 1
Translates to FX0011FXFXXXS

Tamper alarm
10001110 11101000 10001000 10001110 11101110 11101110 10001110 11101000 10001110 11101000 11101000 11101110 1
Translates to FX0011FXFXX1S

If I decompose the timings for FX0011FXFXXXS and FX0011FXFXX1S I should be good to go…:crossed_fingers: