cyberman54 / ESP32-Paxcounter

Wifi & BLE driven passenger flow metering with cheap ESP32 boards
https://cyberman54.github.io/ESP32-Paxcounter/
Other
1.69k stars 397 forks source link

Generic Temperature and Humidty PayloadConvert functions #917

Closed t-huyeng closed 1 year ago

t-huyeng commented 1 year ago

I was looking for an easy way to send temperature and humidity data. Since I did not find the right PayloadConvert for this, I just added one.

This function can be used for any user specific sensor which measures temperature and humidity.

@cyberman54 what are your thoughts on such generic function?

FYI: I currently tested only the packed format function.

t-huyeng commented 1 year ago

Since all checks (github action) are starting for this pull-request I think we could also change the workflow again that only a few boards get tested during a pull request.

What about:

Or any other boards?

cyberman54 commented 1 year ago

Yes, we can merge this, no problem. But wouldn't it be kind of dead code without a sensor usecase & hal file?

t-huyeng commented 1 year ago

Yes that is probably true. I could add the function as a comment in the sensor.cpp. This still means that the code is not really used.

I used it for my gy21 see this.

Maybe an example for a custom sensor would also be at least a start (in the readme or in an extra example folder ).

cyberman54 commented 1 year ago

Let's complete this as an example for integration of a custom sensor, good idea!

Originally paxcounter had one use: count pax. But there were many users who added functions. Now the code is kind of multi use case. Not good since it growed step by step and, thus, is not a platform approach. But seems to work as is for many users and their use cases. That's why i think the sensor example makes sense.

t-huyeng commented 1 year ago

I see what you mean and I think you are right. For me it would also be okay if we do not merge this (this is why a made this a draft as well). I will try to work on an example in the next days and maybe we can just leave this in my fork and add it to the readme here or something like that.

I am actually using this project as a "template" since I feel there is no better project with so many configuration out there.

t-huyeng commented 1 year ago

I added and update most of this code to the docs. See: https://t-huyeng.github.io/ESP32-Paxcounter/configuration/custom-sensors/ or: https://github.com/t-huyeng/ESP32-Paxcounter/blob/mkdocs/docs/configuration/custom-sensors.md

So I would suggest to close this PR and keep the code in the docs.

cyberman54 commented 1 year ago

ok & thx!