Page 1 of 1
Send temperature by email with blockly script
Posted: Friday 15 February 2019 14:48
by julien92
Hi all,
I’m a newbie this Domoticz and would like to send the external temperature by email every hour, via a blockly script.
In order to manage this, I’m wondering how :
- Get the value of the temperature and put it into a variable
- Send the content of this variable within an email
Could you please help me to achieve this? (I hope without needing to use LUA script, which I don’t know at all
Thanks a lot in advance.
Julien
Re: Send temperature by email with blockly script
Posted: Saturday 16 February 2019 12:36
by Xenomes
Try this is email blocky Temperatuur = {{temperaturedevice[273]}}
Re: Send temperature by email with blockly script
Posted: Saturday 16 February 2019 16:06
by julien92
Hi,
I've managed to get the temperature and put it into a variable :
Code: Select all
temp_ext=$(curl -s 'http://192.168.1.45:8082/json.htm?type=devices&rid=59' | awk -F "\"" '/Data/ {print $4}')
IDX 59 being my temperature sensor
When I type :
It displays the temperature.
BUT when putting it into a shell script, that does not work, and I can't figure out why :
Code: Select all
sudo nano /home/pi/scripts/get_sensors_values.sh
Code: Select all
#!/bin/bash
temp_ext=$(curl -s 'http://192.168.1.45:8082/json.htm?type=devices&rid=59' | awk -F "\"" '/Data/ {print $4}')
Code: Select all
sudo chmod +x /home/pi/scripts/get_sensors_values.sh
I then execute the script :
And when typing :
It does not display the
last temperature.
Does anybody have any idea how I could fix this?
Once I will have solved that, I still need to figure out how to put this variable within a blockly script, in order to send it by email.
Julien
Re: Send temperature by email with blockly script
Posted: Saturday 16 February 2019 19:43
by julien92
I'm still answering to myself :
The script needs to be launched with source command :
or
It's working fine like this.
Now I just need to know how to make this variable useable by domoticz, so that I can use this variable within an email sent by a blockly script.
I'm still looking for that...