Apollon77 / ioBroker.nut

NUT (network UPS Tools) Adapter for ioBroker
MIT License
9 stars 5 forks source link

Some datapoints are string, but number would be better #123

Open neunteufels opened 2 years ago

neunteufels commented 2 years ago

Datapoints, e.g. battery.voltage, input.voltage,... , are type string, but number would make more sense (IMHO).

Writing datapoints of type string to InfluxDB works, but makes live just complicated.

BR Stefan

Apollon77 commented 2 years ago

The problem is that there is no real list of values (yes some are "common" but in fact all depend on the used driver).

So the adapter should just guess ... and guessing means ... meehhhh

Need to think about that

neunteufels commented 2 years ago

Did have time to think about it already?

BR

Apollon77 commented 2 years ago

Not really. YOu are free to use aliases or own Javascript states to convert the values as needed in the meantime

PeterVoronov commented 2 years ago

Not really. YOu are free to use aliases or own Javascript states to convert the values as needed in the meantime

If I prepare the appropriate PR - will you look for approve?

Apollon77 commented 2 years ago

Sure. I could think of two options: A: I would think that a setting like "try to detect numbers and automatically convert" or such would help, but then also needs to remember which fields were then created as numbers for future processing - especially if a field that contains a number is now an empty string or a real string ... B: simply detect numbers and create additional objects with "name_number" as name or such and write the value as number in there IF parsable ... with this the adapter just needs to remember which "_number" objects where already created

I personally would go with option B because "Not breaking" ... Maybe add an option if such number parsing should be done (but can also be omitted) ...

What do you think? Which ideas you had to do it backward compatible and handle type-issues (honestly I do not trust that all nut "plugins" are developed constistent on the value types?

neunteufels commented 2 years ago

At the moment I don't know how I could help here. If I can somehow, please let me know.