merbanan / rtl_433

Program to decode radio transmissions from devices on the ISM bands (and other frequencies)
GNU General Public License v2.0
6.11k stars 1.32k forks source link

Restructure args to be able to specify multiple things for each hop frequency #1838

Open loopy321 opened 3 years ago

loopy321 commented 3 years ago

Feature request of an index to control whether a hop occurs after a successful event or should wait time.
i.e. rtl_433 -f 433M -f 912M -H 15 -E wait -E hop ( where "wait" stays on the 433M freq for the full -H 15 regardless of events).

I have a situation where the 433M freq has numerous signals I want to read for the -H interval, but the 912M has only one - so one and done.

Great work here!! Thanks!

zuckschwerdt commented 3 years ago

Thanks for the idea and the fitting example. It will take some time to implement cleanly, but generalizing the hoping to more parameters that can change with it seems worth it.

loopy321 commented 3 years ago

Thanks for the comment. Thinking more about it and looking at the code, it might be more intuitive and easier to add a parameter that matches a successful event to trigger hops. i.e. matching a decoded protocol 149: rtl_433 -f 433M -f 912M -H 15 -E hop:149

Then can code an additional if statement in the following to check if it is a match (my pseudocode... :) : if (d_event_something != hop_param) { cfg->hop_now = 0; } ... else { cfg->hop_now = 1; }

loopy321 commented 3 years ago

Here is my cheesy hack to get it working for my purposes - I just created a new -E option of hop2 which checks which frequency index is on and hops on success only for the second frequency.

https://github.com/bobhavlin/rtl_433/commit/390b5c18d213c93c8dd9def406a0760e35d62ce3

Please let me know if you have any suggestions or comments. Thanks!

zuckschwerdt commented 2 years ago

We could add -E to the list of things that index with current freq. A more general idea would be to put all hop related args into a struct and switch all of those. We need an command arg structure more suited to that though. Something like "every -f starts a new set of args", e.g. rtl_433 -f 433M -s 250k -Y classic -H 15 -f 912M -s 1024k -Y minmax -E hop but randomly mixing -f -s -H will give strange results, mostly incompatible with what we provide now :/

Ian-Zz commented 2 years ago

I think I would love this feature. I would like to give Bob's cheesy hack a try but I am running Home Assistant OS on a Pi4 and using this HA addon pbkhrv/rtl_433-hass-addons. My problem not exactly sure how I would go about changing/adding/editing to Bob's rtl_433.c file locally on my machine. And after that if that new parameter would even be available to use in the rtl_433 HA add on after that. Gonna pose this question over there too.

Btw... GREAT software this is. I LOVE IT!!!

zuckschwerdt commented 2 years ago

I think I'll look at adding this all-options-per-hop idea in the weeks to come. But like noted it will break the way the arguments work right now, so likely this will sit in a branch for a while.

Ian-Zz commented 2 years ago

fyi... Having trouble with the home assistant add-on aspect of Bob's hop2 repo (https://github.com/bobhavlin/rtl_433) but as a stand alone install on a separate Pi3 his code does just what I needed. My meter readings have not skipped an hour yet.

zuckschwerdt commented 2 years ago

The hop2 idea looks good enough until we can get proper support in rtl_433.