increase or decrease of temperature
Moderator: leecollings
- jacobsentertainment
- Posts: 211
- Joined: Thursday 01 October 2020 1:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021-1
- Location: Not @ home
- Contact:
increase or decrease of temperature
Hi all,
I'm currently working on a heating system where I need to determine if a temperature is increasing or decreasing so I can anticipate with the script.
My intention is to open up a valve in the system when the temperature of the stove is 45° and increasing. and close the valve as soon as the temperature is below 50° and decreasing.
If someone can help me get started that would be much appreciated.
I'm currently working on a heating system where I need to determine if a temperature is increasing or decreasing so I can anticipate with the script.
My intention is to open up a valve in the system when the temperature of the stove is 45° and increasing. and close the valve as soon as the temperature is below 50° and decreasing.
If someone can help me get started that would be much appreciated.
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: increase or decrease of temperature
when you request the data from a temperature device with /json.htm?type=devices&rid=IDX you can get the trend (2 or 3).
3 is decreasing
2 is increasing
Edit: 0=Unknown, 1=Stable, 2=Up, 3=Down
See also the up/down arrows in a temperature device widget.
the attribute is not exposed within dzVents so you will have to read it with openurl and parse the json for the trend value.
3 is decreasing
2 is increasing
Edit: 0=Unknown, 1=Stable, 2=Up, 3=Down
See also the up/down arrows in a temperature device widget.
the attribute is not exposed within dzVents so you will have to read it with openurl and parse the json for the trend value.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: increase or decrease of temperature
Well to be prepared for the next question I made an example script how to get the trend ( 0=Unknown, 1=Stable, 2=Up, 3=Down) of a temperature device.
Replace IP_DOMO, PORT and IDX to your own environment
Replace IP_DOMO, PORT and IDX to your own environment
Code: Select all
return {
on = {
timer = {
'every 1 minutes' -- just an example to trigger the request
},
httpResponses = {
'GetTrend' -- must match with the callback passed to the openURL command
}
},
logging = {
level = domoticz.LOG_INFO,
marker = 'template',
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = 'http://IP_DOMO:PORT/json.htm?type=devices&rid=IDX',
method = 'GET',
callback = 'GetTrend', -- see httpResponses above.
})
end
if (item.isHTTPResponse) then
if (item.ok) then
if (item.isJSON) then
local DevTrend = item.json.result[1].trend -- to get the trend out of the json.
-- log trend of device in Domoticz, 0=Unknown, 1=Stable, 2=Up, 3=Down
domoticz.log('Trend of dev = ' .. DevTrend, domoticz.LOG_LOG)
end
else
domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
domoticz.log(item, domoticz.LOG_ERROR)
end
end
end
}
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 153
- Joined: Wednesday 02 October 2019 11:47
- Target OS: Linux
- Domoticz version: 2023.1
- Location: DE / BY / LT
- Contact:
Re: increase or decrease of temperature
Hi,
I just came across this.... is there an option to get the trend value in MQTT as well? IIRC it is not in the payload for temp sensors so far..?
I just came across this.... is there an option to get the trend value in MQTT as well? IIRC it is not in the payload for temp sensors so far..?
- jacobsentertainment
- Posts: 211
- Joined: Thursday 01 October 2020 1:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021-1
- Location: Not @ home
- Contact:
Re: increase or decrease of temperature
Cheers Walter Ill give it try tonight.
waltervl wrote: ↑Wednesday 30 March 2022 21:53 Well to be prepared for the next question I made an example script how to get the trend ( 0=Unknown, 1=Stable, 2=Up, 3=Down) of a temperature device.
Replace IP_DOMO, PORT and IDX to your own environment
Code: Select all
return { on = { timer = { 'every 1 minutes' -- just an example to trigger the request }, httpResponses = { 'GetTrend' -- must match with the callback passed to the openURL command } }, logging = { level = domoticz.LOG_INFO, marker = 'template', }, execute = function(domoticz, item) if (item.isTimer) then domoticz.openURL({ url = 'http://IP_DOMO:PORT/json.htm?type=devices&rid=IDX', method = 'GET', callback = 'GetTrend', -- see httpResponses above. }) end if (item.isHTTPResponse) then if (item.ok) then if (item.isJSON) then local DevTrend = item.json.result[1].trend -- to get the trend out of the json. -- log trend of device in Domoticz, 0=Unknown, 1=Stable, 2=Up, 3=Down domoticz.log('Trend of dev = ' .. DevTrend, domoticz.LOG_LOG) end else domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR) domoticz.log(item, domoticz.LOG_ERROR) end end end }
- jacobsentertainment
- Posts: 211
- Joined: Thursday 01 October 2020 1:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021-1
- Location: Not @ home
- Contact:
Re: increase or decrease of temperature
Sure I do something wrong here And I admit I know to little of this.
Anyway me result where
If I put the http directly in a browser I get the info of that sensor.
Anyway me result where
Code: Select all
2022-03-31 20:20:01.335 Error: Error opening url: http://192.168.178.72:8080/json.htm?type=devices&rid=64
2022-03-31 20:20:01.697 Error: dzVents: Error: (3.1.8) Trend: HTTP/1.1 response: 401 ==>> Unauthorized
2022-03-31 20:20:01.700 Error: dzVents: Error: (3.1.8) Trend: There was a problem handling the request
2022-03-31 20:20:01.700 Error: dzVents: Error: (3.1.8) Trend: {["data"]="<html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>", ["isJSON"]=false, ["isDevice"]=false, ["isVariable"]=false, ["headers"]={["Content-Type"]="text/html;charset=UTF-8", ["Set-Cookie"]="DMZSID=none; HttpOnly; Expires=Thu, 01 Jan 1970 00:00:00 GMT", ["Content-Length"]="91"}, ["callback"]="GetTrend", ["isXML"]=true, ["isSecurity"]=false, ["trigger"]="GetTrend", ["statusCode"]=401, ["protocol"]="HTTP/1.1", ["xml"]={["html"]={["body"]={["h1"]="401 Unauthorized"}, ["head"]={["title"]="Unauthorized"}}}, ["isCustomEvent"]=false, ["isHTTPResponse"]=true, ["baseType"]="httpResponse", ["_contentType"]="text/html;charset=UTF-8", ["isSystem"]=false, ["isHardware"]=false, ["statusText"]="Unauthorized", ["isShellCommandResponse"]=false, ["isTimer"]=false, ["isGroup"]=false, ["isScene"]=false, ["ok"]=false, ["dump"]=function}
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: increase or decrease of temperature
If you have user/password, do you have 127.0.0.* (next to your local network 192.168.178.*) in the local Networks setting (menu setup- settings)?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- jacobsentertainment
- Posts: 211
- Joined: Thursday 01 October 2020 1:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021-1
- Location: Not @ home
- Contact:
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: increase or decrease of temperature
So you should. Like the dzvents documentation says:
https://www.domoticz.com/wiki/DzVents:_ ... h_Domoticz
https://www.domoticz.com/wiki/DzVents:_ ... h_Domoticz
Also make sure that in the Security section in the settings (Setup > Settings > System > Local Networks (no username/password) you allow 127.0.0.1 (and / or ::1 when using IPv6 ) to not need a password. dzVents does use this port to get the location settings and to send certain commands to Domoticz.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- jacobsentertainment
- Posts: 211
- Joined: Thursday 01 October 2020 1:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021-1
- Location: Not @ home
- Contact:
Re: increase or decrease of temperature
Ill try to have a look in to this this week, currently back on job and away from home.
- jacobsentertainment
- Posts: 211
- Joined: Thursday 01 October 2020 1:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021-1
- Location: Not @ home
- Contact:
Re: increase or decrease of temperature
I have it working;
Maybe silly to ask but how can I use this 0, 1, 2, or 3 to trigger an action
Code: Select all
2022-04-03 17:40:00.420 Status: dzVents: Info: Trend: ------ Start internal script: trend test:, trigger: "every 1 minutes"
2022-04-03 17:40:00.420 Status: dzVents: Info: Trend: ------ Finished trend test
2022-04-03 17:40:00.992 Status: dzVents: Info: Handling httpResponse-events for: "GetTrend"
2022-04-03 17:40:00.992 Status: dzVents: Info: Trend: ------ Start internal script: trend test: HTTPResponse: "GetTrend"
2022-04-03 17:40:00.994 Status: dzVents: Info: Trend: Trend of dev = 3
2022-04-03 17:40:00.994 Status: dzVents: Info: Trend: ------ Finished trend test
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: increase or decrease of temperature
Like you said in first post (make it dzvents yourself):
If temp = 45 and trend = 2 then open valve
If temp = 50 and trend = 3 then close valve
If temp = 45 and trend = 2 then open valve
If temp = 50 and trend = 3 then close valve
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- jacobsentertainment
- Posts: 211
- Joined: Thursday 01 October 2020 1:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021-1
- Location: Not @ home
- Contact:
Re: increase or decrease of temperature
Cheers Walter
I also had a little play to get some results
Code: Select all
if DevTrend ~= 2 then
domoticz.log('Trend gaat omhoog', domoticz.LOG_LOG)
elseif
DevTrend ~= 3 then
domoticz.log('Trend gaat omlaag', domoticz.LOG_LOG)
-
- Posts: 66
- Joined: Tuesday 19 April 2016 23:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: increase or decrease of temperature
should be included into dzevents params
Fronius plugin
https://github.com/ayasystems/froniusHttp
Solax plugin
https://github.com/ayasystems/SolaxHTTP
Openevse plugin
https://github.com/ayasystems/OpenEVSEPlugin
https://github.com/ayasystems/froniusHttp
Solax plugin
https://github.com/ayasystems/SolaxHTTP
Openevse plugin
https://github.com/ayasystems/OpenEVSEPlugin
-
- Posts: 33
- Joined: Tuesday 18 April 2023 8:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Contact:
Re: increase or decrease of temperature
can someone explain how the trend is set in domoticz? after how many readings is the trend set? or is set after a time and the value of the temperature? how dose domoticz set the trend for a sensore temperature?
i have a sensore that is updated every 10 seconds and the trend is changing very slow.
i have a sensore that is updated every 10 seconds and the trend is changing very slow.
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: increase or decrease of temperature
Looking at https://github.com/domoticz/domoticz/bl ... lculator.h it seems to be measured over an average of 30 minutes.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Who is online
Users browsing this forum: No registered users and 1 guest