i would like to run a time based script to read a barometer from a Esp8266 sensor every hour not sure how to read the sensor
time = os.date("*t")
commandArray = {}
mtAT = devicechanged_svalues['ESPO_bar']
print('####TEST DEBUG: '.. mtAT)
LAU to read barometer at x:20
Moderator: leecollings
-
- Posts: 17
- Joined: Sunday 28 February 2016 23:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
- jvdz
- Posts: 2335
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: LAU to read barometer at x:20
What do you mean with: "not sure how to read the sensor"? Is the sensor data already available in Domoticz?
If so then the devicechanged_svalues[] table is wrong as that table doesn't exists (see here). You need to use the otherdevices_svalues[] table.
To execute the logic only one time each hour you could do:
Jos
If so then the devicechanged_svalues[] table is wrong as that table doesn't exists (see here). You need to use the otherdevices_svalues[] table.
To execute the logic only one time each hour you could do:
Code: Select all
-- Time to run?
time = os.date("*t")
if (time.min == 0) then
mtAT = otherdevices_svalues['ESPO_bar']
print('####TEST DEBUG: '.. mtAT)
end
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 17
- Joined: Sunday 28 February 2016 23:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: LAU to read barometer at x:20
sorry - I have an esp8266 set-up as a sensor sending data into Domoticz every few minutes into a virtual sensor. I wanted to setup alerting. Blocky can do it but it is not very neat so I just wanted to create a timed notification to take the value from the virtual sensor and then create the alert.
Your suggested code snipet fixed my issue perfectly
time = os.date("*t")
if time.min == 47 then
espBarReading = otherdevices_svalues['ESPO_bar']
print('####TEST DEBUG Barometer Reading:: '.. espBarReading)
commandArray['SendNotification']='Barometer Reading: '.. espBarReading
end
Your suggested code snipet fixed my issue perfectly

time = os.date("*t")
if time.min == 47 then
espBarReading = otherdevices_svalues['ESPO_bar']
print('####TEST DEBUG Barometer Reading:: '.. espBarReading)
commandArray['SendNotification']='Barometer Reading: '.. espBarReading
end
Who is online
Users browsing this forum: No registered users and 1 guest