[Solved] Get temperature from domoticz to display it
Moderators: grovkillen, Stuntteam, TD-er
-
- New user
- Posts: 9
- Joined: 02 Feb 2020, 15:32
[Solved] Get temperature from domoticz to display it
Hello,
My Domoticz server have a weather device wich give me the outside temperature (from internet). I want to get this value from my domoticz server to ESPeasy to display it on a LCD screen.
I think I have to create a dummy device on ESPeasy and use a rule to feed it... but I don't know how exactly.
Could you help me please ? Thanks,
Manubis
My Domoticz server have a weather device wich give me the outside temperature (from internet). I want to get this value from my domoticz server to ESPeasy to display it on a LCD screen.
I think I have to create a dummy device on ESPeasy and use a rule to feed it... but I don't know how exactly.
Could you help me please ? Thanks,
Manubis
Last edited by manubis_sanchez on 04 Feb 2020, 10:53, edited 1 time in total.
Re: Get temperature from domoticz to display it
For example eventvalue:manubis_sanchez wrote: ↑02 Feb 2020, 15:45 I think I have to create a dummy device on ESPeasy and use a rule to feed it... but I don't know how exactly.
https://www.letscontrolit.com/wiki/inde ... alue.25.29
-
- New user
- Posts: 9
- Joined: 02 Feb 2020, 15:32
Re: Get temperature from domoticz to display it
Thank you ! I find the rule to update my device.
The answer :
Now I have to find how to send it from Domoticz with the correct value. I think I have to use dzvents... If someone can help me on this =)
The answer :
Code: Select all
on tempext do
TaskValueSet,3,1,%eventvalue%
endon
Re: Get temperature from domoticz to display it
Either LUA or dzVents can be used. Sensor values can be appended as strings.manubis_sanchez wrote: ↑03 Feb 2020, 20:07 Now I have to find how to send it from Domoticz with the correct value. I think I have to use dzvents... If someone can help me on this =)
dzVents:
--------
local url = 'http://10.0.0.99/control?cmd=tempext,20'
domoticz.openURL(url)
LUA:
----
commandArray = {}
commandArray['OpenURL'] = 'http://10.0.0.99/control?cmd=tempext,20'
return commandArray
-
- New user
- Posts: 9
- Joined: 02 Feb 2020, 15:32
Re: Get temperature from domoticz to display it
Here's my code but it don't work :
I don't know how to be sure the http request is really sent.
Edit : I found a way. I use Data Push - HTTP in the Domoticz menu and it works perfectly (It send the data when the value change so it's perfect !)
Code: Select all
return {
on = {
timer = { 'every minute' }, -- for testing
httpResponses = { 'trigger' }
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = 'http://192.168.1.xx/control?cmd=event,tempext=14',
method = 'GET',
callback = 'trigger'
})
end
if (item.isHTTPResponse) then
if (item.statusCode == 200) then
domoticz.log('URL sent', domoticz.LOG_ERROR) -- for testing too
end
else
domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
domoticz.log(item, domoticz.LOG_ERROR)
end
end
}
Edit : I found a way. I use Data Push - HTTP in the Domoticz menu and it works perfectly (It send the data when the value change so it's perfect !)
Re: [Solved] Get temperature from domoticz to display it
I also have problem to send data from domoticz to esp.
Can you show some print screens from domoticz and esp?
thx
Can you show some print screens from domoticz and esp?
thx
Re: [Solved] Get temperature from domoticz to display it
Have you looked at this Domoticz MQTT helper plugin?
https://espeasy.readthedocs.io/en/lates ... z%20helper
https://espeasy.readthedocs.io/en/lates ... z%20helper
Re: [Solved] Get temperature from domoticz to display it
I've use Node-RED to solved problem.
Code: Select all
[
{
"id": "8eea3e72.a634d",
"type": "tab",
"label": "Flow 6",
"disabled": false,
"info": ""
},
{
"id": "43362c6c.ae8434",
"type": "mqtt in",
"z": "8eea3e72.a634d",
"name": "",
"topic": "domoticz/out",
"qos": "2",
"datatype": "auto",
"broker": "9748a36f.44bdd",
"x": 350,
"y": 260,
"wires": [
[
"c2775a1f.93e698"
]
]
},
{
"id": "c2775a1f.93e698",
"type": "json",
"z": "8eea3e72.a634d",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 510,
"y": 260,
"wires": [
[
"999344f2.06deb8"
]
]
},
{
"id": "999344f2.06deb8",
"type": "switch",
"z": "8eea3e72.a634d",
"name": "",
"property": "payload.idx",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "30",
"vt": "str"
},
{
"t": "eq",
"v": "93",
"vt": "str"
},
{
"t": "eq",
"v": "96",
"vt": "str"
},
{
"t": "eq",
"v": "98",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 4,
"x": 650,
"y": 260,
"wires": [
[
"90eadebf.aa81d"
],
[
"30467635.48e29a"
],
[
"ff317967.d3f8a8"
],
[
"d54b8ee0.0434a"
]
]
},
{
"id": "d54b8ee0.0434a",
"type": "function",
"z": "8eea3e72.a634d",
"name": "Prepare event",
"func": "temp = msg.payload;\nmsg.topic = \"cmnd/espeasy/test4\"\nmsg.payload = parseFloat(temp.svalue1);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 840,
"y": 320,
"wires": [
[
"7db1ffba.bc5c8"
]
]
},
{
"id": "ff317967.d3f8a8",
"type": "function",
"z": "8eea3e72.a634d",
"name": "Prepare event",
"func": "temp = msg.payload;\nmsg.topic = \"cmnd/espeasy/test3\"\nmsg.payload = parseFloat(temp.svalue1);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 840,
"y": 280,
"wires": [
[
"7db1ffba.bc5c8"
]
]
},
{
"id": "30467635.48e29a",
"type": "function",
"z": "8eea3e72.a634d",
"name": "Prepare event",
"func": "temp = msg.payload;\nmsg.topic = \"cmnd/espeasy/test2\"\nmsg.payload = parseFloat(temp.svalue1);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 840,
"y": 240,
"wires": [
[
"7db1ffba.bc5c8"
]
]
},
{
"id": "90eadebf.aa81d",
"type": "function",
"z": "8eea3e72.a634d",
"name": "Prepare event",
"func": "temp = msg.payload;\nmsg.topic = \"cmnd/espeasy/test\"\nmsg.payload = parseFloat(temp.svalue1);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 840,
"y": 180,
"wires": [
[
"7db1ffba.bc5c8"
]
]
},
{
"id": "7db1ffba.bc5c8",
"type": "mqtt out",
"z": "8eea3e72.a634d",
"name": "",
"topic": "",
"qos": "2",
"retain": "",
"broker": "9748a36f.44bdd",
"x": 1070,
"y": 280,
"wires": []
},
{
"id": "9748a36f.44bdd",
"type": "mqtt-broker",
"z": "",
"broker": "localhost",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]
Last edited by shadaloo on 01 Feb 2021, 14:07, edited 1 time in total.
Re: [Solved] Get temperature from domoticz to display it
It looks like your code is incomplete.
Re: [Solved] Get temperature from domoticz to display it
from within the ESP i flip a switch in domoticz which triggers a script
in this script i have this
this sends out 1 number which will be received by the MQTT import plugin in the esp
you need to install mosquitto_pub on the device which is running domoticz
in my case a synology nas
Code: Select all
SendToHTTP 192.168.1.50,8084,json.htm?type=command¶m=switchlight&idx=334&switchcmd=On //initiate mqtt broadcast
this sends out 1 number which will be received by the MQTT import plugin in the esp
you need to install mosquitto_pub on the device which is running domoticz
in my case a synology nas
Code: Select all
MQTTTopic = 'domoticz/out/espeasy'
local watermetercounter = dz.devices('Watermeter').counter *1000
os.execute (mosquitto_pub..' -t '..MQTTTopic..' -m '..watermetercounter)
Who is online
Users browsing this forum: No registered users and 34 guests