Hello everyone,
I’m trying to push data from my Xiaomi temperature and humidity sensors 3 (connected via the Xiaomi Home custom integration) to InfluxDB 2.x, but I’m encountering a persistent issue where the specific sensor’s data doesn’t appear in InfluxDB, even though the sensor itself works fine in Home Assistant.
I’ve gone through extensive troubleshooting, and I’m hoping someone here might have encountered a similar very specific issue or can offer a fresh perspective.
My Setup:
Home Assistant Installation: (Home Assistant Container/Core in Docker,)
InfluxDB Version: 2.7.12
InfluxDB Installation: (standalone Docker container)
Xiaomi Sensors Integration: Xiaomi Home
Problem Description:
My goal is to store the temperature and humidity data from my Xiaomi sensors 3 (e.g., sensor.miaomiaoc_cn_blt_3_1jcikjrb4k400_t9_temperature_p_3_1001) into InfluxDB for long-term storage and visualization.
The core issue is:
Despite the sensor working perfectly fine in Home Assistant (its state is numeric and updates frequently in Developer Tools → States), its entity_id does not appear in the entity_id tag list within the state measurement in InfluxDB’s Data Explorer. This means the data is simply not being pushed from Home Assistant to InfluxDB for this specific sensor.
Troubleshooting Steps Taken So Far:
I’ve systematically addressed various potential issues:
InfluxDB Connection Issues (All Resolved):
Initial errors (Errno -3, Errno -2 Name does not resolve): Solved by ensuring host: 127.0.0.1 in configuration.yaml and confirming InfluxDB service was running.
Authentication errors (401 Unauthorized): Solved by logging into InfluxDB Web UI, verifying/creating an API Token with explicit read/write permissions for the target bucket, and ensuring the organization and bucket names in Home Assistant’s configuration.yaml matched exactly (case-sensitive).
SSL errors (ssl.SSLError: record layer failure): Solved by confirming InfluxDB was only running on HTTP (not HTTPS) and explicitly setting ssl: false in Home Assistant’s influxdb configuration.
Result: Home Assistant’s InfluxDB integration now starts up without any errors in the logs, and the state measurement (for some entities) is appearing in InfluxDB.
InfluxDB Flux Query Issues (All Resolved - relevant for when data eventually appears):
Initial query compilation errors (invalid statement: #, undefined identifier is/number): Solved by correctly using Flux comment syntax (//) and importing types then using types.isNumeric(v: r._value) for numeric filtering.
Result: Flux queries compile successfully and are ready to fetch data once it appears.
Xiaomi Home Integration Specific Logs (Known Issue, but Excluded):
I frequently see ValueError: … has the non-numeric value: ‘40-70’ related to an entity like sensor.xiaomi_cn_862168614_m15_humidity_range_p_10_6.
I’ve confirmed that this problematic entity is excluded from my influxdb configuration to prevent it from causing issues or polluting the database. This error is understood to be separate from the InfluxDB push problem.
Current Problem: Data Not Appearing in InfluxDB for Specific Sensor:
Sensor in Home Assistant:
Entity ID: sensor.miaomiaoc_cn_blt_3_1jcikjrb4k400_t9_temperature_p_3_1001 (and similar for humidity).
Verified in Developer Tools → States: This sensor is working normally, its state is a numeric value (°C), and it updates frequently.
Verification in InfluxDB Web UI (Data Explorer):
I select my correct bucket, _measurement: state, _field: value, and _tag: entity_id.
When I click the entity_id dropdown list, sensor.miaomiaoc_cn_blt_3_1jcikjrb4k400_t9_temperature_p_3_1001 DOES NOT appear in the list of available entity IDs.
Troubleshooting include filter:
Initially, I had include: entities: in my configuration.yaml specifying this exact ID.
To rule out include issues, I temporarily removed the entire include section from influxdb config (keeping only exclude for the humidity_range sensor).
Result: Even with include removed (meaning Home Assistant should push all sensor data), this specific entity_id still does not appear in InfluxDB’s entity_id list.
My configuration.yaml (InfluxDB snippet):
YAML
influxdb:
api_version: 2
host: 127.0.0.1
port: 8086
ssl: false
token: YOUR_INFLUXDB_TOKEN_HERE # Replaced for security
organization: YOUR_INFLUXDB_ORGANIZATION_NAME # Replaced for security
bucket: YOUR_INFLUXDB_BUCKET_NAME # Replaced for security
# Currently, the ‘include’ section is commented out/removed for testing,
# but this is how it would look if it were active with the specific ID:
# include:
# entities:
# - sensor.miaomiaoc_cn_blt_3_1jcikjrb4k400_t9_temperature_p_3_1001
exclude:
entities:
- sensor.xiaomi_cn_941475032_m15_humidity_range_p_10_6
My Question:
Given that the Home Assistant InfluxDB integration itself seems to be working (other state data is pushed), and the specific sensor is working normally within Home Assistant, why would this particular entity_id’s data not be pushed to InfluxDB?
Is there some deeper interaction between custom_components.xiaomi_home and the core InfluxDB integration that could prevent specific entity data from being picked up, even if it’s otherwise normal? Or something else I’m overlooking in the data flow within Home Assistant itself?
Any insights or further debugging steps would be greatly appreciated! Thank you.