Python script for Netatmo weather station
Moderator: leecollings
-
- Posts: 41
- Joined: Tuesday 11 February 2014 18:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
Hi cp9999,
Sorry for late response too.
All is working nice.
Only one thing : the barometer (type 83) isn't exist anymore in Domoticz (don't know why).
I create a 243/9 type/subtype device that can store value in Bar (pressure). But it's not a weather sensor, but a generic measure sensor.
My question : is it possible that you modify the script to store temp, humidity and pressure in one combinated weather device (type 84/1) in domoticz?
(And for external Temp/humidity of aditionnal module, we can do the same and store temp/humidity in a combinated temp/humidity domoticz sensor)
What do you think about it?
Sorry for late response too.
All is working nice.
Only one thing : the barometer (type 83) isn't exist anymore in Domoticz (don't know why).
I create a 243/9 type/subtype device that can store value in Bar (pressure). But it's not a weather sensor, but a generic measure sensor.
My question : is it possible that you modify the script to store temp, humidity and pressure in one combinated weather device (type 84/1) in domoticz?
(And for external Temp/humidity of aditionnal module, we can do the same and store temp/humidity in a combinated temp/humidity domoticz sensor)
What do you think about it?
-
- Posts: 5
- Joined: Thursday 28 August 2014 18:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
Hi everybody,
I just start with home automation, i bought a raspberry B+ and i have installed domoticz.
i'm trying to connect my netatmo to my domoticz interface.
Can you tell me if is possible to see noise information send by netatmo?what is her dev_type and dev_subtype?
thank you
I just start with home automation, i bought a raspberry B+ and i have installed domoticz.
i'm trying to connect my netatmo to my domoticz interface.
Can you tell me if is possible to see noise information send by netatmo?what is her dev_type and dev_subtype?
thank you
-
- Posts: 41
- Joined: Tuesday 11 February 2014 18:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
No, there is not yet noise device in domoticz.. 
But if someone with Python skills want to add a domoticz user variable...
You can copy the beginning of each line in xml setting file :
<device data_type="Temperature" domoticz_dev_id="90001" domoticz_dev_subtype="10" domoticz_dev_type="80" ...
<device data_type="Co2" domoticz_dev_id="90004" domoticz_dev_subtype="0" domoticz_dev_type="249" ...
<device data_type="Humidity" domoticz_dev_id="90002" domoticz_dev_subtype="0" domoticz_dev_type="81" ...
<device data_type="Noise" domoticz_dev_id="" domoticz_dev_subtype="" domoticz_dev_type="" ...
<device data_type="Pressure" domoticz_dev_id="90013" domoticz_dev_subtype="9" domoticz_dev_type="243" ...
<device data_type="Temperature" domoticz_dev_id="90011" domoticz_dev_subtype="10" domoticz_dev_type="80" ...
<device data_type="Humidity" domoticz_dev_id="90012" domoticz_dev_subtype="0" domoticz_dev_type="81" ...

But if someone with Python skills want to add a domoticz user variable...

You can copy the beginning of each line in xml setting file :
<device data_type="Temperature" domoticz_dev_id="90001" domoticz_dev_subtype="10" domoticz_dev_type="80" ...
<device data_type="Co2" domoticz_dev_id="90004" domoticz_dev_subtype="0" domoticz_dev_type="249" ...
<device data_type="Humidity" domoticz_dev_id="90002" domoticz_dev_subtype="0" domoticz_dev_type="81" ...
<device data_type="Noise" domoticz_dev_id="" domoticz_dev_subtype="" domoticz_dev_type="" ...
<device data_type="Pressure" domoticz_dev_id="90013" domoticz_dev_subtype="9" domoticz_dev_type="243" ...
<device data_type="Temperature" domoticz_dev_id="90011" domoticz_dev_subtype="10" domoticz_dev_type="80" ...
<device data_type="Humidity" domoticz_dev_id="90012" domoticz_dev_subtype="0" domoticz_dev_type="81" ...
-
- Posts: 5
- Joined: Thursday 28 August 2014 18:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
ok thank you for your help fwehrie.
I'm looking for a list with all dev_type and subtype, do you know if that exist?
I'm looking in this forum and the wiki but I don't find.
I'm looking for a list with all dev_type and subtype, do you know if that exist?
I'm looking in this forum and the wiki but I don't find.
-
- Posts: 41
- Joined: Tuesday 11 February 2014 18:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
You're welcome.
Here is all what I found : http://www.domoticz.com/wiki/Domoticz_A ... ual_Sensor
Here is all what I found : http://www.domoticz.com/wiki/Domoticz_A ... ual_Sensor
-
- Posts: 5
- Joined: Thursday 28 August 2014 18:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
I have retored domoticz and now I can't run netatmo.py
I have this message:
pi@domoticzpi ~/domoticz/scripts $ python ./netatmo.py
-bash: python: command not found
Please,anybody can help me?
EDIT:
finally I had to reinstall python, and everything is back ok
I have this message:
pi@domoticzpi ~/domoticz/scripts $ python ./netatmo.py
-bash: python: command not found
Please,anybody can help me?
EDIT:
finally I had to reinstall python, and everything is back ok
-
- Posts: 1
- Joined: Wednesday 08 October 2014 8:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
Hi,
I've a little problem with the scrip execution :
I've tried Python 2 and 3 but this is not what cause the problem...
Anyone with this problem on access_token key ?
I've a little problem with the scrip execution :
Code: Select all
Traceback (most recent call last):
File "netatmo.py", line 530, in <module>
main()
File "netatmo.py", line 524, in main
token = GetToken()
File "netatmo.py", line 228, in GetToken
token = LoadToken()
File "netatmo.py", line 224, in LoadToken
return RequestToken()
File "netatmo.py", line 199, in RequestToken
return CreateToken(json_data)
File "netatmo.py", line 162, in CreateToken
newtoken.set(TOKEN_ATTR_ACCESS_TOKEN, json_decoded[TOKEN_ATTR_ACCESS_TOKEN])
KeyError: 'access_token'
Anyone with this problem on access_token key ?
- krazny
- Posts: 27
- Joined: Saturday 01 November 2014 23:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Netherlands
- Contact:
Re: Python script for Netatmo weather station
Did you create an account @ Netatmo website (https://dev.netatmo.com/) and added the token ID's to the settings file?wifsimster wrote:Hi,
I've a little problem with the scrip execution :
I've tried Python 2 and 3 but this is not what cause the problem...Code: Select all
Traceback (most recent call last): File "netatmo.py", line 530, in <module> main() File "netatmo.py", line 524, in main token = GetToken() File "netatmo.py", line 228, in GetToken token = LoadToken() File "netatmo.py", line 224, in LoadToken return RequestToken() File "netatmo.py", line 199, in RequestToken return CreateToken(json_data) File "netatmo.py", line 162, in CreateToken newtoken.set(TOKEN_ATTR_ACCESS_TOKEN, json_decoded[TOKEN_ATTR_ACCESS_TOKEN]) KeyError: 'access_token'
Anyone with this problem on access_token key ?
Raspberry Pi, Aeon Z-Stick, Fibaro Motion Sensor, 4x Fibaro Wall Plug, 2x Fibaro Dimmer, Netatmo Weatherstation
- krazny
- Posts: 27
- Joined: Saturday 01 November 2014 23:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Netherlands
- Contact:
Re: Python script for Netatmo weather station
I have a little problem of my own;
When I run the script the "Netatmo_Settings.xml" file isn't updated with the device ID's.
My steps;
1. Installed python (sudo apt-get install python)
2. Enabled the Netatmo API (https://dev.netatmo.com/dev/)
3. Created the netatmo.py and the netatmo_settings.xml file and enabled execution rights. (/home/pi/domoticz/scripts)
4. Added the Netatmo Token and ID's to the netatmo_settings.xml file.
5. run the netatmo.py script. (python netatmo.py)
edit:
I get the error below:
It doesnt...
What am I doing wrong?
The tutorial says it won't add the device ID's when your token etc aren't correct. They are 100% correct.
I'm stuck...
When I run the script the "Netatmo_Settings.xml" file isn't updated with the device ID's.
My steps;
1. Installed python (sudo apt-get install python)
2. Enabled the Netatmo API (https://dev.netatmo.com/dev/)
3. Created the netatmo.py and the netatmo_settings.xml file and enabled execution rights. (/home/pi/domoticz/scripts)
4. Added the Netatmo Token and ID's to the netatmo_settings.xml file.
5. run the netatmo.py script. (python netatmo.py)
edit:
I get the error below:
As far as I can understand the Netatmo_Settings.xml file should now contain the Device ID's of my netatmo hardware?pi@domoticzpi ~/domoticz/scripts $ python netatmo.py
File "netatmo.py", line 504
Log("Error in HandleDevices")
^
IndentationError: unindent does not match any outer indentation level
It doesnt...
What am I doing wrong?
The tutorial says it won't add the device ID's when your token etc aren't correct. They are 100% correct.
I'm stuck...

Raspberry Pi, Aeon Z-Stick, Fibaro Motion Sensor, 4x Fibaro Wall Plug, 2x Fibaro Dimmer, Netatmo Weatherstation
-
- Posts: 3
- Joined: Sunday 16 November 2014 12:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
Hi,
I have edited the python code so that it now can work with the combined Temperature/Humidity/Barometer, and Temperature/Humidity sensor type.
The netatmo.py and netatmo_settings.xml are in the following zip file.
The settings file is included as an exampe, the netatmo.py will auto generate it, but it needs some editing before it will work. Procedure is the same as in the first post. The Domoticz_dev_type should be copied as it is in the included xml file.
https://www.dropbox.com/s/71jvdm7k7ufx2 ... o.zip?dl=0
Regards,
Hertog
I have edited the python code so that it now can work with the combined Temperature/Humidity/Barometer, and Temperature/Humidity sensor type.
The netatmo.py and netatmo_settings.xml are in the following zip file.
The settings file is included as an exampe, the netatmo.py will auto generate it, but it needs some editing before it will work. Procedure is the same as in the first post. The Domoticz_dev_type should be copied as it is in the included xml file.
https://www.dropbox.com/s/71jvdm7k7ufx2 ... o.zip?dl=0
Regards,
Hertog
-
- Posts: 41
- Joined: Tuesday 11 February 2014 18:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
Nice,
Thank you. I'll try it asap.
Do you think it's possible to modify the python script to add Noise Level ? Maybe in a variable or something else...
Thank you. I'll try it asap.
Do you think it's possible to modify the python script to add Noise Level ? Maybe in a variable or something else...
-
- Posts: 3
- Joined: Sunday 16 November 2014 12:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
I'm kind of stuck with the types that Domoticz supplies itself, and noise isn't one of them. The obious way to implement the full range of possibilities (and make the configuration easier) would be to implement the netatmo natively to domoticz, but since my C++-foo isn't that strong, I wouldn't hold my breath for that 
One thing I would like to implement in the current python version is the battery level and signal strength. The data is all there, it's just a matter of appending them to the curl call to domoticz. As soon as I see a way to get the noise data into domoticz I'll add it.
edit: forecasts are also on the todo list. This data is also provided by netatmo, why not use it

One thing I would like to implement in the current python version is the battery level and signal strength. The data is all there, it's just a matter of appending them to the curl call to domoticz. As soon as I see a way to get the noise data into domoticz I'll add it.
edit: forecasts are also on the todo list. This data is also provided by netatmo, why not use it

-
- Posts: 41
- Joined: Tuesday 11 February 2014 18:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
Good ideas.
We can also ask for the adding of a dummy sensor for noise...
We can also ask for the adding of a dummy sensor for noise...

-
- Posts: 8
- Joined: Wednesday 26 November 2014 11:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
All the steps
0. Download the netatmo.py and the netatmo_settings.xml from http://www.domoticz.com/forum/download/file.php?id=785
1. Installed python on Rpi
2. Enabled the Netatmo API https://dev.netatmo.com/dev/
3. Create one Virtual hardware device in domoticz and use that hardware id for the Netatmo devices
Add 192.168.X.X:8080/json.htm?type=command¶m=addhardware&htype=15&port=1&name=NetAtmo&enabled=true
Check ID 192.168.X.X:8080/json.htm?type=hardware 4. Edit netatmo_settings.xml with Notepad++
YOUR_CLIENT_ID
YOUR_CLIENT_SECRET
YOUR_PASSWORD
YOUR_USERNAME
Check ID 192.168.X.X:8080/json.htm?type=hardware hardware_id="XXX" - my case "2"
url="http://127.0.0.1:8080"
5. Copy by WINSCP to Rpi (domoticz/scripts) or another solution the files netatmo.py and the netatmo_settings.xml
6. Enabled execution rights. and
7. Now run the script once.
9. Edit netatmo_settings.xml
For the domoticz_dev_id="" we can add any number (XXXX) that is not yet taken in Domoticz - Devices 192.168.X.X:8080/#/Devices
10. Run after 5 minutes and
11. Check in Domoticz - Devices 192.168.X.X:8080/#/Devices
For the Humidity sensors the ID is changed but keep it like that.
12. Add in CRON
#ADD
Maybe you need this also.
0. Download the netatmo.py and the netatmo_settings.xml from http://www.domoticz.com/forum/download/file.php?id=785
1. Installed python on Rpi
Code: Select all
sudo apt-get install python
3. Create one Virtual hardware device in domoticz and use that hardware id for the Netatmo devices
Add 192.168.X.X:8080/json.htm?type=command¶m=addhardware&htype=15&port=1&name=NetAtmo&enabled=true
Check ID 192.168.X.X:8080/json.htm?type=hardware 4. Edit netatmo_settings.xml with Notepad++
YOUR_CLIENT_ID
YOUR_CLIENT_SECRET
YOUR_PASSWORD
YOUR_USERNAME
Check ID 192.168.X.X:8080/json.htm?type=hardware hardware_id="XXX" - my case "2"
url="http://127.0.0.1:8080"
5. Copy by WINSCP to Rpi (domoticz/scripts) or another solution the files netatmo.py and the netatmo_settings.xml
6. Enabled execution rights.
Code: Select all
cd domoticz/scripts
Code: Select all
chmod +x ./netatmo.py
Code: Select all
python netatmo.py
Code: Select all
nano netatmo_settings.xml
Code: Select all
<device data_type="Temperature" domoticz_dev_id="90001" domoticz_dev_subtype="10" domoticz_dev_type="80" ...
<device data_type="Co2" domoticz_dev_id="90002" domoticz_dev_subtype="0" domoticz_dev_type="249" ...
<device data_type="Humidity" domoticz_dev_id="90003" domoticz_dev_subtype="0" domoticz_dev_type="81" ...
<device data_type="Noise" domoticz_dev_id="" domoticz_dev_subtype="" domoticz_dev_type="" ...
<device data_type="Pressure" domoticz_dev_id="90004" domoticz_dev_subtype="9" domoticz_dev_type="243" ...
<device data_type="Temperature" domoticz_dev_id="90005" domoticz_dev_subtype="10" domoticz_dev_type="80" ...
<device data_type="Humidity" domoticz_dev_id="90006" domoticz_dev_subtype="0" domoticz_dev_type="81" ...
Code: Select all
cd
Code: Select all
python /home/pi/domoticz/scripts/netatmo.py
12. Add in CRON
Code: Select all
sudo crontab -e
Code: Select all
*/5 * * * * python /home/pi/domoticz/scripts/netatmo.py &
Maybe you need this also.
Code: Select all
sudo service domoticz.sh start
-
- Posts: 8
- Joined: Wednesday 26 November 2014 11:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
COOO it is created by virtual hardware and then Air quality.
-
- Posts: 8
- Joined: Wednesday 26 November 2014 11:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
Hertog wrote:I'm kind of stuck with the types that Domoticz supplies itself, and noise isn't one of them. The obious way to implement the full range of possibilities (and make the configuration easier) would be to implement the netatmo natively to domoticz, but since my C++-foo isn't that strong, I wouldn't hold my breath for that
One thing I would like to implement in the current python version is the battery level and signal strength. The data is all there, it's just a matter of appending them to the curl call to domoticz. As soon as I see a way to get the noise data into domoticz I'll add it.
edit: forecasts are also on the todo list. This data is also provided by netatmo, why not use it
Will be nice!
-
- Posts: 3
- Joined: Sunday 16 November 2014 12:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
I'm afraid that is not possible without changing domoticz itself, not sure though, I'll have a look through the C++ code.box18 wrote:Is it possible by script to change the name of "Unknown" to "Netatmo"like in image?
COOO it is created by virtual hardware and then Air quality.
-
- Posts: 8
- Joined: Wednesday 26 November 2014 11:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
Hi Hertog,
How it is the stage for battery level, signal strength. noise sensor, forecasts, etc from Netatmo? That will be a great great idea... We can talk with Domoticz to add it in Hardware...
How it is the stage for battery level, signal strength. noise sensor, forecasts, etc from Netatmo? That will be a great great idea... We can talk with Domoticz to add it in Hardware...
box18 wrote:Hertog wrote:I'm kind of stuck with the types that Domoticz supplies itself, and noise isn't one of them. The obious way to implement the full range of possibilities (and make the configuration easier) would be to implement the netatmo natively to domoticz, but since my C++-foo isn't that strong, I wouldn't hold my breath for that
One thing I would like to implement in the current python version is the battery level and signal strength. The data is all there, it's just a matter of appending them to the curl call to domoticz. As soon as I see a way to get the noise data into domoticz I'll add it.
edit: forecasts are also on the todo list. This data is also provided by netatmo, why not use it
Will be nice!
-
- Posts: 8
- Joined: Wednesday 26 November 2014 11:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
Hello,
Who can help me to add in the Domoticz the absolute humidity (HS). After that will be easy to compare the quantity of water in the air exterior and interior and when it's the best time to open the windows...
My idea is like that:
I.Because there is already a nice an powerful script to take the data from Netatmo server, we can calculate the absolute humidity by taken the temperature, relative humidity, pressure:
1. The calculation of Psat = EXP(23,3265-(3802,7/(Temp_C+273,18))-(472,68/(Temp_C+273,18))^2)
2. The absolute humidity HS=(0,622*Psat*HR)/(PA-Psat*HR)*1000
Where:
PA = pressure [* 100] convert in Pa
RH = Relative Humidity [%] Ok
Psat = pressure of saturation [Pa]
Temp_C = Temperature [C]
HS= absolute humidity [g of water / Kg air]
II. Create some dummy virtual sensors and update them by python script from the results of our calculation. (HS of each rooms and exterior sensor).
P.S. ( If you want to know the quantity of water in the air of your room, you need to * by volume of the room (house)) * ~1,205722 kg/m3 (air mass at 20 C)
http://www.cactus2000.de/fr/unit/masshum.shtml
So, I need help in:
1. Take the variables Temp(ext & int), RH(ext & int), Pa in the script netatmo.py
2. Add the formulas
3. Create and update the HS virtual sensors in Domoticz.
I think the best way is to be add in the script netatmo.py to be done in the same time that it take the data.
One problem can be in Domoticz virtual sensor to add the unit. From the wiki site it support:
Who can help me to add in the Domoticz the absolute humidity (HS). After that will be easy to compare the quantity of water in the air exterior and interior and when it's the best time to open the windows...
My idea is like that:
I.Because there is already a nice an powerful script to take the data from Netatmo server, we can calculate the absolute humidity by taken the temperature, relative humidity, pressure:
1. The calculation of Psat = EXP(23,3265-(3802,7/(Temp_C+273,18))-(472,68/(Temp_C+273,18))^2)
2. The absolute humidity HS=(0,622*Psat*HR)/(PA-Psat*HR)*1000
Where:
PA = pressure [* 100] convert in Pa
RH = Relative Humidity [%] Ok
Psat = pressure of saturation [Pa]
Temp_C = Temperature [C]
HS= absolute humidity [g of water / Kg air]
II. Create some dummy virtual sensors and update them by python script from the results of our calculation. (HS of each rooms and exterior sensor).
P.S. ( If you want to know the quantity of water in the air of your room, you need to * by volume of the room (house)) * ~1,205722 kg/m3 (air mass at 20 C)
http://www.cactus2000.de/fr/unit/masshum.shtml
So, I need help in:
1. Take the variables Temp(ext & int), RH(ext & int), Pa in the script netatmo.py
2. Add the formulas
3. Create and update the HS virtual sensors in Domoticz.
I think the best way is to be add in the script netatmo.py to be done in the same time that it take the data.
One problem can be in Domoticz virtual sensor to add the unit. From the wiki site it support:
Maybe we can use 81 with 10 for decimals.1 Pressure (Bar) 0.0 nvalue=BAR (TBC)
2 Percentage 0.0 nvalue=PCT (TBC)
80 TEMP 0.0 svalue=TEMP
81 HUM 1 nvalue=HUM svalue=1 to 3
82 TEMP_HUM 0.0;50;1 svalue=TEMP;HUM;HUM_STATUS
84 TEMP_HUM_BARO 0.0;50;1;1010;1 svalue=TEMP;HUM;HUM_STATUS;BARO;BARO_FCST
85 RAIN 0;0 svalue=RAIN;Rain in mm/h
86 WIND 0;N;0;0;0;0 svalue=WIN_SPD;WIND_DIR;?;?;?;?
87 UV 0;0 svalue= (TBC)
113 RFXMeter 0 Can have several values, another order has to be sent to set the sub type:
type 2 Counter: svalue=COUNTER
type 3 Water: svalue=VOLUME
type 1 Gas:
type 0 Energy:
90 ENERGY 0;0.0 svalue=POWER;ENERGY
249 TypeAirQuality 0 nvalue=PPM
-
- Posts: 8
- Joined: Wednesday 26 November 2014 11:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python script for Netatmo weather station
I did it but Hum_out it is taken Humidity 96 % so will be an error
What are the jq comands or another command to take from the string "Humidity 96% the value 96....????
Same for Pa 1008.3 Pa and I need 1008.3 ????
If ai put these values manualy all are ok, the virtual sensor SetPoint are update
What are the jq comands or another command to take from the string "Humidity 96% the value 96....????
Same for Pa 1008.3 Pa and I need 1008.3 ????
If ai put these values manualy all are ok, the virtual sensor SetPoint are update
Code: Select all
#!/bin/bash
# Take the data from Domoticz
Temp_out=`curl "http://127.0.0.1:8080/json.htm?type=devices&rid=8" 2>/dev/null | jq -r .result[]."Temp"`
Temp_int=`curl "http://127.0.0.1:8080/json.htm?type=devices&rid=9" 2>/dev/null | jq -r .result[]."Temp"`
Hum_out=`curl "http://127.0.0.1:8080/json.htm?type=devices&rid=7" 2>/dev/null | jq -r .result[]."Data"`
Hum_int=`curl "http://127.0.0.1:8080/json.htm?type=devices&rid=10" 2>/dev/null | jq -r .result[]."Data"`
Pa=`curl "http://127.0.0.1:8080/json.htm?type=devices&rid=11" 2>/dev/null | jq -r .result[]."Data"`
#Calculation
#1. The calculation of Psat = EXP(23,3265-(3802,7/(Temp_C+273,18))-(472,68/(Temp_C+273,18))^2) [Pa]
#2. The absolute humidity HS=(0,622*Psat*HR)/(PA-Psat*HR)*1000 [geau/kg air sec]
#3. L'eau chambre volume [m3] * mass l'air [kg/m3] * HS[g/kg] = [g]
Psat_out=`echo "e(23.3265-(3802.7/($Temp_out+273.18))-(472.68/($Temp_out+273.18))^2)" | bc -l`
HS_out=`echo "(0.622*$Psat_out*$Hum_out/100)/($Pa*100-$Psat_out*$Hum_out/100)*1000" | bc -l`
Psat_int=`echo "e(23.3265-(3802.7/($Temp_int+273.18))-(472.68/($Temp_int+273.18))^2)" | bc -l`
HS_int=`echo "(0.622*$Psat_int*$Hum_int/100)/($Pa*100-$Psat_int*$Hum_int/100)*1000" | bc -l`
#Add the calcutation to virtual sensor
A1=`curl "http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=21&nvalue=0&svalue=$HS_out"`
A1=`curl "http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=24&nvalue=0&svalue=$HS_int"`
Who is online
Users browsing this forum: No registered users and 1 guest