[solved] Chart, MQTT, LDR not working but DHT22 working?

maybe I am too blind at the moment but I have following error:

I have a LDR and a DHT22 on a Wemos D1 mini, both working and displaying good values in my sitemap
For all three values I have a chart. Temperature and Humidity is working fine but not with brightness.

This is in my items file:

Number TemperatureWohnzimmer “Temperatur [%.0f °C]” (gTempLF_Wohnzimmer) [ “CurrentTemperature” ] {mqtt="<[mymosquitto:/TEMP_WOHNZIMMER/DHT22/Temperature:state:default]"}
Number HumidityWohnzimmer “Luftfeuchtigkeit [%.0f %%]” (gTempLF_Wohnzimmer, gLuftfeuchte_Wohnzimmer) [ “CurrentHumidity” ] {mqtt="<[mymosquitto:/TEMP_WOHNZIMMER/DHT22/Humidity:state:default]"}
Number BrightnessWohnzimmer “Helligkeit [%.0f LUX]” (gTempLF_Wohnzimmer, gHelligkeit_Wohnzimmer) [ “CurrentBrightness” ] {mqtt="<[mymosquitto:/TEMP_WOHNZIMMER/LDR/Brightness:state:default]"}

Number Chart_Zeitraum_D_W_M_Y

and this in my sitemap:

    Frame label="Luftfeuchte Innen/Außen" {
            Switch	item=Chart_Zeitraum_D_W_M_Y label="" mappings=[0="Tag", 1="Woche", 2="Monat", 3="Jahr"]
            Chart	item=HumidityWohnzimmer	period=D refresh=60000 visibility=[Chart_Zeitraum_D_W_M_Y==0, Chart_Zeitraum_D_W_M_Y=="Uninitialized"]
            Chart	item=HumidityWohnzimmer	period=W refresh=60000 visibility=[Chart_Zeitraum_D_W_M_Y==1]
            Chart	item=HumidityWohnzimmer	period=M refresh=60000 visibility=[Chart_Zeitraum_D_W_M_Y==2]
            Chart	item=HumidityWohnzimmer	period=Y refresh=60000 visibility=[Chart_Zeitraum_D_W_M_Y==3]

    Frame label="Helligkeit Innen/Außen" {
            Switch  item=Chart_Zeitraum_D_W_M_Y label="" mappings=[0="Tag", 1="Woche", 2="Monat", 3="Jahr"]
            Chart   item=BrightnessWohnzimmer period=D refresh=60000 visibility=[Chart_Zeitraum_D_W_M_Y==0, Chart_Zeitraum_D_W_M_Y=="Uninitialized"]
            Chart   item=BrightnessWohnzimmer period=W refresh=60000 visibility=[Chart_Zeitraum_D_W_M_Y==1]
            Chart   item=BrightnessWohnzimmer period=M refresh=60000 visibility=[Chart_Zeitraum_D_W_M_Y==2]
            Chart   item=BrightnessWohnzimmer period=Y refresh=60000 visibility=[Chart_Zeitraum_D_W_M_Y==3]

Any ideas where my mistake is?


One issue, try not have your MQTT topics to start with “/”. Although allowed, it add a layer in the topics and can lead to confusion and errors.
For your particular problem, have you monitored the MQTT traffic with mqttspy or mqtt.fx to see if your wemos send the value on that topic, and if yes what is the string sent, exactly?
Remember that MQTT payloads are string and any stray characters will confused OH who will not be able to parse the value to a number.

Basically correct, but please don’t forget that using for example ESPEasy firmware, left at default settings, needs the leading slash:
Controller Publish /%sysname%/%tskname%/%valname%

Random thought - maybe the lux is going out of bounds. While temperature and humidity tend to have small range boundaries, lux can vary a lot. Maybe it’s just going out of chart boundaries, or going above what the variable in OH handles?

Also, have you verified that your MQTT broker is receiving the lux?

I am very unfamiliar with this but I will try to do it this evening.

Yes my wemos is running on ESPEasy …

Thanks so far for all your help.

You need a way to monitor your mqtt traffic so we can establish exactly what value your ESP is sending in what topic

I have several lux sensors, running on an ESP8266 with ESPEasy, items definition is like:

Number ESP8266_One_Lux (gCheckSensorStates) { mqtt="<[mosquitto:/esp8266one/light/intensity:state:default]" }

If your choice is mqtt-spy just subscribe to the # (kind of wildcard) topic to see all messages coming from your broker:

Then exactly copy the “Topic” part to your inbound items definition.

Funny, I installed mqtt.fx already :slight_smile:

Good news?!

This is received by mqtt:

Try that:
It may look the same but it may just work this way:

Number BrightnessWohnzimmer "Helligkeit [%.0f LUX]" (gTempLF_Wohnzimmer, gHelligkeit_Wohnzimmer) [ "CurrentBrightness" ] { mqtt="<[mymosquitto:/TEMP_WOHNZIMMER/LDR/Brightness:state:default]" }

I copied exactly your line and deleted the old one

Sitemap did show no values nor links working …???

Wrong double quotes, use " instead of

already found while doing the copy paste of vzorglub’s suggestion and changed it … no effect

This parsing of double quote is really getting on my nerves… :angry:
Did you change them all?
If you change anything in your item file and save, what does your openhab.log show?

1 Like

2018-05-02 21:47:22.669 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘default.items’

No errors, hmmm…
If you publish a value with mqtt.fx on that topic, does OH update?

How can I do that?

found the way

yes the single value is updating but chart is still empty

That’s good, we know that there is nothing wrong with the OH binding and item definition
The chart will probably be empty until there is enough data to show
How often does your ESP reports the Brightness value?