#Data sporadically not sent to influxdb

1 messages · Page 1 of 1 (latest)

hard adder
#

configuration.yaml:


influxdb:
  host: databank.home.local
  port: 8086
  database: iot
mqtt: !include mqtt.yaml
#

mqtt.yaml:

sensor:
  # Living room
  - name: "Newentor Living Room Temperature Sensor"
    unique_id: "newentor_living_room_temperature_sensor"
    state_topic: "rtl_433/14/temperature_F"
    unit_of_measurement: "°C"
    device_class: temperature
    value_template: "{{ ((value | float - 32) * 5 / 9) | round(1) }}"

  - name: "Newentor Living Room Humidity Sensor"
    unique_id: "newentor_living_room_humidity_sensor"
    state_topic: "rtl_433/14/humidity"
    unit_of_measurement: "%"
    device_class: humidity
    value_template: "{{ value | float }}"

  # Window
  - name: "Newentor Window Temperature Sensor"
    unique_id: "newentor_window_temperature_sensor"
    state_topic: "rtl_433/38/temperature_F"
    unit_of_measurement: "°C"
    device_class: temperature
    value_template: "{{ ((value | float - 32) * 5 / 9) | round(1) }}"

  - name: "Newentor Window Humidity Sensor"
    unique_id: "newentor_window_humidity_sensor"
    state_topic: "rtl_433/38/humidity"
    unit_of_measurement: "%"
    device_class: humidity
    value_template: "{{ value | float }}"

  # Outside
  - name: "Newentor Outside Temperature Sensor"
    unique_id: "newentor_outside_temperature_sensor"
    state_topic: "rtl_433/112/temperature_F"
    unit_of_measurement: "°C"
    device_class: temperature
    value_template: "{{ ((value | float - 32) * 5 / 9) | round(1) }}"

  - name: "Newentor Outside Humidity Sensor"
    unique_id: "newentor_outside_humidity_sensor"
    state_topic: "rtl_433/112/humidity"
    unit_of_measurement: "%"
    device_class: humidity
    value_template: "{{ value | float }}"
#

grafana gauge example query (living room humidity sensor)

SELECT last("value") FROM "autogen"."%" WHERE ("entity_id"::tag = 'newentor_living_room_humidity_sensor') AND $timeFilter GROUP BY time($__interval) fill(null)
#

Data sporadically not sent to influxdb

void folio
#

home assistant only writes to databases when the value of the sensor changes

#

no change -> no write

#

regardless of how much the value updates in MQTT

#

also, you don't need the | float on the value | float sensors

#

I'd wager that your rounding is what's causing the problem

#

i.e. remove the rounding

"{{ (value | float - 32) * 5 / 9}}"
hard adder
void folio
#

no it's not, this is baked into HA

hard adder
#

ok so my solution would be purely grafana

void folio
#

HA is designed to minimize the database writes to preserve your memory stick

#

yes, purely grafana will also get the job done

hard adder
#

ok, I've tried this approach once but got stuck since grafana too is extremely complicated for the thing I want to do

#

at least, showing the latest entry of an influx measurement in a gauge is not as trivial as I think it is...

void folio
#

Well, like I said, you can remove the | round(1) and it will naturally cause your sensor to update to your database more

#

because you'll now have more significant figures

hard adder
#

that's not a solution tho. this may apply to temperature, but humidity is only reported as an integer by my sensor, so the same issue will still happen with humidity if it doesn't change within 5 minutes

#

I'm okay with less precision and less data in influx, so understanding that hass doesn't write all values, only changes, is fine. I just have to get grafana to simply display the latest value, somehow

#

but I think I can figure this out, thanks for the information!