# Convert sensor binary data to Homey Signal definition

**URL:** https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114
**Category:** Developers
**Created:** [December 31, 2018, 7:50am UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114 "2018-12-31T07:50:58Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)
#### Post date: [December 31, 2018, 7:50am UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114/1 "2018-12-31T07:50:58Z")

</div>

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?](https://github.com/athombv/node-homey-433/blob/master/HOWTO_CREATE_SIGNAL.md)

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/5/5e9c761b9866168bb89c31af0269f2ed544d75a6.png)

The motion sensor is a Kerui P861 Wireless Outdoor Motion sensor

- Transmission Frequency 433.920Mhz
- Modulation ASK

Any help would be greatly appreciated.

---

<div class="post-metadata">

### Author: ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)
#### Post date: [December 31, 2018, 8:01am UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114/2 "2018-12-31T08:01:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Dijker](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dijker](https://community.homey.app/u/Dijker)
#### Post date: [December 31, 2018, 8:10am UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114/3 "2018-12-31T08:10:43Z")

</div>

> [@Marlon](#):
>
> I have been playing with an sdr dongle to read the signal of my KR-P861 motion sensor.

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](https://developer.athom.com/docs/apps/tutorial-Signals.html)  
And then create a Homey app with that signal definition for your devices.

---

<div class="post-metadata">

### Author: ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)
#### Post date: [December 31, 2018, 8:16am UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114/4 "2018-12-31T08:16:35Z")

</div>

> [@Dijker](#):
>
> Playing with SDR is good for general knowledge but of no real use for developing of an app.

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.

---

<div class="post-metadata">

### Author: ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)
#### Post date: [December 31, 2018, 8:42am UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114/5 "2018-12-31T08:42:00Z")

</div>

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](https://github.com/jopohl/urh)

---

<div class="post-metadata">

### Author: ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)
#### Post date: [December 31, 2018, 2:43pm UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114/6 "2018-12-31T14:43:50Z")

</div>

After reviewing the tutorial [Creating a Signal](https://developer.athom.com/docs/apps/tutorial-Signals-Creating%20a%20Signal.html) 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?

 ![Capture1](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/2/2ba6bc44bef26616a927e5af83e2900ead30e90c.png)

---

<div class="post-metadata">

### Author: ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)
#### Post date: [December 31, 2018, 2:53pm UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114/7 "2018-12-31T14:53:39Z")

</div>

> [@Marlon](#):
>
> Universal Radio Hacker.

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.

---

<div class="post-metadata">

### Author: ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)
#### Post date: [January 1, 2019, 5:13pm UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114/8 "2019-01-01T17:13:46Z")

</div>

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](https://1drv.ms/u/s!Agj1NJiEBBfSgsITBKko0DKBF2wxTg)

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.

 ![signal2](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/0/04b34b7b1397ef2e19c51b6f186baa3a1234d4e6.png)

---

<div class="post-metadata">

### Author: ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)
#### Post date: [January 1, 2019, 5:55pm UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114/9 "2019-01-01T17:55:17Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![HarriedeGroot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harriedegroot/32/56160_2.png) [@HarriedeGroot](https://community.homey.app/u/HarriedeGroot)
#### Post date: [January 1, 2019, 7:42pm UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114/10 "2019-01-01T19:42:42Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)
#### Post date: [January 2, 2019, 9:40am UTC](https://community.homey.app/t/convert-sensor-binary-data-to-homey-signal-definition/6114/11 "2019-01-02T09:40:24Z")

</div>

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…🤞
