Sitemap doesn't show the value

in visual studio code i have 3 files
1: demo.sitemap
sitemap demo label=“demo” {

Frame label="Nhiet do" {

    Text item=Temperature


Frame label="Do am" {

    Text item=Humidity


2: tem&humidity.items
Number Temperature “Temperature [%.1f °C]” {channel = “mqtt:topic:hivemqbroker:nodemcu:temperature”}
Number Humidity "Humidity " {channel = “mqtt:topic:hivemqbroker:nodemcu:humidity”}
3: test_mqtt.things
Bridge mqtt:broker:hivemqbroker [ host=“”, secure=false, username=“openhab”, password=“openhab” ]


Thing topic nodemcu



        Type number : temperature [ stateTopic="temperature/state" ]

        Type number : humidity [ stateTopic="humidity/state" ]


and my arduino code:
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include “DHT.h”
// nut nhan 1

int stateButton1;
int previous1 = LOW;
long settime1 = 0;
// nut nhan 2

long settime_nhietdo = 0;
long debounce = 200;
// Cau hinh cam bien DHT
#define DHTTYPE DHT11
DHT dht(D6, DHT11);
// Dinh nghia wifi ket noi den NodeMCU
#define wifi_ssid “Wifi free” // tên wifi mà ESP8266 sẽ kết nối
#define wifi_password “24102001” // mật khẩu wifi

const char* mqtt_server = “”; // Địa chỉ IP của máy chủ MQTT server
const char* mqttUser = “openhab”; // User mqtt nguoi dung
const char* mqttPassword = “openhab”; // Password mqtt

// Tao Client server cho NodeMCU ket noi
WiFiClient espClient;
PubSubClient client(espClient);

float t;
float h;

void setup() {

client.setServer(mqtt_server, 1883);
void setup_wifi(){
Serial.print(“Connecting to “);
WiFi.begin(wifi_ssid, wifi_password);
while (WiFi.status() != WL_CONNECTED) {
Serial.println(“WiFi connected”);
Serial.println("IP address: ");
void callback(char* topic, byte* payload, unsigned int length) {
Serial.println(“Control by web”);
Serial.print("Trang thai led: ");

void reconnect() {
while (!client.connected()) {
Serial.print(“Connecting to MQTT…”);
if (client.connect(“ESP8266”, mqttUser, mqttPassword )) {
} else {
Serial.print(“failed, rc=”);
Serial.println(" try again in 5 seconds");
void loop() {
if (!client.connected()) {

// Gui du lieu dht11 len openhab
if(millis() - settime_nhietdo > 5000) {
Serial.println(“Nhiet do va do am”);
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print(“Nhiet do = “);
Serial.print(” Do am = “);
char buffer[10];
dtostrf(t,0, 0, buffer);
dtostrf(h,0, 0, buffer);
settime_nhietdo = millis();

i have a project which is measuring the temperature & humidity and show that data on openhab. i followed all the step on , creating files such as demo.sitemap , test_mqtt.things and tem&humidity.items but sitemap is not showing the values while i already uploaded the code in Arduino. Please help me. Thanks in advance …!

Does openHAB have access to the MQTT broker?
Are the items updating? Check the log if so.

But I think that the MQTT configuration at some point does not match, so best would be using e.g. MQTT.fx to verify that the topics are correct.


Just to be sure… Is the item updating but you are not getting the state in the sitemap?

If so I think you would need:

Text item=Temperature    label="Name of Item to be displayed [%s]"

This will allow the state to be displayed

1 Like

I tested my MQTT.fx, it worked alright while i uploaded my arduino code. My topics are correct but my sitemap is still not showing the values TT … sadness. do you have another ideas?

i changed the sitemap form like you , but my sitemap is still not showing the values. i think there is some problems with my MQTT on openhab but i don’t know where

Use the available tools. Does the UI tell your broker Thing is online? Does your openhab.log complain about loading your things or items files? Does your events.log show any activity on the Item?
Can we see your mqtt.fx captures, to review against your channel settings?

1 Like

my broker Thing is all online

I didn’t see any ERROR in my openhab.log
i noticed a lot of activities on the events.log like this one ( light and relay but there are no activities of Temperature & Humidity)

my events.log looks like this

sir, i’m wondering that is it possible if there are two people me and my friend set up the same mqtt_server , mqttuser, mqttpassword and while my friend uploaded his arduino code on his computer and i received the data in my sitemap on openhab from his dht11 which he was doing on his esp and arduino. Because i don’t know why my sitemap showed the values of temperature - 28.0 °C and humidity - 72.0 while i didn’t do anything with my arduino even though i don’t have any esps and sensors to upload the code. I noticed this one from yesterday and now it’s the same, it still shows 28 in temperature and 72 in humidity. it’s unchanged with time.

Everything publishing to MQTT should use it’s own topics. So don’t copy your friends settings.

If you are getting your friends data, you are listening to his topics.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.