Switch state on influxdb

Hi all,
I searched a solution about my problem but I can’t find anything useful so I have to create a new post :\

Introduction:
I switched from Docker HA to Hass.IO few days ago.
My ex HA installation was composed by:

  • HA 0.97
  • InfluxDb
  • Grafana

I installed all stuff in a new ssd so it is a clean install. After installing HassIO (on Xubuntu 19.04) I installed the influxdb addon and restored my old database (previously backupped) following this guide.
After backup was restored I restored my grafana dashboard too without any problems: everything is up and working

Problem:
With previous installation I could create single chart containing 2 informations:

  • Room temperature
  • Switch status

In this way I could see room temperature variations when the AC was on or off (see attached picture) but now seems that AC status is gone.
As you can see in the picture the AC switch state was present before saturday and then disappeared.
All other charts (cpu temp, humidity sensors, system memory ecc ecc) works flawlessy except the switch status.
I tried with different queries and aggregations but no luck.
I can’t understand if problem is given by influxdb or by hassIO not sending influx switch statuses.

My current InfluxDB configuration in configuration.yaml is the standard one:

influxdb:
  host: a0d7b954-influxdb
  port: 8086
  database: home_assistant
  username: !secret influxdb_user
  password: !secret influxdb_password
  max_retries: 3
  default_measurement: state

Any suggestions? Am I missing something?

Thanks in advance!

EDIT: I just tried to exec some queries on influx selecting state of other switches than the one connected to the ac (lights and plugs) with same result: I can see values until 08/31 (the day I installed HassIO restoring backup of previous influx installation), after that moment no more switch values on influx.

Nevermind I found the solution. I write it here just in case someone can find it useful.
In previous installation I had no “default_measurement” that’s why I had correct switch state in database. Removing that line from config restored everything :sweat_smile:

Is that within config.yaml? Or it that in influx config? thanks in advance.

It is in config.yaml :slightly_smiling_face:

Just checked my config, and I did have “default_measurement” in it, but I cannot view results for any digital values, only analogue values are being returned successfully from a query.

influxdb:
  host: 192.168.0.3
  port: 8086
  database: home_assistant
  username: !secret influxdb_user
  password: !secret influxdb_password
  ssl: true
  verify_ssl: true
  max_retries: 3
  default_measurement: state


 
  include:
    entities:
       - sensor.person_in_driveway
       - sensor.vehicle_in_driveway

Try this query in InfluxDB explorer

SELECT mean("value") AS "mean_value" FROM "home_assistant"."autogen"."sensor.person_in_driveway" WHERE time > :dashboardTime: GROUP BY time(:interval:) FILL(null)

I just tried with switch.light_01 as entity and it works but I don’t have default_measurement. This config option tells influx where to store values if there is no measurement for that value. Try to remove it, put some data and then plot

No luck, I get “your query is syntactically correct but returned no results”.

Have you removed the default_measurement line from config and put some data on that sensor after removing the line?

Yes, it has been commented out of the config for a few days now. The state of the sensor has been changing, as I email camera pictures to myself when a person is detected on the drive.