I’m using the influxDB Sensor component to pull data from my InfluxDB to show in my dashboard (data that comes from other sources and goes directly to influxDB, not through HA), but I am having two problems.
The first is that the data points don’t seem to be caught as numbers by HA if no unit_of_measurement is given, they are displayed as strings instead. Two of my indicators don’t have units and I’ve had to give them bogus units to get the graphs to show up.
The second problem is that I cannot increase the rate at which HA gets the data from the database, it is stuck at 60 seconds intervals, despite my scan_interval set to 10.
Any suggestions on how to fix this?
sensor
- platform: influxdb
host: 127.0.0.1
scan_interval: 10
username: hass
password: ********
queries:
- name: bed current heartrate
unit_of_measurement: bpm
where: '"location" = ''bed'''
measurement: '"heartrate"'
database: homeassistant
field: '"value"'
group_function: last
- name: bed current signal
unit_of_measurement: SS # bogus unit
where: '"location" = ''bed'''
measurement: '"signalstrength"'
database: homeassistant
field: '"signal"'
group_function: last
- name: bed current status
unit_of_measurement: ternary # bogus unit
where: '"location" = ''bed'''
measurement: '"status"'
database: homeassistant
field: '"value"'
group_function: last
- platform: template
sensors:
bed_status:
friendly_name: 'Bed Status'
value_template: '{% if is_state("sensor.bed_current_status", "1") %}Occupied{% elif is_state("sensor.bed_current_status", "2") %}Moving{% else %}Empty{% endif %}'
icon_template: '{% if is_state("sensor.bed_current_status", "1") %}mdi:sleep{% elif is_state("sensor.bed_current_status", "2") %}mdi:sleep-off{% else %}mdi:hotel{% endif %}'
Incidentally, I did figure out how to use a template sensor to get the ternary status measurement (0, 1, 2 representing Empty, Occupied and Moving respectively), into a separate sensor that displays the appropriate text and changes its icon based on the status. See the last few lines of my yaml above.