First of all i am using the Grafana Version 11.3.0 and i installed it on my Raspberry Pi in Docker as a container.
So i have extern variables which i send via MQTT and Node-Red to InfluxDB2 and displaying the values of the varibles in Grafana to have a nice overview.
Now i got the idea to change the values in Grafana individually so they override and the new values i typed in are being saved in InfluxDB2. If that is done i want to send the values back via Node Red again.
My question ist: Is that possible somehow? Im very new in Grafana and tried it even with “field overrides” but even that wont be the best solution.
How would you guys solve my problem the best so i can show it to a customer for example?
Im trying to achieve a manual change of a value of a field in Grafana and this new value should be saved in my database.
Im working a lot with ChatGPT so i know where to write down my API so that Node-Red for example can access the Editor.
I tried to achieve it with an extern Webapplication, a Textbox variable in Grafana, even with a cURL Request in SSH, but nothing will work and i am pretty clueless.
I only followed the instructions from ChatGPT because i am not educated in Flux-Request an co. but even when i pasted the results from the SSH even the AI couldnt help so maybe you guys can give me a hint or something what i am doing wrong.
Would be so nice so finally solve my problem. Im looking forward for your help, thank you very much!
Welcome @janduehrig to the Grafana Community Forum.
So just to be clear, you created some text items which represent fields (let’s call them Temperature, Pressure and Humidity) in some program, and then MQTT grabs these via Node-RED and populates them into InfluxDB2, correct? And next, these fields are displaying in Grafana as template variables that you can select as you wish?
Im trying to achieve a manual change of a value of a field in Grafana and this new value should be saved in my database.
In the above, you are stating that you want to change or add a field (e.g. change Pressure to Inlet_Pressure or add a new field called Altitude) and these new fields should 1) be written to the InfluxDB database and 2) should appear in Grafana as another available field?
So to get more into the matter, i have a PLC where i have different variables with their values listed in “Siemens Totally Integrated Automation (TIA)” (for ex.theyre called INT_VAR, FLOAT_VAR, TEST_VAR…) Just some variables with values.
With this PLC i am connected with a INSYS ECR-EW300 device which grabs the data via. S7 Protocol and is sending them via. MQTT to Node-Red. Node-Red puts them into the right payload (json) and sends them to InfluxDB2, that is correct yes!
And these fields are displayed in Grafana and i can see them there, the variable Name from TIA and the value from TIA. This is working super well, also correct!
Now let´s say i take the field “TEST_VAR” which is an integer with value 25 right now. I want to change the 25 to lets say 42 and i want the 42 to be the new value of TEST_VAR. It should be written in the Influx Database so i have the option to send it back to my PLC with Node-Red.
My goal is to change the value of any field (INT_VAR, FLOAT_VAR, etc.) and it should be written in TIA in the PLC.
Thanks for your fast response. If you need more information from me just let me know!
Do you want to use Grafana as the interface to do the above? If yes, the only way I know that Grafana can do something like that is using a plugin like this (maybe @mikhailvolkov can confirm and/or explain further)
Another possibility that comes to mind is to set up Node-RED Dashboard and simply change the TEST_VAR value there. InfluxDB would be written with this new value and it would appear in Grafana accordingly.
Thank you for your help so far! Great information.
I will try it with the plugin you send me and after that i am coming back to you if its the solution i searched.
So i downloaded the plugin “Business Input” and created a dashboard and a panel with i where i selected it as a data source.
From there i added a Field “INT_VAR” so the same name as my variable and a value to it “25”.
After that i was pretty clueless what to do so asked AI.
ChatGPT told me multiple times that there should be a “Value Type” or “Format as” or “Input Type” category in my Options tab on the right.
In that category i should be able to set my Input type to “Numeric” because i want to save the value/number.
Also it mentions an “Enable Submit Button” where a Button appears with which i can save the value on click. I could also set an Node-RED API URL to send the value.
The problem is i didnt find one of these listed options at all. Could it be that the name of the option i search and what the AI means is different? Or do I have to install an extra plugin or attachment for this step?
After creating this i made a new panel and selected “Business Forms” as the visualization.
I worked a little bit with AI and watched a helpful Video of Daria Volkova explaining it so i got to the following settings in my Update Request. In the Header Parameters i put my InfluxDB bucket API:
Also i made a Flux Query for my InfluxDB that the new value would be set in InfluxDB too. After a few errors that i managed to get rid of i can press the “Change” Button after entering a value in Variable Textbox but still the value wont change.
Once again im out of options and I have to ask for your help please!
Would it also be helpful if some Champion or expert can do it on my pc via AnyDesk if thats possible?
Because this project will be a part of my Bachelor Thesis and its important for me to make progress.
Just let me know and i try my best to give you the needed information.
I fixed the error message already, it was an error in the Flux Query.
Now i got a little bit of progress but the final configuration is missing for me.
My Panel right now is looking like this:
Because i had an error with sending the request, I opened F12 in the Browser and hit the “Change” Button. In the “Network” Tab i saw the Error Code “400 Bad Request” and a content length of 2. So the Payload in my request is until now always “{}”, an empty value which cannot be processed by Node-Red.
Thats why i tried to do a Node-Red Flow which should get the message first and changes it after it sends it out. It looks like this:
But it was still the same. To test if the root of the error comes from grafana or from node-red i made a cURL Request in my console which is the following:
curl -X POST http://192.168.15.203:1880/grafana/write -H “Content-Type: application/json” -d ‘{“TEST_VAR_Input”: 55}’
After pasting this request in my console the value of TEST_VAR was instantly changed to 55!
So i knew the error is somewhere from Grafana, it has to be the Custom Code request on the right side or something else.
If i manage to find the solution i can continue easily but right now my POST request on the Grafana Panel is not working as is should, but curl is working.
Do you have any idea what else i can try?
You are trying to put payload in the Custom Code section. Custom code can be used to process response after request was sent etc., so this is not correct place.
You should prepare payload you need in the Update Request Payload section: