-
Notifications
You must be signed in to change notification settings - Fork 0
/
barometer.lua
34 lines (25 loc) · 877 Bytes
/
barometer.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- Barometer dzVents Script
-- Martin Saidl (c) 2022
-- current version of script
local version = '0.1'
-- Source devices
local Outside_Temp = 'Venkovní teplota'
local Barometer_ABS = 'Barometr (abs) - BMP'
-- Destination device
local Barometer_REL = 'Barometr (rel) - BMP'
-- Elevation
local Elev = 490
return {
on = {
devices = { Barometer_ABS }
},
execute = function(domoticz, device)
tempC = domoticz.devices(Outside_Temp).temperature
pressA = domoticz.devices(Barometer_ABS).barometer
-- some Arduino lib formula
-- pressR = domoticz.utils.round((pressA * 9.80665 * Elev) / (287 * (273 + tempC + (Elev / 400))) + pressA, 1)
-- ICAO formula
pressR = domoticz.utils.round(pressA / ((273.15 + tempC - 0.0065 * Elev) / (273.15 + tempC))^5.255, 1)
domoticz.devices(Barometer_REL).updateBarometer(pressR)
end
}