[Solved] Get temperature from domoticz to display it

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
manubis_sanchez
Normal user
Posts: 5
Joined: 02 Feb 2020, 15:32

[Solved] Get temperature from domoticz to display it

#1 Post by manubis_sanchez » 02 Feb 2020, 15:45

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
Last edited by manubis_sanchez on 04 Feb 2020, 10:53, edited 1 time in total.

User avatar
enesbcs
Normal user
Posts: 560
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: Get temperature from domoticz to display it

#2 Post by enesbcs » 02 Feb 2020, 22:35

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.
For example eventvalue:
https://www.letscontrolit.com/wiki/inde ... alue.25.29

manubis_sanchez
Normal user
Posts: 5
Joined: 02 Feb 2020, 15:32

Re: Get temperature from domoticz to display it

#3 Post by manubis_sanchez » 03 Feb 2020, 20:07

Thank you ! I find the rule to update my device.

The answer :

Code: Select all

on tempext do
  TaskValueSet,3,1,%eventvalue%
endon
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 =)

User avatar
enesbcs
Normal user
Posts: 560
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: Get temperature from domoticz to display it

#4 Post by enesbcs » 03 Feb 2020, 20:15

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 =)
Either LUA or dzVents can be used. Sensor values can be appended as strings.

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

manubis_sanchez
Normal user
Posts: 5
Joined: 02 Feb 2020, 15:32

Re: Get temperature from domoticz to display it

#5 Post by manubis_sanchez » 03 Feb 2020, 22:15

Here's my code but it don't work :

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
}
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 !)

shadaloo
Normal user
Posts: 2
Joined: 20 Dec 2020, 23:48

Re: [Solved] Get temperature from domoticz to display it

#6 Post by shadaloo » 20 Dec 2020, 23:53

I also have problem to send data from domoticz to esp.
Can you show some print screens from domoticz and esp?

thx

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

Re: [Solved] Get temperature from domoticz to display it

#7 Post by TD-er » 21 Dec 2020, 14:25

Have you looked at this Domoticz MQTT helper plugin?

https://espeasy.readthedocs.io/en/lates ... z%20helper

shadaloo
Normal user
Posts: 2
Joined: 20 Dec 2020, 23:48

Re: [Solved] Get temperature from domoticz to display it

#8 Post by shadaloo » 23 Jan 2021, 22:09

shadaloo wrote: 20 Dec 2020, 23:53 I also have problem to send data from domoticz to esp.
Can you show some print screens from domoticz and esp?

thx
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.

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

Re: [Solved] Get temperature from domoticz to display it

#9 Post by TD-er » 23 Jan 2021, 22:24

It looks like your code is incomplete.

GravityRZ
Normal user
Posts: 154
Joined: 23 Dec 2019, 21:24

Re: [Solved] Get temperature from domoticz to display it

#10 Post by GravityRZ » 17 Feb 2021, 10:46

from within the ESP i flip a switch in domoticz which triggers a script

Code: Select all

SendToHTTP 192.168.1.50,8084,json.htm?type=command&param=switchlight&idx=334&switchcmd=On //initiate mqtt broadcast
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

        MQTTTopic = 'domoticz/out/espeasy'
        local watermetercounter = dz.devices('Watermeter').counter *1000
        os.execute (mosquitto_pub..' -t '..MQTTTopic..' -m '..watermetercounter)

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests