Looking for dewpoint

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
jkimmel
Posts: 129
Joined: Monday 25 November 2013 17:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Mallorca
Contact:

Looking for dewpoint

Post by jkimmel »

I'm not sure whether my temperature sensor provides a dewpoint.

How could I check this?
Rfxcom
Raspi 4
User avatar
waltervl
Posts: 5893
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Looking for dewpoint

Post by waltervl »

A dew point is only available when also humidity is known. So if you have a combined Temp/humidity sensor a dew point can be calculated and displayed.

Why is your question in dzVents subforum and not in temperature and weather?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
jkimmel
Posts: 129
Joined: Monday 25 November 2013 17:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Mallorca
Contact:

Re: Looking for dewpoint

Post by jkimmel »

Sorry, you are right. But I was looking for using the dewpoint in a dzVents Script, that's the reason. Sorry again.
Rfxcom
Raspi 4
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Looking for dewpoint

Post by rrozema »

Both on a temphum and a temperture, humidity, barometer device the property dewPoint is available (https://www.domoticz.com/wiki/DzVents:_ ... _scripting, then search for dewpoint)

If you've got a separate temperature and relative humidity value, you can theoretically calculate the dewpoint.http://www.wettermail.de/wetter/feuchte.html (site in German) has some formulas. I went through them a long time ago to calculate the absolute humidity, but I totally forgot how I did it and I don't have the time to put this one into code too. You can try for yourself...
User avatar
FireWizard
Posts: 1905
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Looking for dewpoint

Post by FireWizard »

Hello @jkimmel,

As @rrozema already said, if you intend to use a combined temperature/humidity and/or barometer device, Domoticz will calculate the dew point itself.

However, if you have separated values and want to calculate the dew point yourself, in order to send it e.g to a "Custom sensor", called "Dew Point", you may find some useful information at: https://bmcnoldy.rsmas.miami.edu/Humidity.html
Especialy look to the "Spreadsheet-ready equations" and you will find the corrct formula.

I used it in a Node Red flow once, with the following Javascript code in a " Function" node.

Code: Select all

function dewpoint(T,RH) {
var TD = 243.04 * (Math.log(RH/100)+((17.625*T)/(243.04+T)))/(17.625-Math.log(RH/100)-((17.625*T)/(243.04+T)));
return TD;
}

msg.payload = {"command":"udevice","idx":13584,"nvalue":0,"svalue":dewpoint(msg.payload.temperature,msg.payload.humidity).toString()};
return msg;
Of course, you can use this formula in any script language, you prefer.

Regards
jkimmel
Posts: 129
Joined: Monday 25 November 2013 17:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Mallorca
Contact:

Re: Looking for dewpoint

Post by jkimmel »

rrozema wrote: Sunday 12 September 2021 7:48 Both on a temphum and a temperture, humidity, barometer device the property dewPoint is available (https://www.domoticz.com/wiki/DzVents:_ ... _scripting, then search for dewpoint)

If you've got a separate temperature and relative humidity value, you can theoretically calculate the dewpoint.http://www.wettermail.de/wetter/feuchte.html (site in German) has some formulas. I went through them a long time ago to calculate the absolute humidity, but I totally forgot how I did it and I don't have the time to put this one into code too. You can try for yourself...
My sensor delivers combined temp/humidity as well as two separate values for temp and humidity.
Domoticz is calculating the dewpoint, see here:
Screenshot 2021-09-11 215514.jpg
Screenshot 2021-09-11 215514.jpg (19.8 KiB) Viewed 1324 times
So i defined

Code: Select all

        local dewpoint = dz.devices(TEMPERATURE_SENSOR).dewPoint
and tried to log the value

Code: Select all

dz.log('Current dewpoint: ' .. dewpoint, dz.LOG_INFO)
and get the error

Code: Select all

2021-09-13 11:57:00.569 Error: dzVents: Error: (3.1.7) ...z/scripts/dzVents/generated_scripts/Klima Wohnzimmer.lua:52: attempt to concatenate a nil value (local 'dewpoint')
so dewpoint seems to be empty
Rfxcom
Raspi 4
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Looking for dewpoint

Post by rrozema »

Have you tried .dewPoint as per the documentation? Lua is case sensitive.
jkimmel
Posts: 129
Joined: Monday 25 November 2013 17:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Mallorca
Contact:

Re: Looking for dewpoint

Post by jkimmel »

rrozema wrote: Monday 13 September 2021 12:16 Have you tried .dewPoint as per the documentation? Lua is case sensitive.
As you can see above the local variable dewpoint is defined as

Code: Select all

local dewpoint = dz.devices(TEMPERATURE_SENSOR).dewPoint
So case sensitivity is considered
Rfxcom
Raspi 4
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Looking for dewpoint

Post by rrozema »

Code: Select all

local TEMPERATURE_SENSOR = 'Woonkamer: TempHum'

return {
	on = {
	    timer = {
	        'every minute'
	       }
	},
	logging = {
		level = domoticz.LOG_INFO,
		marker = 'test',
	},
	execute = function(domoticz, device)
	    local sensor_device = domoticz.devices(TEMPERATURE_SENSOR)
	    
	    if nil == sensor_device then
	        domoticz.log('Device ' .. TEMPERATURE_SENSOR .. ' not found.', domoticz.LOG_ERROR)
	    else
	        local dewpoint = sensor_device.dewPoint
	        
	        domoticz.log('"' .. sensor_device.name .. '" : ' .. sensor_device.deviceType .. ', dewpoint = ' .. tostring(dewpoint) .. '.', domoticz.LOG_ERROR)

	        sensor_device.dump()
	    end
	end
}
Please try the above. It should not give the previous error. instead this either lists the dewpoint value or the message that your device was not found. Given of course you change the name in the top of the script to the name of your temphum sensor. Plus, it dumps all of your sensor's properties so you can check their value.

For me the output is:
Spoiler: show
2021-09-13 20:32:01.723 Status: dzVents: Info: test: ------ Start internal script: Script #8:, trigger: "every minute"
2021-09-13 20:32:01.724 Status: dzVents: device> _nValue: 0
2021-09-13 20:32:01.724 Status: dzVents: device> switchTypeValue: 0
2021-09-13 20:32:01.724 Status: dzVents: device> hardwareName: zwave
2021-09-13 20:32:01.724 Status: dzVents: device> hardwareId: 5
2021-09-13 20:32:01.725 Status: dzVents: device> hardwareTypeValue: 21
2021-09-13 20:32:01.725 Status: dzVents: device> switchType: On/Off
2021-09-13 20:32:01.725 Status: dzVents: device> name: Woonkamer: TempHum
2021-09-13 20:32:01.725 Status: dzVents: device> humidityStatus: Comfortable
2021-09-13 20:32:01.725 Status: dzVents: device> baseType: device
2021-09-13 20:32:01.725 Status: dzVents: device> active: false
2021-09-13 20:32:01.725 Status: dzVents: device> inActive: true
2021-09-13 20:32:01.725 Status: dzVents: device> deviceType: Temp + Humidity
2021-09-13 20:32:01.725 Status: dzVents: device> idx: 73
2021-09-13 20:32:01.725 Status: dzVents: device> unit: 0
2021-09-13 20:32:01.725 Status: dzVents: device> protected: false
2021-09-13 20:32:01.725 Status: dzVents: device> changed: false
2021-09-13 20:32:01.725 Status: dzVents: device> sValue: 24.5;54;1
2021-09-13 20:32:01.725 Status: dzVents: device> hardwareID: 5
2021-09-13 20:32:01.725 Status: dzVents: device> rawData:
2021-09-13 20:32:01.725 Status: dzVents: device> 1: 24.5
2021-09-13 20:32:01.725 Status: dzVents: device> 2: 54
2021-09-13 20:32:01.725 Status: dzVents: device> 3: 1
2021-09-13 20:32:01.725 Status: dzVents: device> batteryLevel: 100
2021-09-13 20:32:01.725 Status: dzVents: device> _adapters:
2021-09-13 20:32:01.726 Status: dzVents: device> 1: Temperature+humidity device adapter
2021-09-13 20:32:01.726 Status: dzVents: device> isTimer: false
2021-09-13 20:32:01.726 Status: dzVents: device> description:
2021-09-13 20:32:01.726 Status: dzVents: device> _state: 24.5;54;1
2021-09-13 20:32:01.726 Status: dzVents: device> id: 73
2021-09-13 20:32:01.726 Status: dzVents: device> icon: temperature
2021-09-13 20:32:01.726 Status: dzVents: device> signalLevel: 12
2021-09-13 20:32:01.726 Status: dzVents: device> isSecurity: false
2021-09-13 20:32:01.726 Status: dzVents: device> isGroup: false
2021-09-13 20:32:01.726 Status: dzVents: device> humidityStatusValue: 1
2021-09-13 20:32:01.726 Status: dzVents: device> _data:
2021-09-13 20:32:01.726 Status: dzVents: device> subType: WTGR800
2021-09-13 20:32:01.726 Status: dzVents: device> baseType: device
2021-09-13 20:32:01.726 Status: dzVents: device> protected: false
2021-09-13 20:32:01.726 Status: dzVents: device> switchType: On/Off
2021-09-13 20:32:01.726 Status: dzVents: device> image:
2021-09-13 20:32:01.726 Status: dzVents: device> timedOut: false
2021-09-13 20:32:01.726 Status: dzVents: device> switchTypeValue: 0
2021-09-13 20:32:01.726 Status: dzVents: device> description:
2021-09-13 20:32:01.726 Status: dzVents: device> id: 73
2021-09-13 20:32:01.726 Status: dzVents: device> changed: false
2021-09-13 20:32:01.727 Status: dzVents: device> lastUpdate: 2021-09-13 20:28:37
2021-09-13 20:32:01.727 Status: dzVents: device> iconNumber: 200
2021-09-13 20:32:01.727 Status: dzVents: device> batteryLevel: 100
2021-09-13 20:32:01.727 Status: dzVents: device> rawData:
2021-09-13 20:32:01.727 Status: dzVents: device> 1: 24.5
2021-09-13 20:32:01.727 Status: dzVents: device> 2: 54
2021-09-13 20:32:01.727 Status: dzVents: device> 3: 1
2021-09-13 20:32:01.727 Status: dzVents: device> data:
2021-09-13 20:32:01.727 Status: dzVents: device> _state: 24.5;54;1
2021-09-13 20:32:01.727 Status: dzVents: device> hardwareName: zwave
2021-09-13 20:32:01.727 Status: dzVents: device> humidityStatus: Comfortable
2021-09-13 20:32:01.727 Status: dzVents: device> hardwareType: OpenZWave USB
2021-09-13 20:32:01.727 Status: dzVents: device> icon: temperature
2021-09-13 20:32:01.727 Status: dzVents: device> protected: false
2021-09-13 20:32:01.727 Status: dzVents: device> hardwareTypeValue: 21
2021-09-13 20:32:01.727 Status: dzVents: device> hardwareID: 5
2021-09-13 20:32:01.727 Status: dzVents: device> dewPoint: 14.590000152588
2021-09-13 20:32:01.727 Status: dzVents: device> customImage: 0
2021-09-13 20:32:01.727 Status: dzVents: device> humidity: 54
2021-09-13 20:32:01.728 Status: dzVents: device> temperature: 24.5
2021-09-13 20:32:01.728 Status: dzVents: device> _nValue: 0
2021-09-13 20:32:01.728 Status: dzVents: device> unit: 0
2021-09-13 20:32:01.728 Status: dzVents: device> signalLevel: 12
2021-09-13 20:32:01.728 Status: dzVents: device> deviceType: Temp + Humidity
2021-09-13 20:32:01.728 Status: dzVents: device> name: Woonkamer: TempHum
2021-09-13 20:32:01.728 Status: dzVents: device> lastLevel: 0
2021-09-13 20:32:01.728 Status: dzVents: device> deviceID: 9985
2021-09-13 20:32:01.728 Status: dzVents: device> isVariable: false
2021-09-13 20:32:01.728 Status: dzVents: device> timedOut: false
2021-09-13 20:32:01.728 Status: dzVents: device> isHTTPResponse: false
2021-09-13 20:32:01.728 Status: dzVents: device> nValue: 0
2021-09-13 20:32:01.728 Status: dzVents: device> deviceId: 9985
2021-09-13 20:32:01.728 Status: dzVents: device> hardwareType: OpenZWave USB
2021-09-13 20:32:01.728 Status: dzVents: device> lastUpdate: 2021-09-13 20:28:37
2021-09-13 20:32:01.728 Status: dzVents: device> customImage: 0
2021-09-13 20:32:01.728 Status: dzVents: device> dewPoint: 14.590000152588
2021-09-13 20:32:01.729 Status: dzVents: device> deviceSubType: WTGR800
2021-09-13 20:32:01.729 Status: dzVents: device> temperature: 24.5
2021-09-13 20:32:01.729 Status: dzVents: device> bState: false
2021-09-13 20:32:01.729 Status: dzVents: device> isScene: false
2021-09-13 20:32:01.729 Status: dzVents: device> humidity: 54
2021-09-13 20:32:01.729 Status: dzVents: device> state: 24.5;54;1
2021-09-13 20:32:01.729 Status: dzVents: device> isHardware: false
2021-09-13 20:32:01.729 Status: dzVents: device> isDevice: true
2021-09-13 20:32:01.729 Status: dzVents: Info: test: ------ Finished Script #8
2021-09-13 20:32:01.724 Error: dzVents: Error: (3.1.7) test: "Woonkamer: TempHum" : Temp + Humidity, dewpoint = 14.590000152588.
User avatar
waltervl
Posts: 5893
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Looking for dewpoint

Post by waltervl »

rrozema wrote: Monday 13 September 2021 20:30
Please try the above. It should not give the previous error. instead this either lists the dewpoint value or the message that your device was not found. Given of course you change the name in the top of the script to the name of your temphum sensor. Plus, it dumps all of your sensor's properties so you can check their value.
Works for me too:
2021-09-13 21:08:00.517 Error: dzVents: Error: (3.1.7) test: "Buiten TempHumBaro" : Temp + Humidity + Baro, dewpoint = 11.939999580383.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest