infrafast / piwebpool

The first full open source Raspberry PI PHP web-based application that automates the control of swimming pool
https://infrafast.github.io/piwebpool/
3 stars 1 forks source link

sensor data acquisition thru API push #25

Open infrafast opened 7 years ago

infrafast commented 7 years ago

currently, the sensors data are acquired thru the getXXX() function from function.php ex. getTemperature() if one want to change the hardware, he needs to rewrite the related code

would be good to imèplement in this function a code that return the value red inside database. The database values would be themselves fed by a call to a URL thru an API. ex: http://action.php?setTemperature=30 hence, this API would made the webapp generci so data acquisition could be done by a third party system (like domoticz) to push the data

the current code from function.php getTemperature() etc... would be moved into the crontab.php file that would regularly read sensors and update the value in database

ps: as crontab is currently called every hour by the "piwebpoolhourly.sh" script, this means we would loose the feature to get real time value by clicking the sensor in "measures" section of the GUI. So probably, it should be put in a different schedule script or a line added in crontab calling the acquisition code every 5 minutes.

infrafast commented 7 years ago

to be noticed: the table measures already exist, it can be the one collecting all the timestamped-data