No values from ds18b20 in Openhab2

openhab2
mqtt
Tags: #<Tag:0x00007fe05803e810> #<Tag:0x00007fe05803e6a8>

(Günter Strohmeier) #1

Hi there,

I just started with Openhab2. I have in use three Raspberry Pi in my network:
The first runs with openhabian as a switchboard
The second I use to control my glass house and the third is for other controls in my house.

My problem is this:

I use some ds18b20 an one dht22 in my glass house. The transmission of the temperature values of the dht22 to the BasicUI is OK,
but not those from the ds18b20. It seems, that the mosquitto server works, because I get the values with the MQTT Dashboard.
Also the Publishing the raspberry’s and one ESP32 is OK.

Here are my Items:
Number TempGewDHT “Temperatur GewDHT [%.1f °C]” {mqtt="<[mosquitto:garten/gew/dht-temp:state:default]"}
Number TempKelPumpe “Temperatur Pumpenkammer [%.1f °C]” {mqtt="<[mosquitto:keller/pumpe/temp:state:default]"}
Number TempKelWerk “Temperatur Werkstätte [%.1f °C]” {mqtt="<[mosquitto:keller/werkst/temp:state:default]"}
Number TempAussen “Aussentemperatur [%.1f °C]” {mqtt="<[mosquitto:garten/aussen/temp:state:default]"}

Sitemap:
Frame label=“Temperatur Gew DHT22” {
Text item=TempGewDHT
}
Frame label=“Temperatur Pumpenkammer” {
Text item=TempKelPumpe
}
Frame label=“Temperatur Werkstätte” {
Text item=TempKelWerk
}
Frame label=“Aussentemperatur” {
Text item=TempAussen
}

Openhab.log

2018-03-21 09:14:59.392 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for ‘TempGew’
2018-03-21 09:14:59.397 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for ‘TempAussen’
2018-03-21 09:15:01.236 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for ‘TempKelPumpe’
2018-03-21 09:15:01.239 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for ‘TempKelWerk’

I hope someone can help me
thanks


(hr2) #2

Post the dht22- and ESP32-item and mosquitto-massages please.


(Vincent Regaud) #3

Hi could you use the code fences, please?
They makes it easier to read code and item definitions


Thanks


(Vincent Regaud) #4

Also post your mqtt.cfg


(Günter Strohmeier) #5

For now, thanks for the quick reply

Number TempEsp32 "Temperatur ESP32 [%.1f °C]" <temperature> {mqtt="<[mosquitto:esp32/5/temp:state:default]"}
Number TempGewDHT "Temperatur GewDHT [%.1f °C]" <temperature> {mqtt="<[mosquitto:garten/gew/dht-temp:state:default]"}

Message from the ESP32
24.4
qos : 0, retain : false, cmd : publish, dup : false, topic : esp32/5/temp, messageId : , length : 18, Raw payload : 50524652

Message from the DHT22
20.2
qos : 0, retain : false, cmd : publish, dup : false, topic : garten/gew/dht-temp, messageId : , length : 25, Raw payload : 50484650

mqtt.cfg

#
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with an ID you choose.
#

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
mosquitto.url=tcp://192.168.0.91:1883

# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
mosquitto.clientId=openhab2

# Optional. True or false. If set to true, allows the use of clientId values
# up to 65535 characters long. Defaults to false.
# NOTE: clientId values longer than 23 characters may not be supported by all
# MQTT servers. Check the server documentation.
#<broker>.allowLongerClientIds=false

# Optional. User id to authenticate with the broker.
#<broker>.user=<user>

# Optional. Password to authenticate with the broker.
#<broker>.pwd=<password>

# Optional. Set the quality of service level for sending messages to this broker.
# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
# (Deliver exactly once). Defaults to 0.
mosquitto.qos=1

# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
#<broker>.retain=<retain>

# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
#<broker>.async=<async>

# Optional. Defines the last will and testament that is sent when this client goes offline
# Format: topic:message:qos:retained <br/>
#<broker>.lwt=<last will definition>


(hr2) #6

Do you have also messages from the ds18b20?


(Günter Strohmeier) #7

Here are two messages fro ds18b20

4.1
qos : 0, retain : false, cmd : publish, dup : false, topic : garten/aussen/temp, messageId : , length : 26, Raw payload : 323232524649

8.4
qos : 0, retain : false, cmd : publish, dup : false, topic : garten/fruehbeet/temp, messageId : , length : 29, Raw payload : 323232564652

thanks


(Vincent Regaud) #8

The esp llbrary for mqtt is not compatible with qos 1 and 2
Set your qos to 0 on mqtt.cfg


(Günter Strohmeier) #9

Thanks, I corrected the mqtt.cfg


(Vincent Regaud) #10

I am a bit confused.
Which items are updated correctly and which are not?
Can you make a list. Just the name of the items. We already have the definitions.
Thanks


(Günter Strohmeier) #11

These works OK (DHT22)

Number TempEsp32 "Temperatur ESP32 [%.1f °C]" <temperature> {mqtt="<[mosquitto:esp32/5/temp:state:default]"}
Number TempGewDHT "Temperatur GewDHT [%.1f °C]" <temperature> {mqtt="<[mosquitto:garten/gew/dht-temp:state:default]"}

Those does not update (ds18b20)

Number TempKelPumpe "Temperatur Pumpenkammer [%.1f °C]" <temperature> {mqtt="<[mosquitto:keller/pumpe/temp:state:default]"}
Number TempKelWerk "Temperatur Werkstätte [%.1f °C]" <temperature> {mqtt="<[mosquitto:keller/werkst/temp:state:default]"}
Number TempAussen "Aussentemperatur [%.1f °C]" <temperature> {mqtt="<[mosquitto:garten/aussen/temp:state:default]"}

(Vincent Regaud) #12

I am a bit stumped
I don’t see anything jumping out.
Delete the problem items
Restart openhab
Create the items again, one by one and monitor the logs