Import temperature data from Domoticz MQTT not working

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
BounceMeister
Normal user
Posts: 10
Joined: 10 Mar 2017, 20:25

Import temperature data from Domoticz MQTT not working

#1 Post by BounceMeister » 08 Jun 2023, 11:54

I want to do a simple thing that appears to be impossibly difficult.
I want Domoticz to send a temperature sensor value to espeasy.

I have a temperature sensor as a device in Domoticz (Raspberry Pi). I followed a tutorial to set up Node Red and Mosquitto to have Domoticz send data to node red.
When using MQTT Explorer, i see all sorts of data in domoticz/out, it seems to be publishing everything.
{
"Battery" : 255,
"LastUpdate" : "2023-06-08 11:43:01",
"RSSI" : 8,
"description" : "",
"dtype" : "Temp",
"hwid" : "8",
"id" : "1410A",
"idx" : 186,
"name" : "ZwembadTemp",
"nvalue" : 0,
"stype" : "LaCrosse TX3",
"svalue1" : "23.50",
"unit" : 1
}

Now i want to import this temperature into a dummy device in espeasy and eventually display it on an oled screen.
I have tried many many different things, but currently i am doing this:

Downloaded and installed latest espeasy on a wemos D1.
I set up a "Domoticz MQTT" controller on a static ip.
I created a "Generic - MQTT Import" device with "prefix for all topics" set to "domoticz/out/".
I created a "MQTT Topic:" named "ZwembadTemp" which is the name of the temperature device in Domoticz.
I enabled "Parse Json" and "Apply filters".
I set "Filter for MQTT Topic:" to "idx", "equals", "186" to filter only that specific device from domoticz.
I created a Dummy device named "ZwembadTempDummy" which i entered as value1 in the MQTT Import device, it should be linked to the imported value of "ZwembadTemp".

The value doesn't get imported.

The espeasy log looks like this:

1077243: EVENT: ZwembadTempDummy#Temperature=0.0
1077428: EVENT: Clock#Time=Thu,11:14
1082236: Dummy: value 1: 0.0
1082243: EVENT: ZwembadTempDummy#Temperature=0.0
1084985: WD : Uptime 18 ConnectFailures 0 FreeMem 14608 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
1087237: Dummy: value 1: 0.0
1087242: EVENT: ZwembadTempDummy#Temperature=0.0
1092247: Dummy: value 1: 0.0
1092253: EVENT: ZwembadTempDummy#Temperature=0.0
1097237: Dummy: value 1: 0.0
1097243: EVENT: ZwembadTempDummy#Temperature=0.0
1102237: Dummy: value 1: 0.0
1102241: EVENT: ZwembadTempDummy#Temperature=0.0
1107237: Dummy: value 1: 0.0
1107244: EVENT: ZwembadTempDummy#Temperature=0.0
1112236: Dummy: value 1: 0.0
1112241: EVENT: ZwembadTempDummy#Temperature=0.0
1114983: WD : Uptime 19 ConnectFailures 0 FreeMem 15856 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
1117236: Dummy: value 1: 0.0
1117241: EVENT: ZwembadTempDummy#Temperature=0.0

Is there any tutorial that covers exactly what i want to do? Most info i find is covering something different, the other way around or not using domoticz.

Sad thing is that i used to have quite a nice setup with four espeasy devices talking to eachother through http and controlling my pool pumps and solar heaters. But i have a pool heater now and i only want to display the temperature (and pool pump switch status) which i import from domoticz.

Image
Image
Image
Image
Image

bidrohini
Normal user
Posts: 117
Joined: 03 Nov 2022, 16:24

Re: Import temperature data from Domoticz MQTT not working

#2 Post by bidrohini » 13 Jun 2023, 18:10

I think it's better to post this to the Domoticz forum:
https://www.domoticz.com/forum/

User avatar
Ath
Normal user
Posts: 3918
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Import temperature data from Domoticz MQTT not working

#3 Post by Ath » 13 Jun 2023, 19:58

@bidrohini This question is about ESPEasy, not about Domoticz.

@BounceMeister Sorry for replying late, I initially read this question while at work, with no ESPEasy unit at hand, and later forgot to reply.
BounceMeister wrote: 08 Jun 2023, 11:54 I want to do a simple thing that appears to be impossibly difficult.
Nearly anything is possible :lol:

I've configured a test unit, that is now receiving a (fake) swimming pool temperature 8-)
Of course you'll have to enable the task to receive any value, and I used my own taskname and idx.

Be aware that receiving Domoticz MQTT messages will flood the unit with data, as Domoticz is exporting all messages via that single "domoticz/out" topic. An ESP8266 may have trouble handling all that if you don't filter it thoroughly, preferably via the idx attribute.

Edit:
No need, btw, to store the value in a Dummy Device task, you can just use the [DomoticzMQTT#ZwembadTempDummy] variable in your display configuration, though maybe shortening the names might be helpful...


Screenshot - 13-06-2023 , 19_44_59.png
Screenshot - 13-06-2023 , 19_44_59.png (99.29 KiB) Viewed 13136 times
/Ton (PayPal.me)

BounceMeister
Normal user
Posts: 10
Joined: 10 Mar 2017, 20:25

Re: Import temperature data from Domoticz MQTT not working

#4 Post by BounceMeister » 13 Jun 2023, 22:54

Ath wrote: 13 Jun 2023, 19:58 Nearly anything is possible :lol:
Indeed, you just proved it! ;)

Thank you so much, i think i would have never figured out how to make this work.
So the topic is domoticz/out and everything inside it is like values? Somehow i thought the topic to listen to would be domoticz/out/ZwembadTemp.

I imported two temperatures now by adding another line of "domoticz/out" and "svalue1" and filtering for a different idx on line 2, this way the only svalue that is coming through is the one with that idx.

User avatar
Ath
Normal user
Posts: 3918
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Import temperature data from Domoticz MQTT not working

#5 Post by Ath » 13 Jun 2023, 23:04

BounceMeister wrote: 13 Jun 2023, 22:54 So the topic is domoticz/out and everything inside it is like values? Somehow i thought the topic to listen to would be domoticz/out/ZwembadTemp.
That would be regular MQTT topics indeed, but that's not how Domoticz rolls...
BounceMeister wrote: 13 Jun 2023, 22:54 I imported two temperatures now by adding another line of "domoticz/out" and "svalue1" and filtering for a different idx on line 2, this way the only svalue that is coming through is the one with that idx.
You'll have to check using MQTT Explorer what attribute is holding the desired value. Unfortunately, Domoticz uses svalue, svalue1 and sometimes nvalue to export its values, depending on the type and make of the sensor involved. Haven't investigated much, though I use Domoticz myself, but I usually just send sensor data to it, not gather data from it. Even though I extended the MQTT Import plugin, with JSON support, filtering and mapping, to enable that.
/Ton (PayPal.me)

User avatar
Andrew Mamohin
Normal user
Posts: 102
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

Re: Import temperature data from Domoticz MQTT not working

#6 Post by Andrew Mamohin » 15 Jun 2023, 15:23

Wow! Good topic. Remade some of my devices where I used to have to remake MQTT with Node Red. There are two remarks: 1. for some reason in the collection_a there is an old version of the plugin (without "Parse JSON messages"). 2. formulas do not work in this plugin.
Andy.

TD-er
Core team member
Posts: 9221
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Import temperature data from Domoticz MQTT not working

#7 Post by TD-er » 15 Jun 2023, 15:54

Collection builds have "LIMIT_BUILD_SIZE" defined, so some features may have been disabled in order to make it fit.
Among those are some of the newly added features of the MQTT import plugin.

User avatar
Ath
Normal user
Posts: 3918
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Import temperature data from Domoticz MQTT not working

#8 Post by Ath » 15 Jun 2023, 15:56

Andrew Mamohin wrote: 15 Jun 2023, 15:23 Wow! Good topic. Remade some of my devices where I used to have to remake MQTT with Node Red. There are two remarks: 1. for some reason in the collection_a there is an old version of the plugin (without "Parse JSON messages"). 2. formulas do not work in this plugin.
What TD-er said.

I'll investigate if those features can be enabled for some of these builds.
/Ton (PayPal.me)

User avatar
Andrew Mamohin
Normal user
Posts: 102
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

Re: Import temperature data from Domoticz MQTT not working

#9 Post by Andrew Mamohin » 16 Jun 2023, 09:10

Is it possible to import such a value?

Code: Select all

svalue: "23.78;52;1"
Andy.

User avatar
Ath
Normal user
Posts: 3918
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Import temperature data from Domoticz MQTT not working

#10 Post by Ath » 16 Jun 2023, 09:56

Andrew Mamohin wrote: 16 Jun 2023, 09:10 Is it possible to import such a value?

Code: Select all

svalue: "23.78;52;1"
From the documentation (though it may be a bit hard to find :shock:)
Screenshot - 16-06-2023 , 09_54_34.png
Screenshot - 16-06-2023 , 09_54_34.png (11.98 KiB) Viewed 13083 times
/Ton (PayPal.me)

User avatar
Andrew Mamohin
Normal user
Posts: 102
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

Re: Import temperature data from Domoticz MQTT not working

#11 Post by Andrew Mamohin » 16 Jun 2023, 13:35

Ath wrote: 16 Jun 2023, 09:56 From the documentation (though it may be a bit hard to find :shock:)
Oh, I'm a dunce... Thank you! Everything worked.
And formulas will never work in this plugin?
Andy.

User avatar
Ath
Normal user
Posts: 3918
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Import temperature data from Domoticz MQTT not working

#12 Post by Ath » 16 Jun 2023, 13:39

Andrew Mamohin wrote: 16 Jun 2023, 13:35 And formulas will never work in this plugin?
Why not? They should work for the values like any other plugin that supports formulas. (RTD)
/Ton (PayPal.me)

User avatar
Andrew Mamohin
Normal user
Posts: 102
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

Re: Import temperature data from Domoticz MQTT not working

#13 Post by Andrew Mamohin » 16 Jun 2023, 15:44

Ath wrote: 16 Jun 2023, 13:39 Why not? They should work for the values like any other plugin that supports formulas.
I wrote that in this plugin the formulas do not work for me.
8Sc9rBJyXp.jpg
8Sc9rBJyXp.jpg (8.1 KiB) Viewed 13057 times
Andy.

User avatar
Ath
Normal user
Posts: 3918
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Import temperature data from Domoticz MQTT not working

#14 Post by Ath » 17 Jun 2023, 14:41

Andrew Mamohin wrote: 16 Jun 2023, 15:44
Ath wrote: 16 Jun 2023, 13:39 Why not? They should work for the values like any other plugin that supports formulas.
I wrote that in this plugin the formulas do not work for me.

8Sc9rBJyXp.jpg
Did some investigation, but as this plugin doesn't have an Interval setting, no regular PLUGIN_READ event is performed on the plugin. The Formula option was only enabled in the past to (also) enable the Decimals option, before that was made into a separate (compile-time)setting. I'm fixing that in a PR.
The endorsed way of re-calculating the values received from MQTT is to handle the matching event for that value in Rules, and optionally store the result in a Dummy task. (F.e. to be used on a display.)

Edit: PR #4708
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests