
Hope you can take that beer now

Moderator: leecollings
I did changetrixwood wrote:And would you please censor you long and latitude...
Hope you can take that beer now
trixwood wrote:altitude, 4 degrees... It's almost nautical twilight...
still living in civil twilight
uhmm.. or is it the other way around... for you... (timezones
yes, i think so, -18 till nautical -6, -6 till 0 is civil twilight... so now it day at least at your end of the planet![]()
For me it's dinner time! Have a good day!
Code: Select all
temp, hum, uv, pres = otherdevices_svalues['Weather TempHumBaro']:match("([^;]+);([^;]+);([^;]+);([^;]+)")
relativePressure = tonumber(pres)
Code: Select all
2016-09-02 08:20:03.260 Error: EventSystem: in SunPositions: [string "-- Variables to customize -------------------..."]:137: bad argument #1 to 'gsub' (string expected, got nil)
Code: Select all
if string.find(synop,"Status: 500") == nil and synop ~= ''
then
rslt = split(synop,",")
CodeStation = rslt[1]
rslt = split(synop, " "..CodeStation.. " ")
Trame = string.gsub(rslt[2], "=", "")
Trame = CodeStation .." ".. Trame
rslt = split(Trame, " ")
Octa = string.sub(rslt[3], 1, 1) -- 3rd char is the cloud layer. 0=no cloud , 1-8= cloudy from 1 to 8 max , 9 =Fog , / = no data
if Octa == "/" then -- not defined ? take the previous value
Octa = uservariables['octa']
elseif Octa == "9" then
Octa = 8
end
else
Octa = uservariables['octa']
end
Code: Select all
script_time_SolarSensor.lua --[[ Virtual Lux sensor and other real-time solar data
--~/domoticz/scripts/lua/script_time_SolarSensor.lua
-- Autors ----------------------------------------------------------------
V1.0 - Sébastien Joly - Great original work
V1.1 - Neutrino - Adaptation to Domoticz
V1.2 - Jmleglise - An acceptable approximation of the lux below 1° altitude for Dawn and dusk + translation + several changes to be more userfriendly.
V1.3 - Jmleglise - keep the time of black night in lasptUpdate
]]--
-- Variables to customize ------------------------------------------------
local city = "Paris" -- Your city for Wunderground API <--- line 13 !!
local countryCode = "FR" -- Your country code for Wunderground API
local idxLux ='53' -- Your virtual Lux Device ID
local idxSolarAzimuth ='56' -- Your virtual Azimuth Device ID
local idxSolarAltitude ='55' -- Your virtual Solar Altitude Device ID
local idxUserVarOcta='1' -- Your user variable ID , named octa
local wuAPIkey = "08c125fa719956f9" -- Your Weather Underground API Key
local latitude = 48.575875 -- your home
local longitude = 7.731194 -- your home
local altitude = 141 -- Your home altitude : run once in debug = 1 to found your altitude in Log and write it here
local WMOID = '07190' -- Your nearest SYNOP Station for ogimet (to get Cloud layer). Run once with debug=1 to get it in the log. (or, better, choose it there : http://www.ogimet.com/gsynop_nav.phtml.en )
local DEBUG = 1 -- 0 , 1 for domoticz log , 2 for file log
-- and customize the URL of api.wunderground around line 104 according to your country.
-- Below , edit at your own risk ------------------------------------------
function leapYear(year)
return year%4==0 and (year%100~=0 or year%400==0)
end
....
There is a problem at the first line. Change it toArnaudStrasbourg wrote:I tried this code but it return an error : Files\Domoticz\scripts\lua\script_time_SolarSensor.lua:13: syntax error near 'local'
Code: Select all
--[[ Virtual Lux sensor and other real-time solar data
Code: Select all
if ((devicechanged['Lux']) then
...
end
Code: Select all
commandArray[indexArray] = {['UpdateDevice'] = idxLux..'|0|'..tostring(round(weightedLux,0))}
Code: Select all
commandArray[indexArray]={['OpenURL']="http://"..localhost.."/json.htm?type=command¶m=udevice&idx="..idxLux.."&nvalue=0&svalue="..tostring(round(weightedLux,0)) }
Code: Select all
local localhost = '127.0.0.1:8080'
Code: Select all
commandArray[indexArray] = {['Variable:octa'] = tostring(Octa)}
indexArray=indexArray+1
Code: Select all
commandArray[#commandArray + 1] = {['Variable:octa'] = tostring(Octa)}
Code: Select all
if (DEBUG == 1) then
local WMOID = jsonLocation.current_observation.display_location.wmo
end
Code: Select all
-- API Wunderground
local config=assert(io.popen('curl http://api.wunderground.com/api/'..wuAPIkey..'/conditions/q/'..countryCode..'/'..city..'.json'))
local location = config:read('*all')
config:close()
local jsonLocation = json:decode(location)
Thank you BakSeeDaa,BakSeeDaa wrote:There is a problem at the first line. Change it toArnaudStrasbourg wrote:I tried this code but it return an error : Files\Domoticz\scripts\lua\script_time_SolarSensor.lua:13: syntax error near 'local'Code: Select all
--[[ Virtual Lux sensor and other real-time solar data
Users browsing this forum: No registered users and 1 guest