NUTControlle with influxDB
-
Hi Patrick,
I have been using the integration of my UPS with MSR (NUTController-22283) for some months now, and it works very well.
I would like to evolve a little bit the usage, and I have, at the moment a difficulty, to take the data to influxDB.
I have also integrated influxDB 1.8 successfully with the MSR, I export the capabilities that I want to use, but the NUT data I have not succeeded, I made several attempts, and I can not send the data, below the configuration that I would like if possible.
x_nut_ups: attributes: input_voltage: include: true type: number output_voltage: include: true type: number battery_charge: include: true type: number
And I don't succeed, consulting influxDB doesn't show the information:
> show measurements name: measurements name ---- battery_power binary_sensor humidity_sensor motion_sensor temperature_sensor x_hubitat_extra_attributes
Could you please give me some guidance on what I am doing wrong?
I also want to comment if it should appear in the Controller Status widget panel when influxDB is activated.
Thanks.
-
There's not enough context in your example for me to definitively help you, but I can see that in all likelihood, your configuration for InfluxDB isn't as described in the documentation and required for InfluxDB to understand your intent.
-
There's not enough context in your example for me to definitively help you, but I can see that in all likelihood, your configuration for InfluxDB isn't as described in the documentation and required for InfluxDB to understand your intent.
Ok, let me put the complete configuration.
plugins: - id: influx implementation: InfluxFeed enabled: true name: InfluxDB Feed 1.8 config: influx_url: http://192.168.50.8:8086 influx_database: Reactor influx_username: influx_password: select_capabilities: power_switch: false dimming: false binary_sensor: true motion_sensor: true leak_detector: false temperature_sensor: true humidity_sensor: true light_sensor: true battery_power: true x_hubitat_extra_attributes: true x_nut_ups: attributes: input_voltage: include: true type: number output_voltage: include: true type: number battery_charge: include: true type: number
As I mentioned before, the MSR is connecting without any errors with influxDB.
root@main:/home/wilson/reactor/config# influx -precision rfc3339 Connected to http://localhost:8086 version 1.8.10 InfluxDB shell version: 1.8.10 > use Reactor Using database Reactor > show measurements name: measurements name ---- battery_power binary_sensor humidity_sensor light_sensor motion_sensor temperature_sensor x_hubitat_extra_attributes x_nut_ups >
> select * from x_nut_ups name: x_nut_ups time battery_charge controller entity input_voltage name output_voltage ---- -------------- ---------- ------ ------------- ---- -------------- 2022-10-13T00:04:17.939Z 100 nut nut>TrippLite 122.3 TrippLite 122.9 2022-10-13T00:04:47.984Z 100 nut nut>TrippLite 122.3 TrippLite 122.9 2022-10-13T00:05:38.176Z 100 nut nut>TrippLite 121.4 TrippLite 122.9 2022-10-13T00:05:38.177Z 100 nut nut>TrippLite 121.4 TrippLite 122.9 2022-10-13T00:06:18.263Z 100 nut nut>TrippLite 122.3 TrippLite 122.9 >
Well, just because I was complaining to the Creator, now it worked without a problem.
Well, sorry, case closed, but I can assure you that I did several tests. Now an important detail, today I updated the drive from version 22152 to 22283, and I think I had not tested yet with this update.
-
There's not enough context in your example for me to definitively help you, but I can see that in all likelihood, your configuration for InfluxDB isn't as described in the documentation and required for InfluxDB to understand your intent.
Sorry, for an additional query, is it possible to stipulate a condition for saving the data to the database, either by time interval or by changing the attribute's content?
And sorry if I did not make clear the suggestion that the Controller Status could not appear as the status of activated influxDB.
Thanks!
-
The InfluxFeed plugin is not a Controller, so it won't appear on the Controller Status widget.
It is possible to modify the value being sent to influxdb by adding an
expr:
key followed by a quoted string containing an expression (shown in the docs). The result of the expression is what will be logged. The current value is available in expression context as thevalue
variable, soexpr: "value * value"
would send the measurement value as the square of the entity attribute value. However, I personally don't recommend using it. Having a long history with data logging and databases, it has become my preference to always put raw data into the database, as you got it from whatever source, and then use database queries to modify the data. influxdb is capable of doing any kind of transformation in the query from the raw data, and can also build a time series using a specified interval, interpolating as needed (you're probably already doing this by using themean()
function in your queries for graphs, which is an influxdb/grafana default). Also, the expression cannot be used to suppress a value (i.e. prevent it from being sent to influxdb).It is not possible to change the InfluxFeed time interval for sending data on the Reactor side, because there isn't one. InfluxFeed sends data whenever the entity is modified. It does not send data at regular timed intervals, and it's not possible to define an interval for sending data. Again, influxdb itself has mechanisms for dealing with this.
Also, I note in your config that you are logging the entire
x_hubitat_extra_attributes
capability. This has the potential to send huge amounts of data, and I recommend you use the extended syntax to only log the specific attributes you want. -
The InfluxFeed plugin is not a Controller, so it won't appear on the Controller Status widget.
It is possible to modify the value being sent to influxdb by adding an
expr:
key followed by a quoted string containing an expression (shown in the docs). The result of the expression is what will be logged. The current value is available in expression context as thevalue
variable, soexpr: "value * value"
would send the measurement value as the square of the entity attribute value. However, I personally don't recommend using it. Having a long history with data logging and databases, it has become my preference to always put raw data into the database, as you got it from whatever source, and then use database queries to modify the data. influxdb is capable of doing any kind of transformation in the query from the raw data, and can also build a time series using a specified interval, interpolating as needed (you're probably already doing this by using themean()
function in your queries for graphs, which is an influxdb/grafana default). Also, the expression cannot be used to suppress a value (i.e. prevent it from being sent to influxdb).It is not possible to change the InfluxFeed time interval for sending data on the Reactor side, because there isn't one. InfluxFeed sends data whenever the entity is modified. It does not send data at regular timed intervals, and it's not possible to define an interval for sending data. Again, influxdb itself has mechanisms for dealing with this.
Also, I note in your config that you are logging the entire
x_hubitat_extra_attributes
capability. This has the potential to send huge amounts of data, and I recommend you use the extended syntax to only log the specific attributes you want.Thanks boss for the master class!! I will change x_hubitat_extra_attributes, you are right, many information I will not use.
Thanks.