Renaming an input & preserving stored graphs

Quite a while back I renamed an input & noticed any related graphs no longer worked. I can’t recall the exact details now, but I haven’t renamed anything since. I would like to rename an input to better reflect its connected circuits. Maybe this is no longer an issue but I don’t want to risk finding out the hard way. Any hints for how to go about this please @Overeasy?

The names associated with inputs are simply pseudonyms for the input number. The name is resolved at the time the query (graph) is run. If the name is currently assigned to an input, the current and historic values for that input will be used. If the name name is currently that of an output, the script for that output will be used, and the same logic applies for any inputs referenced in that script.

It’s a very simple system. The datalogs have no names associated with the data, only the input numbers 0-15.

To produce graphs (or queries) that can withstand renaming inputs, you can define and use outputs that simply reference the current names of the inputs, and change them at the same time you change the input names.

The IoTaWatt V5 isn’t a general purpose computer. Adding names to the data in the datalog would stretch the capabilities and would be limited in capacity at best. For a more robust reporting capability, consider influxDB.

Thanks @overeasy but I’ve missed your point. For example I have a graph+ graph named water_today I can see from the file manager is defined in graphs/1grucmxj.txt.

{"name":"water_today","period":"today","group":"auto","unit":"Wh","endDate":"2020-07-17T06:56:25.000Z","beginDate":"2020-07-16T14:00:00.000Z","feedlist":[{"name":"hot_water","unit":"Wh","color":"#ff0000","fill":false,"stack":false,"scale":1,"accrue":true,"dp":"0","plottype":"Line","dataindex":1,"yaxis":1},{"name":"hot_water","unit":"Watts","color":"#0000ff","fill":true,"stack":false,"scale":1,"accrue":false,"dp":"0","plottype":"Bar","dataindex":2,"yaxis":2}],"yaxes":[{"unit":"Watts","min":"0","max":"1400"},{"unit":"Wh","min":"0","max":""}]}

In this example it references an input (at “feedlist”) of “hot_water” (W & Wh). If I rename this input via Setup>Inputs to say “hot_water2” I think from memory the graph will no longer work. Is it sufficient for me to just go through relevant graph .txt files and update any references from the old input (or output) name to the new name?

That should work, but there is another way.

When you run that graph, it will fail with a message to the effect of invalid name hot_water. If you add an output called hot_water and set it to the input hot_water2, the graph will now work with that redirection. You can then simply leave the output in place, or change the graph(s) to use the new name.

1 Like

that’s clever! thanks a lot