Replies: 2 comments
-
Happy to look at implementing a generic "Webhook" sender or similar. For background, MQTT is the defactor standard for message brokerage for Home Automation on this and similar firmwares that run on ESP and similar devices. The messaging protocol is lightweight and well defined. I'm not sure why you require a user to be logged in at all times or are seemingly having problems with Mosquitto - though as mentioned this is really just the accepted standard to allow easy integration etc A few thoughts and inital plans, happy for feedback -
This should allow you to make a basic script in any language you prefer. |
Beta Was this translation helpful? Give feedback.
-
That all sounds great. HTTPS is not essential and I can work with HTTP. Agreed regarding the JSON POST. I'll be able to use that in PHP to send the readings directly to MySQL. As soon as this is implemented I can write something in PHP for testing etc. Cheers, Blinky |
Beta Was this translation helpful? Give feedback.
-
Feature request: Ability to send readings to any HTTP(S) address - very much like the function to send readings to radmon.org.
As stated this would work very much like the function that sends the readings to radmon.org. I would envisage this as being a get or post to HTTP(S), something like the following:
get https://www.yourdomain.com/myespgeiger/postdata.php?function=submit&key=####&id=4e4aee&cpm=##&cpm5=##&cpm15=##&cps=##&usv=##&hvolts=##&rssi=##&uptime=##&freemem=##
The following parameters would be included:
CPM
CPM5
CPM15
CPS
μSv/hr
High Voltage
RSSI
Uptime
Free memory
Maybe total counts too, or any others you feel should be included.
The URL and a pass key, along with a submission interval would be configurable in the 'config' page and would include three form elements:
URL (of the server to submit to.)
Pass key (something like a pin or password that the receiving server can verify against to ensure only this counter can send the data.)
Submission time interval (1-3600 seconds - It would be my server so I'm happy to have a good range of 1 second to 1 hour for submission interval)
Why though, when there is MQTT and the other services? I have been using this technique for years for sending data from other sensors to my home server. They all use the method outlined above and they have all been very rock solid. Whilst I can do this using MQTT, it puts a lot of pieces in a chain. If one piece breaks, the whole thing falls down. The same can be said about this proposed feature, but as there are less parts, it should be easier and faster to get back up and running in the event of a server side issue.
Taking my current situation into account, my goal is to have a nice web page with all the readings on, which I do currently have using MQTT (https://www.schmoozie.co.uk/espgeiger_hw/) but I feel using MQTT for this isn't the best method. It feels cumbersome and somewhat heavier on resources and less reliable than my proposed method (MQTT isn't designed for the way I am using it, in all honesty.) Currently the counter reads then sends to my MQTT server. The MQTT server then broadcasts the message and parameters. I then use JS running via windows powershell to take those readings from MQTT and store them into a MySQL database, where they are then read back for the web page. That is quite a few steps to just get the numbers into MySQL. The JS is doing a lot of parsing and sorting the message and params before it stores them in the MySQL database.
Using this proposed method, the counter would send the readings/parameters directly to a PHP web page that can then do whatever with them. My use case would be to store them directly into MySQL. Much lighter IMHO.
The current method (using MQTT) requires that I use Apache, PHP, MySQL, MQTT, Javascript and windows powershell. Possibly docker or something else, I can't remember what I did exactly to get it up and running.
My proposed method would require that I use Apache, PHP and MySQL. All of which I would be running anyway.
The current method isn't reliable for me in that if the server is restarted, or MQTT is restarted I have to manually restart the Javascript MQTT to MySQL script. I could do better by using something like NodeRed, but again it is another component to learn, integrate and maintain. I'm trying to do less these days, not more! KISS still stands. I also think my proposed method would be very much easier for other users of ESPGeiger to get their readings onto a web page, or similar, or just to store in MySQL, or another database, or whatever. The limitations would be solely with Apache and PHP for what can and can't be done with the data. I feel MQTT imposes limits on doing this kind of thing, as MQTT isn't designed for publishing to web pages, such as I am doing. I would also be able to push the readings/params over to Blynk (legacy) with one line of code per parameter in the PHP code. So effectively with 7-8 lines of extra copy-pasta code I can have the readings/params all pushed over to Blynk so I can view them on my phone, along with all of my other sensors.
This is really something I would like. It would make my setup more reliable, lighter in the programs and services needed and a whole load easier to implement and use. As you (steadramon) know, I have several ESPGeigers almost ready to go into service in the wild. One reason I haven't yet done this is down to getting the data back and displayed each on it's own web page. Just the thought of having to add extra parsing and things to the Javascript MQTT to MySQL is stopping me from doing this. I just don't think I would use MQTT (and the other components) for 5/6 counters as it would be messy, unreliable and just cumbersome. Sending direct to php (or something else) is a breeze.
When I talk about reliability of my setup it is mainly the Javascript MQTT to MySQL script I have issues with. If the server is restarted I have to manually start the Javascript in windows powershell as this requires the server is logged on to. If MQTT (Mosquitto broker) goes down, I have to manually restart the Javascript again. All of this requires that a user is logged into the server at all times. NodeRed might help, but I don't know NodeRed, and as I said, I am trying to do less these days, not more.
I really do think this would help new users of ESPGeiger and those less experienced with setting up web services. The readings could be sent to any web server whether home hosted, or rented online. Any web server should be able to process the readings and sending by a HTTP query string makes this method very universal.
If this was implemented I would be happy to produce some quite basic code (a couple of PHP pages) and a MySQL schema for storing the readings. Besides the MySQL schema there are just two PHP pages (it could also be done on one), one for receiving the query (the readings/params) and one for displaying them. The readings are sent to the first PHP page where they are simply stored in MySQL and the second is to just read them back from MySQL. It's all very very easy. 1000% easier than running through MQTT and parsing the living daylights out of it!
Cheers, Blinky
Beta Was this translation helpful? Give feedback.
All reactions