cyberjunky / RTL-SDR-P2000Receiver-HA

Receive P2000 messages using RTL-SDR stick and post them to Home Assistant
MIT License
23 stars 11 forks source link

Messages with multiple capcodes are full ignored if 1 of the capcodes is ignored #17

Closed Dinges28 closed 2 years ago

Dinges28 commented 3 years ago

If a message is send to multiple capcodes, and 1 of them is ignored, the others are also ignored. The group codes that are ignores are messing up the region addressing.

Example:

RAW: FLEX|2021-08-17 17:58:16|1600/2/K/A|14.082|002029568 000120999 000120116|ALN|A1 13116 A10 Re - Kp Watergraafsmeer Amsterdam 78148

LOG: Message 'A1 13116 A10 Re - Kp Watergraafsmeer Amsterdam 78148' to '002029568' ignored (capcode in ignore_capcodes)

Ignore_capcode.txt:

002029568,Brandweer Landelijk Groepscode Group-1
002029569,Brandweer Landelijk Groepscode Group-2
Dinges28 commented 3 years ago

The issue is still open… so work in progress 😉

From: casvandeleemkolk @.> Reply to: cyberjunky/RTL-SDR-P2000Receiver-HA @.> Date: Thursday, 9 September 2021 at 08:36 To: cyberjunky/RTL-SDR-P2000Receiver-HA @.> Cc: Dinges28 @.>, Author @.***> Subject: Re: [cyberjunky/RTL-SDR-P2000Receiver-HA] Messages with multiple capcodes are full ignored if 1 of the capcodes is ignored (#17)

is there away to fix this problem? because usually a message is send to multiple capcodes. Program works fines is a message is send to 1 capcode

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/cyberjunky/RTL-SDR-P2000Receiver-HA/issues/17#issuecomment-915804655, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJRCYBAEBMMTRUAD3W2DZ6TUBBISFANCNFSM5CKMHHCQ.

cyberjunky commented 3 years ago

@Dinges28 can you try to replace this:

                                if (
                                    capcode in self.ignorecapcodes
                                    and self.ignorecapcodes
                                ):
                                    if self.debug:
                                        print(
                                            f"Message '{message}' to '{capcode}' ignored (capcode in ignore_capcodes)"
                                        )
                                    ignore = True
                                    break

with this:

                                if (
                                    capcode in self.ignorecapcodes
                                    and self.ignorecapcodes and (len(capcode) == 1)
                                ):
                                    if self.debug:
                                        print(
                                            f"Message '{message}' to '{capcode}' ignored (capcode in ignore_capcodes)"
                                        )
                                    ignore = True
                                    break
cyberjunky commented 3 years ago

No wait, that's not correct... need I think this:

   and self.ignorecapcodes and (len(capcodes.split(" ")) == 1)
casvandeleemkolk commented 3 years ago

i'm going to try this asap, keep u posted

Dinges28 commented 3 years ago

Implemented, first tests look promising!

Dinges28 commented 3 years ago

It works... BUT.. The region is still distilled from the ignored capcode. Result, still not an accurate region used in the post. It keeps coming with 'landelijk' as soon as one of the groupcodes is present in the capcodes

Dinges28 commented 3 years ago

@cyberjunky Can we also do this kind of filtering for the retreive of the region?

Dinges28 commented 3 years ago

@cyberjunky Did you had any time to check above issue?

It works... BUT.. The region is still distilled from the ignored capcode. Result, still not an accurate region used in the post. It keeps coming with 'landelijk' as soon as one of the groupcodes is present in the capcodes

Dinges28 commented 2 years ago

Created a pull request to fix the ignored capcodes