-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[influxdb] Feature request: option to replace _ with . in item names for influxdb #4830
Comments
Hello @ssvenn, I like the goal you are chasing and the ability to select |
Related to the idea described here I want to discuss another approach, which could be implemented instead or additionally. It was first mentioned at: https://community.openhab.org/t/influxdb-grafana-persistence-and-graphing/13761/155?u=thomdietrich As can be seen here http://docs.grafana.org/datasources/influxdb/#alias-patterns Grafana allows other placeholders to be used in the alias field which are stored in your influxdb, e.g. Currently there is no additional data stored but the influxdb persistence service might be easily able to do so. I want to suggest, to store the item label inside a tag, for example @theoweiss what do you think`? |
I don't know know if there is a way to get the item label from an item or using an item object. An item object has no getLabel or something like that: As you can see the store method has a second parameter named alias, may this can be used. It seems the alias can be set in the persistence configuration. I've no clue how this could be done. Furthermore unfortunately I have to admit that I've really no time in the next two or three weeks to get into these things. Your welcome to ping me again after the b5 release :-(. |
I do neither, maybe @kaikreuzer can help out here. (short: is it possible to pass the item label along to a persistence service?) |
Correct, the alias is the "persistence service specific label". It is provided as shown in the "Items" section at https://github.com/openhab/openhab/wiki/Persistence#configuration, e.g.
|
Thanks Kai. For this idea to work we would need the item label. Defining yet another string is what can already be done inside Grafana. We are looking to use the item label instead of the item identifier as the visual representation in Grafana. Hence I would be interested in a hint in regards to:
|
Well, what shall I say: In ESH, the Item has a |
Fair point indeed. @theoweiss I got your time concerns above. Are you planing to transition this service any time soon? Would you prefer for somebody else to take up this task? Community user opus seemed interested to get involved... Can you estimate the difficulty? |
I was hoping to keep the change request as simple as possible with just an extra option in the .cfg file for the influxdb persistence service, pushing OH labels to influxdb would maybe cause some new challenges if the label is using variables that causes the label text to change with every update. I'm an influxdb newbie so I'm not sure if it would track the label history or if it's just stored once for a series. Dynamic labels could maybe be used for graph annotations though? That would be another interesting use case, having the text of string items that track various states overlaid on a numerical graph! Anyway, my current influxdb persist rule is simply this:
and I would love to keep it that way, to have everything configured with as little effort as possible, hopefully that is a noble "user friendliness" goal and not just me being lazy :) |
Not yet.
Nope.
That would be great. I've never meant to be the owner of this piece of code, it's open source and owned by the community. I've just felt responsible to keep it running. Stand in and make PR's like others have done it in the past (e.g. @sumnerboy12 )! But since you have asked me it would be good if you ping me as soon as someone is working on it. |
Fairly similar as for openHAB1. There is no tutorial/docs on this yet, but a first PR with such an persistence service: eclipse-archived/smarthome#2081 I don't know anything about influxdb+grafana, so I am not sure about the licenses of dependencies and the from what you say the contribution record sounds a bit fuzzy - so it might not be easy to get it to the ESH project itself, the openHAB2-addons repo might be the easier destination. I just want to mention this before anybody takes this step. Thinking about what you want to achieve, I came across another thought: Your persistence service could depend on ItemUIRegistry, which offers a method |
So, 2,5 years later :-) After using influxdb for a while I wanted to make the next step and combine many items in one measurement. This will make many things easier. So I added to the influxdb binding that when you specify an "alias" in the persistence file like @kaikreuzer said, a tag is added to the point whith the real name of the item as tag value. With this you can give many items the same alias, resulting their data to be written in the same measurement, but grouped by tag to different series. Works great in my setup for more than a month :-) Reading this topic I also implemented the underscore replacement, as this is a nice feature. The question is, should I do a PR with these changes? As I have understand correctly, there were plans to build a completely new binding for influxdb? Is openhab1-addons still the right place for this binding? Thanks |
You could, but it'd probably be better to wait for persistence to be moved to the new OH3ish platform. |
https://community.openhab.org/t/influxdb-grafana-persistence-and-graphing/13761 is a great tutorial and I think influxdb+grafana is going to become popular with users, but unfortunately the Item name restriction of Openhab (letters,numbers and underscore only) clashes with the preferred . field separator in Grafana.
If the influxdb persistence plugin for OH could translate _ as . when pushing data it would enable you to use the alias functions in Grafana so that you could have nice, short descriptions in the legend instead of the full item name for everything.
There was a feature request for this in the Grafana project last year but it got closed as wontfix: grafana/grafana#1616
It might be easier to work around the issue in the OH binding instead with a configurable option.
I've tried modifying the sine.py sine wave test script from the tutorial to send "test.sine.wave" as the item name and that allows you to display "test" "sine" or "wave" in the legend with $0, $1 and $2 in the alias field.
http://i.imgur.com/KpgEzrV.png is an example of how the legends look now with autocreated item names from OH2. With aliasing you could build graphs with more readable legends by using the $0-9 field alias. It might also make it possible to build templates for openhab and make it much easier to group several items into the same graph with long descriptive names.
The text was updated successfully, but these errors were encountered: