In my Home Assistant implementation on Raspberry Pi, I include data from my Davis weather station using the Weather Underground component supplied with Home Assistant. Everything is received and displayed correctly, and when I click on the “Outdoor Temperature” monitored condition I get a nice graph:
I also have a set of ESP8266 based temperature sensors inside my house. They upload their readings, once per minute, to HomeAssistant via a MQTT (also running on my Raspberry Pi).
The readings are displayed correctly in Home Assistant, viz:
However, when I click on any of these sensors in the Home Assistant UI, I get this:
rather than a nice graph. How can I change my setup to display a graph?
Here is a snippet from my configuration.yaml:
And here is the relevant code from my ESP8266 sketch:
// MQTT
const char* mqtt_client_id = “temp_study”; //*** set MQTT Client ***
const char* mqtt_topic = “sensor/temp_study”; //*** set MQTT Topic ***
const char* mqtt_server = “192.168.10.21”;
const char* mqtt_username = “pi”;
const char* mqtt_password = “XXXXXXXX”;
// MQTT function to publish temperature
void publishData(float p_temperature){
// create JSON object
StaticJsonBuffer<200> jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
// Info: the data must be converted into a string: a problem occurs when using floats …
root[“temperature”] = (String) p_temperature+" \u00B0F"; // u000B0 is degree symbol
//root.prettyPrintTo(Serial);
//Serial.println();
char data[200];
root.printTo(data, root.measureLength() +1);
client.publish(mqtt_topic, data, true);
}
Note that I include a “\u00B0F” (degree symbol+F) in the temperature array that is sent up to MQTT. I’ve tried it with and without that text and it makes no difference to the graph, or lack thereof.
Finally, in case it matters I have included:
introduction:
frontend:
recorder:
purge_days: 1
history:
logbook:
in my configuration.yaml.
I would appreciate any help you can give me to get my ESP8266 temperature sensors to display graphs.
Thanks.