I’ve set up MQTT and InfluxDB and I’ve a ESP8266 that is sending temperature values. But for some reason the data do not show up in InfluxDB. Can someone guide me with the configuration and automation to get the sensor values into InfluxDB? I’ve set up MQTT so the ESP8266 commands are received (checked by MQTT Explorer) and I’ve set up InfluxDB with a database and user.
I am thinking the data has to be imported an an entity into HA so that influx can find it when it pulls over the HA data.
Is this data available as entities?
Hi Sir!
I have tried different automations that also shows up as entities. But is there any specific approach for the automation to get it into influx?
This is my configuration
influxdb:
host: 192.168.1.3
port: 8086
database: Home_Assistant_WaterIrrigation
username: Home_Assistant_InfluxDB
password: InfluxDB_PWD
max_retries: 3
default_measurement: state
include:
entities:
- sensor.Soil_Moisture2
mqtt:
broker: "192.168.1.3"
port: "1883"
username: "UserMQTT"
password: "Test123"
sensor:
- platform: mqtt
name: "Soil Mositure2"
state_topic: "home/waterpump/log"
unit_of_measurement: "%"
Is something missing?
Hello,
not an expert but you are missing something:
Api version: 1 or 2
Bucket: which influx db bucket to log data in.
There is no need to automation, you have an integration and then you setup the connection and the sensor/domain etc you want to save into db.
There are some point to care about based on which type of HA installation that might slightly change the setup.
If you run everything in docker make sure the docker are in the same network.
Consider to use split configuration https://www.home-assistant.io/docs/configuration/splitting_configuration/, this ensure you are not messing up too much your configuration file but only one feature.
Here an example of configuration.
influxdb:
### Connection Setting ###
api_version: 2
ssl: false
host: influxdb
port: 8086
bucket: your bucket_name
### measurements setup ###
tags:
source: ha
tags_attributes:
- friendly_name
default_measurement: what_you_want_log
exclude: #list here what you want to ignore
entities:
- zone.home
domains:
- persistent_notification
- person
include: # list here what you want to log into db
domains:
- sensor
- binary_sensor
- sun
entities:
- weather.home
Hope it helps!
Thanks! I’ve dug some more into it and now I’m able to see the transmitted data in influx. I created a new database (using API v1, so I guess there is no explicit need for bucket) with the default db name (not sure if that is a prerequisite). Then I noted that nowadays the broker, port, username and password should not be included in the mqtt part of the config.
However, now it looks like the value is only updated in influx after each restart and not every time it is sent, i.e. every 2 second at the moment.