ChrisRomp / addon-ecowitt-proxy

An HTTP receiver for Ecowitt data for sending to the Home Assistant integration.
Apache License 2.0
14 stars 2 forks source link

Feature enhancement: auto remove /api/webhook/ or api/webhook/ from id field #22

Closed tcrgit closed 1 month ago

tcrgit commented 8 months ago

I would suggest having string function remove part or all of the /api/webhook/[idstring] for the id field of the configuration.

The reason is that a user will often be cutting and pasting this string in from either the Ecowitt Integration add entry area, or from the Ecowitt app [in which case the first forward slash is probably not there]. In either case it is easy to select it all and not just the 32char string.

I made the latter mistake myself, and it gave me a few minutes of puzzlement until I figured out what I had done wrong.

Thanks for making this proxy. It's great for those of us with remote Ecowitt stations. Perhaps @pvizeli might assimilate it into the Ecowitt integration itself?

ChrisRomp commented 8 months ago

I like it. I can probably just take any string after any / char that might be present in the string.

tcrgit commented 8 months ago

you want what is left after the last / in the string... to remove anything up to and before the last /

in bash I'd use basename, but probably a regex or a python string function here...

MikeGuest commented 2 months ago

Can I just please add my thanks to both chrisromp and tcrgit for this additional on and this thread.

I was struggling for ages with the add-on only to realise after reading this thread that only the ID was required and not the /api/...

Thanks all

rberger commented 1 month ago

Woah, I just had the same problem as @MikeGuest. Spent a day trying to figure out why its not working.

I was about to file a bug, and I luckily read this thread, and @MikeGuest 's comment and it made me realize my mistake.

When you get a chance, it would probably be helpful to others to make this clearer with a warning in the documentation.

And another nice to have would be a config option (or any mechansim) to enable debug logging.

Thanks for the nice piece of software that makes it possible to use Ecowitt with Home assistant without breaking security!

ChrisRomp commented 1 month ago

This doesn't auto-remove it from the input values since I can't change those values and re-save them. I could either ignore it or put in additional messaging and validation. I'll try the validation approach, but if folks are still having frequent trouble with it, I'll just do some parsing on the string to pull the value.