Skip to content

Add protocol 278 'omni.c' device driver for microcontroller multisensor protocol #3278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 42 commits into
base: master
Choose a base branch
from

Conversation

hdtodd
Copy link
Contributor

@hdtodd hdtodd commented May 18, 2025

The 'omni.c' driver decodes programmable microcontroller (Arduino, Pico2, etc.) transmissions to rtl_433. The protocol offers 16 possible sensor-data formats in an 8-byte payload.

Example microcontroller programs to generate omni-compatible transmissions for rtl_433 are available for Pico2 and Arduino.

Decoder output and signal data are available in rtl_433_tests/test/omni.

@zuckschwerdt
Copy link
Collaborator

Thanks! Quick note: output_fields and r_device const should be at the bottom of the file. Both must be immutable, just list all possible keys in one output_fields.

@hdtodd
Copy link
Contributor Author

hdtodd commented May 19, 2025 via email

@hdtodd
Copy link
Contributor Author

hdtodd commented May 19, 2025 via email

@zuckschwerdt
Copy link
Collaborator

The output_fields is read just once upon program start (actually when registering devices). It's used just to populate CSV columns. It's okay-ish to have unused keys in there.

@zuckschwerdt
Copy link
Collaborator

It needs to be r_device const omni = { to work with our check scripts, I guess.

@hdtodd
Copy link
Contributor Author

hdtodd commented May 25, 2025

Pausing pull request to resolve a possible issue

@hdtodd hdtodd closed this May 25, 2025
@hdtodd
Copy link
Contributor Author

hdtodd commented May 25, 2025

Reinserted a whole block of code that was missing & rechecked that
both format 00 and format 01 are recognized and correctly reported by
the omni.c decoder.

@hdtodd hdtodd reopened this May 25, 2025
@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 2, 2025 via email

@hdtodd hdtodd changed the title Add protocol 277 'omni.c' device driver for microcontroller multisensor protocol Add protocol 278 'omni.c' device driver for microcontroller multisensor protocol Jun 3, 2025
@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 3, 2025

Renumbered to Protocol 278

@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 3, 2025

I saw that apator was added as protocol 277, so I needed to renumber mine.

I worked through the merge conflicts to move omni to 278 in ./include/rtl_433_devices.h (by position there after aptor) and in ./conf/rtl_433.example.conf. After a cmake rebuild, rtl_433 didn't recognize my omni devices.

So I did a rm -rf build and rebuilt the directory with cmake and recompiled.

rtl_433 still didn't recognize omni.

So I reverted: made omni as protocol 277 and apator as 278 by editing rtl_433_devices.h and rtl_433.example.conf. Removed the build directory and rebuilt with cmake and recompiled.

rtl_433 then recognized my omni devices.

I moved my rtl_433 directory aside, cloned a fresh merban/rtl_433 again, followed the instructions for adding a new decoder, and compiled it. rtl_433 -R shows that protocol 278, 'omni', is supported, but in operation, it doesn't decode my omni devices. If I again, in this new directory tree, reverse the positions and protocol numbers of omni and apator, rtl_433 does recognize it.

In both cases, where rtl_433 does and doesn't recognize the omni protocol, rtl_433 -A does see the same (correct) 336-pulse pattern and timings.

I've tried to follow https://github.com/merbanan/rtl_433/blob/master/docs/CONTRIBUTING.md and BUILDING.md, but I'm obviously missing some step.

Anything obvious?

@zuckschwerdt
Copy link
Collaborator

Running with some fictitious test data, e.g. -y "091112223344556677eb/091112223344556677eb" seems to work fine:

model     : Omni-Multisensor                       Id        : 9
Format    : 0            Core Temperature: 27.40 ˚C
VCC voltage: 4.19 V       Payload   : 1112223344556677                        Integrity : CRC

@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 3, 2025 via email

@zuckschwerdt
Copy link
Collaborator

Re MQTT: Some of the keys are not in the correct format, e.g. light % can be used.

@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 4, 2025

Ah, I see, "light %" rather than "Light %".

Fixed just now

@zuckschwerdt
Copy link
Collaborator

What I meant is that "light %" should be "light_pct", the format should likely have a space, i.e. "%.0f %%", and the key in output_fields should change from "light_level", to "light_pct", also.

@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 4, 2025

Got it. Done & in checks.

@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 4, 2025

I did a "git pull merbanan master" and recompiled with omni as 278 and apator as 277, and the decoder still fails to recognize the device broadcasts or publish via MQTT.

I made omni be 277 and apator be 278, did a "rm -rf build", recreated ./build, and recompiled, and the decoder recognized device broadcasts and published via MQTT.

I looked at the apator signal timings, and I don't see how they could be misinterpreted as omni's and so maybe take precedence for recognition. But I haven't studied how rtl_433 matches signal patterns, so maybe I missed something there.

In my attempt to find a maximum number of protocols in a configuration file, searches for 277, 278, MAX, and PROTO in ./src and ./include didn't find anything that should be changed.

Any thoughts as to what else might be going on or where I should look?

@zuckschwerdt
Copy link
Collaborator

Decoders run isolated, there is no possible collision. I don't see any practical reason why the order would matter. The current PR decodes test data fine here. Did you check git status for other modified files? Note that git pull won't reset anything, it's just a fetch & merge.

@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 4, 2025

Yes, I did check with 'git status' for other files ... nothing. I even cloned the merbanan master, did a fresh install, added the omni decoder after apator, and got the same result.

I'll try that again first thing in the morning.

Thanks for thinking about this. I can't see any obvious problem, but I'm sure it's something I did by accident and simply didn't think about at the time.

I'll do the fresh clone again tomorrow to start from scratch and see if it works that way. I'm not making much progress this way.

@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 5, 2025

I've run out of ideas to try. I spent the afternoon re-cloning and testing in various ways (log below), but I consistently have rtl_433 decoding omni devices if it's registered as 277 (before apator) and failing to decode them if it's after apator (apator as protocol number 277, omni as protocol number 278).

It makes no sense to me, but I need a break this. If you think of anything else to try, let me know.

Oh, and I did notice in maintainer_update.py that MAX_PROTOCOLS is no longer computed, so I didn't imagine it in the past, but it's not needed any more.

  1. Confirmed that my version of rtl_433 was receiving and decoding omni device broadcasts

  2. Renamed my rtl_433 development directory to keep it out of harm's way.

  3. Cloned a fresh copy of merbanan/rtl_433

    • cd rtl_433
    • cmake -B build
    • cmake --build build --target install
    • confirmed that the new rtl_433 was installed in /usr/local/bin
    • rtl_433 -R showed that apator was 277; no omni device
    • restarted rtl_433 and confirmed that it was NOT decoding omni device broadcasts
  4. Followed doc/CONTRIBUTING.md (needs updating) to add omni.c to src/devices, edit include/rtl_433_devices.h to append DECL(omni) \ to the list

    • ran ./maintainer_update.py: apator 277, omni 278
    • compiled version updated to include omni
    • confirmed that the new version was in /usr/local/bin
    • restarted with the new version: it did not decode omni
  5. Reverse positions of apator and omni in include/rtl_433_devices.h,
    making omni be 277

    • rm -rf build
    • cmake -B build
    • cmake --build build --target install
    • confirm with ./maintainer_update.py that omni is 277, apator is 278
    • confirm that newest compiled version is in /usr/local/bin
    • restart rtl_433
    • version with omni as 277 decodes omni device broadcasts
  6. Try again, from the start, remembering to edit CMakefile.txt to add omni.c

    • Remove today's cloned copy of merbanan/rtl_433
    • Clone a fresh copy of merbanan/rtl_433
    • copy omni.c from my tree into newly-cloned src/devices
    • add DECL(omni) \ to include/rtl_433_devices.h
    • add devices/omni.c to CMakefiles.txt
    • ./maintainer_update.py shows apator 277, omni 278
    • confirm that the newly-compiled version is in /usr/local/bin
    • rtl_433 does NOT decode broadcasts from omni devices
  7. For the latest compilation, reverse omni & apator

    • rm -rf build
    • Edit include/rtl_433_devices.h to reverse the order of omni & apator
    • cmake -B build
    • cmake --build build --target install
    • ./maintainer_update.py confirms omni 277, apator 278
    • rtl_433 DOES decode broadcasts from omni devices
  8. Try again from the start: Reverse omni & apator protocols BEFORE first compilation in a newly-cloned directory

    • Remove prior rtl_433 tree
    • Clone a fresh copy from merbanan/rtl_433
    • copy omni.c from my development tree to this new clone's src/devices
    • edit include/rtl_433_devices to insert DECL(omni) BEFORE apator
    • edit src/CMakefiles.txt and insert devices/omni.c in alpha order
    • edit conf/rtl_433,example.conf to add protocol 277 Omni Multisensor and change apator's number to 278
    • cmake -B build
    • cmake --build build --target install
    • confirm with ./maintainer_update.py that omni is 277 & apator is 278
    • confirm that this newly-compiled version is in /usr/local/bin
    • restart rtl_433
    • rtl_433 DOES decode broadcasts from omni devices.
  9. Reverse omni & apator in this working version

    • rm -rf build
    • reverse the locations of apator & omni in include/rtl_433_devices.h
    • reverse the lines and protocol numbers in conf/rtl_433.example.conf
    • cmake -B build
    • cmake --build build --target install
    • ./maintainer_update.py shows apator 277, omni 278
    • confirm that this newly-compiled version is in /usr/local/bin
    • restart rtl_433
    • rtl_433 DOES NOT decode broadcasts from omni devices
  10. Reverse back to omni 277, apator 278

    • rm -rf build
    • reverse the locations of apator & omni in include/rtl_433_devices.h
    • reverse the lines and protocol numbers in conf/rtl_433.example.conf
    • cmake -B build
    • cmake --build build --target install
    • ./maintainer_update.py shows omni 277, apator 278
      • confirm that this newly-compiled version is in /usr/local/bin
    • restart rtl_433
    • rtl_433 DOES decode broadcasts from omni devices

@zuckschwerdt
Copy link
Collaborator

Did you do a live test, or test with samples (cu8), or with a test code (-y)? Do you get the same (bad) results with all?
Did you look for the kv text output or only the MQTT output?

Can you upload a sample as zip here? Test codes work and I can check a sample too.

@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 6, 2025

I did live tests. I just ran through the same set of build/test/edit/build/test ... sequence as yesterday, this time testing with '-y'. The '-y' tests DID decode (or, at least, the one for which I used the right command ... see the end of this posting). Except for that, I got the same results as yesterday: omni at 277 works; omni at 278 doesn't.

I also tried it on one of the .cu8 files from the testing directory, and it also did NOT decode the signal.

I only looked for the MQTT output yesterday.

So today, I tried rtl_433 -F kv on the last-compiled version (which decoded '-y' but not live broadcasts). It decoded the various other sensors in the neighborhood but did not decode the omni sensors.

The .cu8, .ook, and .json testing files are in my rtl_433_tests/tests/omni directory, if you have access to that (there's a PR in for it). I'll zip them and try to upload them here after this message.

Here's the log of what I did today. Note some of the problems with the directions for adding devices, mentioned in item 2 below. I ended up doing an rm -rf build before every new cmake just to make sure I didn't have debris from prior compiles.

Retesting my version of rtl_433

Using my version of rtl_433 with omni as protocol 277 and apator as protocol 278,

As transmitted from Pico 2 running omni.ino (live transmission)::

13:19:40.980 -> Transmit msg 7 iTemp=30.50˚C, oTemp=29.00˚C, iHum=49.00%, light=50.00%, Press=995.00hPa, VCC=4.88volts in hex: 0x 19 13 11 22 31 32 26 DE BC 8E
13:19:40.980 -> The msg packet, length=80, as a string of bits: 00011001000100110001000100100010001100010011001000100110110111101011110010001110

As reported on my Mac running mosquitto_sub -h pi-1 -t "rtl_433/pi-1/events" (live reception):

{"time":"2025-06-06 13:19:40","protocol":277,"model":"Omni-Multisensor","id":9,"channel":1,"temperature_C":30.5,"temperature_2_C":29.0,"humidity":49.0,"light_pct":50.0,"pressure_hPa":995.0,"voltage_V":4.88,"mic":"CRC","mod":"ASK","freq":433.93981,"rssi":0.68382,"snr":24.09885,"noise":-24.0994}

sudo rtl_433 -y "19131122313226DEBC8E/19131122313226DEBC8E" -c gives:


time : 2025-06-06 13:26:29
model : Omni-Multisensor Id : 9
Format : 1 Indoor Temperature: 30.50 ˚C Outdoor Temperature: 29.00 ˚C
Indoor Humidity: 49 % Light : 50 % BarometricPressure: 995.0 hPa VCC voltage: 4.88 V
Integrity : CRC
hdtodd@pi-1 ~ $


Testing a fresh clone of merbanan/rtl_433

Move my rtl_433 aside and download a fresh copy of merbanan/rtl_433, and create an rtl_433 with omni as the last device:

  1. Cloned a fresh copy of merbanan/rtl_433

    • cd rtl_433
    • cmake -B build
    • cmake --build build --target install
    • confirmed that the new rtl_433 was installed in /usr/local/bin
    • rtl_433 -R showed that apator was 277; no omni device
    • restarted rtl_433 and confirmed that it was NOT decoding omni device broadcasts, and rtl_433 -y "19131122313226DEBC8E/19131122313226DEBC8E" did not decode the message.
  2. Followed doc/CONTRIBUTING.md (needs updating) to add omni.c to src/devices, edit include/rtl_433_devices.h to append DECL(omni) \ to the list

    • did a git commit as required by maintainer_update and ran ./maintainer_update.py: apator 277 BUT NO OMNI DEVICE. Remembered that yesterday I had to edit conf/rtl_433.examples.conf too, to add omni in.
    • edited conf/rtl_433.examples.conf to add protocol 278 # Omni Multisensor after 277, apator
    • did a git commit as required by maintainer_update and ran ./maintainer_update.py: apato 277 BUT NO OMNI DEVICE. Remembered that yesterday I had to rm -rf build and re-do both cmakes.
    • rm -rf build
    • cmake -B build and cmake --build build --target install; confirmed that the new version installed in /usr/local/bin
    • rtl_433 -R confirmed that the newly-compiled version updated to include omni as protocol 278
    • rtl_433 -y "19131122313226DEBC8E/19131122313226DEBC8E" did NOT decode the message
    • restarted the new version of rtl_433: it did NOT decode omni broadcasts (but did decode others)
    • Noticed that conf/rtl_433.example.conf DID NOT list omni at all (cmake --build had deleted its entry), so I ran ./maintainer_update.py and it announced that omni was protocol 278.
    • executed cmake --build again; confirmed afterward that omni was protocol 278 in conf/rtl_433.example.conf
    • rtl_433 -R again showed that omni is protocol 278 (after apator 277)
    • rtl_433 -y "19131122313226DEBC8E/19131122313226DEBC8E" DID NOT decode the message (BUT THIS PROBABLY NEEDED '-c' AT THE END OF THE COMMAND; SEE ITEM 4 BELOW)
    • confirmed that the newest compilation had been installed in /usr/local/bin
    • started rtl_433 service, and it DID NOT recognize omni (but did recognize other neighborhood devices)
  3. Reverse positions of apator and omni in include/rtl_433_devices.h,
    making omni be 277

    • edit include/rtl_433_devices.h to make omni DECL next-to-last and apator last
    • edit conf/rtl_433.example.conf to reverse the protocol numbers and the positions of apator and omni: protocol 277 # Omni Multisensor and protocol 278 # Apator Metra E-RM 30
    • rm -rf build
    • cmake -B build
    • cmake --build build --target install
    • confirmed that the edited files stayed with omni as 277
    • confirmed with ./maintainer_update.py that omni is 277, apator is 278
    • confirmed that newest compiled version is in /usr/local/bin
    • confirmed with rtl_433 -R that omni is 277, apator is 278
    • rtl_433 -y "19131122313226DEBC8E/19131122313226DEBC8E" -c DID DECODE the message
    • restart rtl_433
    • version with omni as 277 DOES DECODE omni device broadcasts
  4. Reverse positions back again, to make apator 277 and omni 278:

    • edit include/rtl_433_devices.h to make apator DECL next-to-last and omni last
    • edit conf/rtl_433.example.conf to reverse the protocol numbers and the positions of apator and omni: protocol 277 # Apator Metra E-RM 30 protocol 278 # Omni Multisensor
    • rm -rf build
    • cmake -B build
    • cmake --build build --target install
    • confirmed that the edited files stayed with omni as 278
    • confirmed with ./maintainer_update.py that omni is 278, apator is 277
    • confirmed that newest compiled version is in /usr/local/bin
    • confirmed with rtl_433 -R that apator is 277, omni is 278
    • THIS CHANGED: rtl_433 -y "19131122313226DEBC8E/19131122313226DEBC8E" -c DID DECODE the message
    • restart rtl_433
    • version with omni as 278 DOES NOT DECODE omni device broadcasts

Testing that last version, which does decode '-y' but doesn't decode live broadcasts, I tried analyzing one of the .cu8 files from the tests directory, but it also wasn't decoded:

rtl_433 version 25.02-30-gcd0a522d branch master at 202506061448 inputs file rtl_tcp RTL-SDR
Reading conf from "/usr/local/etc/rtl_433/rtl_433.conf".
MQTT: Publishing MQTT data to localhost port 1883
MQTT: Publishing availability to MQTT topic "rtl_433/pi-1/availability".
MQTT: Publishing device info to MQTT topic "rtl_433/pi-1/devices[/type][/model][/subtype][/channel][/id]".
MQTT: Publishing events info to MQTT topic "rtl_433/pi-1/events".
MQTT: Publishing states info to MQTT topic "rtl_433/pi-1/states".
HTTP server: Starting HTTP server at 0.0.0.0 port 8433
HTTP server: Serving HTTP-API on address 0.0.0.0:8433, serving .
Use "-F log" if you want any messages, warnings, and errors in the console.
Detected OOK package	2025-06-06 14:58:44
Analyzing pulses...
Total count:  336,  width: 211.00 ms		(52751 S)
Pulse width distribution:
 [ 0] count:   16,  width:  616 us [612;628]	( 154 S)
 [ 1] count:  192,  width:  412 us [408;420]	( 103 S)
 [ 2] count:  128,  width:  212 us [208;220]	(  53 S)
Gap width distribution:
 [ 0] count:   16,  width:  584 us [580;592]	( 146 S)
 [ 1] count:  192,  width:  184 us [180;196]	(  46 S)
 [ 2] count:  127,  width:  384 us [380;392]	(  96 S)
Pulse+gap period distribution:
 [ 0] count:   16,  width: 1200 us [1196;1216]	( 300 S)
 [ 1] count:  319,  width:  600 us [592;604]	( 150 S)
Gap+pulse period distribution:
 [ 0] count:  177,  width:  600 us [596;628]	( 150 S)
 [ 1] count:   19,  width: 1124 us [1000;1204]	( 281 S)
 [ 2] count:   72,  width:  400 us [396;404]	( 100 S)
 [ 3] count:   68,  width:  800 us [796;804]	( 200 S)
Timing distribution:
 [ 0] count:   32,  width:  600 us [580;628]	( 150 S)
 [ 1] count:  319,  width:  400 us [380;420]	( 100 S)
 [ 2] count:  320,  width:  196 us [180;220]	(  49 S)
 [ 3] count:    1,  width: 10004 us [10004;10004]	(2501 S)
Level estimates [high, low]:  17530,    866
RSSI: 0.6 dB SNR: 25.5 dB Noise: -25.5 dB
Frequency offsets [F1, F2]:    4280,      0	(+16.3 kHz, +0.0 kHz)
Guessing modulation: Pulse Width Modulation with sync/delimiter
view at https://triq.org/pdv/#AAB00B04040258019000C427148055+AAB05B04010258019000C42714929292A1A19292A1929292A1929292929292929292929292A1A1A1A1A1A192A19292A1A1929292929292A1A19292A1929292A19292A1A19292A192A1A192A192A192A1A1A1A19292A19292A19292A1A18055+AAB00B04030258019000C427148055+AAB05B04010258019000C42714929292A1A19292A1929292A1929292929292929292929292A1A1A1A1A1A192A19292A1A1929292929292A1A19292A1929292A19292A1A19292A192A1A192A192A192A1A1A1A19292A19292A19292A1A18055+AAB00B04030258019000C427148055+AAB05B04010258019000C42714929292A1A19292A1929292A1929292929292929292929292A1A1A1A1A1A192A19292A1A1929292929292A1A19292A1929292A19292A1A19292A192A1A192A192A192A1A1A1A19292A19292A19292A1A18055+AAB00B04030258019000C427148055+AAB05A04010258019000C42714929292A1A19292A1929292A1929292929292929292929292A1A1A1A1A1A192A19292A1A1929292929292A1A19292A1929292A19292A1A19292A192A1A192A192A192A1A1A1A19292A19292A19292A1A355
Attempting demodulation... short_width: 212, long_width: 412, reset_limit: 596, sync_width: 616
Use a flex decoder with -X 'n=name,m=OOK_PWM,s=212,l=412,r=596,g=0,t=0,y=616'


@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 6, 2025

Here are the testing files for one of the samples:

g001_433.92M_250k.cu8.gz
g001_433.92M_250k.ook.gz
g001.json.gz

@zuckschwerdt
Copy link
Collaborator

I can't think of any reason the protocol number might matter. I think the 277/278 is a red herring. Just your PR (at protocol 278) decodes fine:

rtl_433 -Y autolevel -Y magest -M level -M noise -M time:usec -M protocol g001_433.92M_250k.cu8
time      : 2025-06-07 14:26:20.576551             Protocol  : 278
model     : Omni-Multisensor                       Id        : 9
Format    : 1            Indoor Temperature: 25.60 ˚C
Outdoor Temperature: 25.30 ˚C                      Indoor Humidity: 48 %
Light     : 50 %         BarometricPressure: 981.8 hPa
VCC voltage: 4.88 V       Integrity : CRC
Modulation: ASK          Freq      : 433.9 MHz
RSSI      : 0.6 dB       SNR       : 25.5 dB       Noise     : -25.5 dB

and

rtl_433 -M protocol -y '19131122313226DEBC8E/19131122313226DEBC8E'
time      : 2025-06-07 14:29:10                    Protocol  : 278
model     : Omni-Multisensor                       Id        : 9 …

Regarding ./maintainer_update.py: you need to run a cmake build (and install) before running that helper. It will parse information from the rtl_433 binary (help texts for the conf and man).

Maybe just clone https://github.com/hdtodd/rtl_433.git don't change anythin, compile, install and run. It works here.

@hdtodd
Copy link
Contributor Author

hdtodd commented Jun 7, 2025

Thanks for your patience and persistence.

I started with your suggestion and the fresh copy did not decode the omni devices. So I went through my sequence of builds/re-builds again this morning and eventually found the problem.

I had not updated my rtl_433.conf to include apator as 277 and omni as 278. Just that simple. I thought it had to be some dumb error on my part but couldn't find it.

I've just done a git pull merbanan master (no changes) and push to my fork (already up to date).

I believe I've incorporated the latest set of comments into this version ('light_pct', and format). I've installed this version and restarted it as a service for my ISM devices and it seems to be running fine.

Please let me know if there's anything else I need to do.

Again, thanks for your patience and persistence.

David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants