Real-time solar data : azimuth, Altitude, Lux sensor... [closed]

Moderator: leecollings

ikariya
Posts: 3
Joined: Wednesday 01 February 2017 7:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by ikariya »

that was my project as optionnal. as house is passive and south oriented i absolutely need to cut off sun on summer or it overheats.

using azimuth i can prédict the hours to open on east or west sides when the sun has passed to increase the light level


Envoyé de mon iPhone en utilisant Tapatalk
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by Toulon7559 »

As upload to my 2 Meteo-pages at WUnderground I have the first upload with calculated info from the script and the second upload with measured values from an experimental BH1750-lightsensorsetup.
Look at the yellow graph-line at the bottom of the webpages.

[If the yellow line is not present in the graph, then do not blame the upload, because WUnderground has a peculiar way to deal with other uploads than the main stream for primary temperature, humidity, pressure and rainfall.
The 'holes' in the yellow graphline for PWS IOVERIJS70 are caused by another parallel upload-stream which has no light-info:
no info => 'hole' until next update (from any source)]
Last edited by Toulon7559 on Saturday 08 July 2017 22:08, edited 3 times in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
lepetitnicolas
Posts: 12
Joined: Wednesday 02 November 2016 22:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: South West of France
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by lepetitnicolas »

Hello,
I try this script yesterday and during the night it working very well but this morning i've got this error

Code: Select all

 2017-02-16 09:55:03.935 LUA: curl "http://www.ogimet.com/cgi-bin/getsynop?block=08027&begin=201702160700"
2017-02-16 09:55:06.797 LUA: ogimet:
2017-02-16 09:55:06.797 Error: EventSystem: in script_time_solar_data: [string "--[[ Virtual Lux sensor and other real-t..."]:150: bad argument #1 to 'gsub' (string expected, got nil)
when i try in Chrome, i've got no response to : http://www.ogimet.com/cgi-bin/getsynop? ... 1702160700

but when i change the hour like this : http://www.ogimet.com/cgi-bin/getsynop? ... 1702160500
it's work.....

someone can i help me ?
thanks
Raspberry Pi 3 - RFLink and Homewizard
lepetitnicolas
Posts: 12
Joined: Wednesday 02 November 2016 22:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: South West of France
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by lepetitnicolas »

now, it's working...... (ogimet 09h00)

Code: Select all

2017-02-16 11:25:10.629 LUA: curl "http://www.ogimet.com/cgi-bin/getsynop?block=08027&begin=201702160900"
2017-02-16 11:25:10.755 LUA: ogimet:08027,2017,02,16,09,00,AAXX 16094 08027 42581 72112 10134 20053 39993 40304 53004 81132==
2017-02-16 11:25:10.755 LUA: Station SYNOP = 08027
2017-02-16 11:25:10.755 LUA: 7 Octa
but it's stop working at 12h00..... (ogimet 10h00)

Code: Select all

2017-02-16 13:10:10.421 LUA: curl "http://www.ogimet.com/cgi-bin/getsynop?block=08027&begin=201702161100"
2017-02-16 13:10:10.551 LUA: ogimet:
2017-02-16 13:10:10.551 Error: EventSystem: in script_time_solar_data: [string "--[[ Virtual Lux sensor and other real-t..."]:150: bad argument #1 to 'gsub' (string expected, got nil)
Raspberry Pi 3 - RFLink and Homewizard
Misterik
Posts: 28
Joined: Sunday 11 December 2016 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by Misterik »

Thank you jmleglise for all your work. A great script even though I understand absolute nothing of that calculation. I had almost bought a lux meter, but now I'm going to see if this will work in combination with my lights.

Because I haven't collected any data, I was wondering what is a generally accepted lux value for turning on/off the light?

Edit: ok, first data is collected...less then 600 Lux will turn on my lamps :D
RPI-3 : RFLink + Zigbee2MQTT + Shelly + MySensors + Milight
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by Toulon7559 »

Wikipedia is your friend if looking for reference info, but switching on lightlevel is also a subjective matter, dependent on the activity on which you want to shed light.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Misterik
Posts: 28
Joined: Sunday 11 December 2016 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by Misterik »

Toulon7559 wrote:Wikipedia is your friend if looking for reference info, but switching on lightlevel is also a subjective matter, dependent on the activity on which you want to shed light.
Yes, I found that info off course, but in a script you need just one value...and I didn't know which value I had to pick. I use this only to set the switch 'it is dark' . This switch is then used in all the others scripts for my lamps in my house, and depending on the activity (home / not at home, waking up or in the evening watching TV) I am switching between several different light intensity and colours.
RPI-3 : RFLink + Zigbee2MQTT + Shelly + MySensors + Milight
Lebo2d9
Posts: 139
Joined: Tuesday 06 September 2016 20:39
Target OS: Raspberry Pi / ODroid
Domoticz version: L stab
Location: Belgium
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by Lebo2d9 »

Hi, the script wasn't working anymore for me.
When I checked the API url

http://api.wunderground.com/api/xxxxxxx ... ssels.json

I got this as responce

Code: Select all

{
  "response": {
  "version":"0.1",
  "termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
  "features": {
  "conditions": 1
  }
		, "results": [
		{
		"name": "Brussels",
		"city": "Brussels",
		"state": "BRU",
		"country": "BX",
		"country_iso3166":"BE",
		"country_name":"Belgium",
		"zmw": "00000.42.06447",
		"l": "/q/zmw:00000.42.06447"
		}
		,
		{
		"name": "Brussels",
		"city": "Brussels",
		"state": "IL",
		"country": "US",
		"country_iso3166":"US",
		"country_name":"Verenigde Staten",
		"zmw": "62013.1.99999",
		"l": "/q/zmw:62013.1.99999"
		}
		,
		{
		"name": "Brussels",
		"city": "Brussels",
		"state": "ON",
		"country": "CA",
		"country_iso3166":"CA",
		"country_name":"",
		"zmw": "00000.100.71261",
		"l": "/q/zmw:00000.100.71261"
		}
		,
		{
		"name": "Brussel",
		"city": "Brussel",
		"state": "VLG",
		"country": "BX",
		"country_iso3166":"BE",
		"country_name":"Belgium",
		"zmw": "00000.1.06451",
		"l": "/q/zmw:00000.1.06451"
		}
		,
		{
		"name": "Brussels",
		"city": "Brussels",
		"state": "WI",
		"country": "US",
		"country_iso3166":"US",
		"country_name":"Verenigde Staten",
		"zmw": "54204.1.99999",
		"l": "/q/zmw:54204.1.99999"
		}
		]
	}
}
Now i change manualy the url to

http://api.wunderground.com/api/xxxxxxx ... 06447.json

Now the response is back OK.

Code: Select all

{
  "response": {
  "version":"0.1",
  "termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
  "features": {
  "conditions": 1
  }
	}
  ,	"current_observation": {
		"image": {
		"url":"http://icons.wxug.com/graphics/wu2/logo_130x80.png",
		"title":"Weather Underground",
		"link":"http://www.wunderground.com"
		},
		"display_location": {
		"full":"Brussels, Belgium",
		"city":"Brussels",
		"state":"BRU",
		"state_name":"Belgium",
		"country":"BX",
		"country_iso3166":"BE",
		"zip":"00000",
		"magic":"42",
		"wmo":"06447",
		"latitude":"50.84999847",
		"longitude":"4.34999990",
		"elevation":"50.0"
		},
		"observation_location": {
		"full":"Rue des Halles, Saint-Gilles, ",
		"city":"Rue des Halles, Saint-Gilles",
		"state":"",
		"country":"BX",
		"country_iso3166":"BE",
		"latitude":"50.849998",
		"longitude":"4.350000",
		"elevation":"88 ft"
		},
		"estimated": {
		},
		"station_id":"ISAINTGI49",
		"observation_time":"Last Updated on maart 18, 8:24 PM CET",
		"observation_time_rfc822":"Sat, 18 Mar 2017 20:24:26 +0100",
		"observation_epoch":"1489865066",
		"local_time_rfc822":"Sat, 18 Mar 2017 20:33:03 +0100",
		"local_epoch":"1489865583",
		"local_tz_short":"CET",
		"local_tz_long":"Europe/Brussels",
		"local_tz_offset":"+0100",
		"weather":"Geheel bewolkt",
		"temperature_string":"52.7 F (11.5 C)",
		"temp_f":52.7,
		"temp_c":11.5,
		"relative_humidity":"85%",
		"wind_string":"From the WZW at 3.1 MPH Gusting to 12.4 MPH",
		"wind_dir":"WZW",
		"wind_degrees":258,
		"wind_mph":3.1,
		"wind_gust_mph":"12.4",
		"wind_kph":5.0,
		"wind_gust_kph":"20.0",
		"pressure_mb":"1011",
		"pressure_in":"29.86",
		"pressure_trend":"0",
		"dewpoint_string":"48 F (9 C)",
		"dewpoint_f":48,
		"dewpoint_c":9,
		"heat_index_string":"NA",
		"heat_index_f":"NA",
		"heat_index_c":"NA",
		"windchill_string":"NA",
		"windchill_f":"NA",
		"windchill_c":"NA",
		"feelslike_string":"52.7 F (11.5 C)",
		"feelslike_f":"52.7",
		"feelslike_c":"11.5",
		"visibility_mi":"6.2",
		"visibility_km":"10.0",
		"solarradiation":"--",
		"UV":"0","precip_1hr_string":"-999.00 in ( 0 mm)",
		"precip_1hr_in":"-999.00",
		"precip_1hr_metric":" 0",
		"precip_today_string":"0.09 in (2 mm)",
		"precip_today_in":"0.09",
		"precip_today_metric":"2",
		"icon":"cloudy",
		"icon_url":"http://icons.wxug.com/i/c/k/nt_cloudy.gif",
		"forecast_url":"http://www.wunderground.com/global/stations/06447.html",
		"history_url":"http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=ISAINTGI49",
		"ob_url":"http://www.wunderground.com/cgi-bin/findweather/getForecast?query=50.849998,4.350000",
		"nowcast":""
	}
}
Domoicz on RPI3 (wifi) directly connected 3x ds18b20 for CV temp, Evohome (9 zone), 1 remote 220V switch based on ESP-12. RFXtrx433E, 16x AMST-606, 5 Somfy RTS motors
Domoticz on RPI3(wifi) as slave for terraruim control
More to come
digimate
Posts: 19
Joined: Tuesday 02 February 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: lastbeta
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by digimate »

Hi,

Doesn't work for me also anymore.

Error (DEBUG = 0 ):
Error: EventSystem: in Virtual Lux sensor: [string " --[[ Virtual Lux sensor and other re..."]:74: attempt to index field 'current_observation' (a nil value)

Line 74:

Code: Select all

  relativePressure = jsonLocation.current_observation.pressure_mb   -- if you have an another way to get the Pressure, (local barometer ...) then you may optimize the script and avoid the call to api.wunderground)
----
Error (DEBUG = 1):
2017-03-19 12:40:03.481 Error: EventSystem: in Virtual Lux sensor: [string " --[[ Virtual Lux sensor and other re..."]:69: attempt to index field 'current_observation' (a nil value)

Line 69:

Code: Select all

          local latitude = jsonLocation.current_observation.display_location.latitude
Any suggestion (for me as noob ;-) to solve this is welcome.
Thanks in advance.
Synology DS716+. Domotica devices (on about 30): KaKu (and other 433MHz devices), Z-Wave, Mi-Light, Xiaomi.
L2v2P
Posts: 19
Joined: Sunday 29 November 2015 9:45
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by L2v2P »

First of all, thank you very much for all the work. I've implemented the script through the event editor in Domoticz and in that/my case the script was subsequently fired every second during a minute:

Code: Select all

[...]
2017-03-19 17:35:01.685  EventSystem: Fetching url...
2017-03-19 17:35:01.685  EventSystem: Fetching url...
2017-03-19 17:35:01.685  EventSystem: Fetching url...
2017-03-19 17:35:01.685  EventSystem: Script event triggered: Zonne-informatie
2017-03-19 17:35:02.738  EventSystem: Fetching url...
2017-03-19 17:35:02.738  EventSystem: Fetching url...
2017-03-19 17:35:02.738  EventSystem: Fetching url...
2017-03-19 17:35:02.738  EventSystem: Script event triggered: Zonne-informatie
2017-03-19 17:35:04.101  EventSystem: Fetching url...
2017-03-19 17:35:04.101  EventSystem: Fetching url...
2017-03-19 17:35:04.101  EventSystem: Fetching url...
2017-03-19 17:35:04.101  EventSystem: Script event triggered: Zonne-informatie
[And so on]
In order to fix this I changed the trigger part of the script from:

Code: Select all

if ((time.min % 5)==0) then
to:

Code: Select all

if ((time.min % 5)==0) and time.sec == 00 then
multinet
Posts: 97
Joined: Friday 05 December 2014 22:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by multinet »

Hello

The script was working like a charm before mid march. But now i've this error in log :
2017-03-24 10:05:00.570 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 10:10:03.800 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 10:15:01.111 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 10:20:00.748 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 10:25:00.879 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 10:30:03.987 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 10:35:00.869 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 10:40:00.969 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 10:45:03.898 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 10:50:00.874 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 10:55:00.968 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 11:00:16.426 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)
2017-03-24 11:05:00.710 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua: /home/pi/domoticz/scripts/lua/script_time_SolarSendor.lua:75: attempt to index field 'current_observation' (a nil value)

line 75 :

Code: Select all

 relativePressure = jsonLocation.current_observation.pressure_mb   -- if you have an another way to get the Pressure, (local barometer ...) then you may optimize the script and avoid the call to api.wunderground)

Here you have the url call to wundergroud

Code: Select all

http://api.wunderground.com/api/MYAPI not given here/conditions/q/FR/Merignac.json
and the result :
{
"response": {
"version":"0.1",
"termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
"features": {
"conditions": 1
}
, "results": [
{
"name": "Merignac",
"city": "Merignac",
"state": "16",
"country": "FR",
"country_iso3166":"FR",
"country_name":"France",
"zmw": "00000.180.07412",
"l": "/q/zmw:00000.180.07412"
}
,
{
"name": "Merignac",
"city": "Merignac",
"state": "33",
"country": "FR",
"country_iso3166":"FR",
"country_name":"France",
"zmw": "00000.433.07510",
"l": "/q/zmw:00000.433.07510"
}
]
}
}
I've taken the latest 1.4 script but I still have the problem

Can anyone help me ?

Multinet
PI 2 - Domoticz 2021.1
RFXCOM - RFXtrx433 USB 433.92MHz Transceiver (5 DIO 54755 + 2 DIO 54756 + 3 DIO 54798)
Z-Wave.Me ZME_UZB1 USB Stick (6 FGSD002 + 2 FGRM222 + 1 FGS223 + 1 FGMS001-ZW5 + 1 FGRGBWM441 + 1 FGBS001 + 2 FGFS101)
6 sondes DS18B20
multinet
Posts: 97
Joined: Friday 05 December 2014 22:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by multinet »

Ok if I change the City to Bordeaux (nearest big city from mine) it works fine and i got this json result :

Code: Select all

{
  "response": {
  "version":"0.1",
  "termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
  "features": {
  "conditions": 1
  }
	}
  ,	"current_observation": {
		"image": {
		"url":"http://icons.wxug.com/graphics/wu2/logo_130x80.png",
		"title":"Weather Underground",
		"link":"http://www.wunderground.com"
		},
		"display_location": {
		"full":"Bordeaux, France",
		"city":"Bordeaux",
		"state":"33",
		"state_name":"France",
		"country":"FR",
		"country_iso3166":"FR",
		"zip":"00000",
		"magic":"1",
		"wmo":"07510",
		"latitude":"44.83000183",
		"longitude":"-0.69999999",
		"elevation":"50.9"
		},
		"observation_location": {
		"full":"Bordeaux, ",
		"city":"Bordeaux",
		"state":"",
		"country":"FR",
		"country_iso3166":"FR",
		"latitude":"44.83000183",
		"longitude":"-0.69999999",
		"elevation":"200 ft"
		},
		"estimated": {
		},
		"station_id":"LFBD",
		"observation_time":"Last Updated on Mars 24, 13:00 CET",
		"observation_time_rfc822":"Fri, 24 Mar 2017 13:00:00 +0100",
		"observation_epoch":"1490356800",
		"local_time_rfc822":"Fri, 24 Mar 2017 13:05:41 +0100",
		"local_epoch":"1490357141",
		"local_tz_short":"CET",
		"local_tz_long":"Europe/Paris",
		"local_tz_offset":"+0100",
		"weather":"Partiellement nuageux",
		"temperature_string":"54 F (12 C)",
		"temp_f":54,
		"temp_c":12,
		"relative_humidity":"62%",
		"wind_string":"From the NE at 6 MPH",
		"wind_dir":"NE",
		"wind_degrees":50,
		"wind_mph":6,
		"wind_gust_mph":0,
		"wind_kph":9,
		"wind_gust_kph":0,
		"pressure_mb":"1017",
		"pressure_in":"30.04",
		"pressure_trend":"0",
		"dewpoint_string":"41 F (5 C)",
		"dewpoint_f":41,
		"dewpoint_c":5,
		"heat_index_string":"NA",
		"heat_index_f":"NA",
		"heat_index_c":"NA",
		"windchill_string":"NA",
		"windchill_f":"NA",
		"windchill_c":"NA",
		"feelslike_string":"54 F (12 C)",
		"feelslike_f":"54",
		"feelslike_c":"12",
		"visibility_mi":"6.2",
		"visibility_km":"10.0",
		"solarradiation":"--",
		"UV":"7","precip_1hr_string":"-9999.00 in (-9999.00 mm)",
		"precip_1hr_in":"-9999.00",
		"precip_1hr_metric":"--",
		"precip_today_string":"0.00 in (0.0 mm)",
		"precip_today_in":"0.00",
		"precip_today_metric":"0.0",
		"icon":"partlycloudy",
		"icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif",
		"forecast_url":"http://www.wunderground.com/global/stations/07510.html",
		"history_url":"http://www.wunderground.com/history/airport/LFBD/2017/3/24/DailyHistory.html",
		"ob_url":"http://www.wunderground.com/cgi-bin/findweather/getForecast?query=44.83000183,-0.69999999",
		"nowcast":""
	}
}

So my questions are :
- Does wunderground change something on some cities ?
- Is it a Problem to put a city that is 10 km far away from mine (but I put the correct long/lat in script)

Thanks !!
PI 2 - Domoticz 2021.1
RFXCOM - RFXtrx433 USB 433.92MHz Transceiver (5 DIO 54755 + 2 DIO 54756 + 3 DIO 54798)
Z-Wave.Me ZME_UZB1 USB Stick (6 FGSD002 + 2 FGRM222 + 1 FGS223 + 1 FGMS001-ZW5 + 1 FGRGBWM441 + 1 FGBS001 + 2 FGFS101)
6 sondes DS18B20
multinet
Posts: 97
Joined: Friday 05 December 2014 22:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by multinet »

PI 2 - Domoticz 2021.1
RFXCOM - RFXtrx433 USB 433.92MHz Transceiver (5 DIO 54755 + 2 DIO 54756 + 3 DIO 54798)
Z-Wave.Me ZME_UZB1 USB Stick (6 FGSD002 + 2 FGRM222 + 1 FGS223 + 1 FGMS001-ZW5 + 1 FGRGBWM441 + 1 FGBS001 + 2 FGFS101)
6 sondes DS18B20
multinet
Posts: 97
Joined: Friday 05 December 2014 22:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by multinet »

I've adapted the script to call wunderground by pws and not by city it works too
PI 2 - Domoticz 2021.1
RFXCOM - RFXtrx433 USB 433.92MHz Transceiver (5 DIO 54755 + 2 DIO 54756 + 3 DIO 54798)
Z-Wave.Me ZME_UZB1 USB Stick (6 FGSD002 + 2 FGRM222 + 1 FGS223 + 1 FGMS001-ZW5 + 1 FGRGBWM441 + 1 FGBS001 + 2 FGFS101)
6 sondes DS18B20
devilkin
Posts: 6
Joined: Tuesday 11 April 2017 16:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by devilkin »

It's not entirely clear to me how to pick the correct WMOID - do I have to remove the existing WMOID, put DEBUG=1?

I also checked the map at http://www.ogimet.com, but the stations differ if you select different variables... so which do I need to pick?
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by jmleglise »

Hi,

Look here, I' ve made a screenshot :
http://www.domoticz.com/wiki/Real-time_ ... structions
Last edited by jmleglise on Saturday 15 April 2017 22:33, edited 1 time in total.
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de maison de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
bertbigb
Posts: 147
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by bertbigb »

Thanks I Will try that too. I was struggling with this also.


Verzonden vanaf mijn iPhone met Tapatalk
Best regards Bert

Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
MikeF
Posts: 350
Joined: Sunday 19 April 2015 0:36
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.2
Location: UK
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by MikeF »

I have created a very simple alternative to this, which doesn't use Wunderground or ogimet.com - I'm not interested in lux, only altitude and azimuth. It uses timeanddate.com, which provides current sun position for major (significant) towns / cities - my nearest is Aylesbury, about 10km away (close enough, I think).

All it does is to scrape the timeand date webpage to find the altitude and azimuth values, and sends these to Domoticz.

Code: Select all

#!/usr/bin/env python
# 
# Scrapes www.timeanddate.com
# to get sun altitude and azimuth
# and sends to Domoticz

from lxml import html
import requests

# Domoticz command stub and IDx of altitude and azimuth
baseURL = 'http://<DOMOTICZ URL:PORT>/json.htm?type=command&param=udevice&nvalue=0'
altIdx = <IDX OF CUSTOM SENSOR FOR ALTITUDE>
azIdx = <IDX OF CUSTOM SENSOR FOR AZIMUTH>

# timeanddate.com URL
tdURL = 'http://www.timeanddate.com/sun/uk/<YOUR NEARBY TOWN>'

# scrape values from website
page = requests.get(tdURL)
tree = html.fromstring(page.content)
alt = tree.xpath('//span[@id="sunalt"]/text()')
altitude = alt[0].split(u'\xb0')[0]	
az = tree.xpath('//span[@id="sunaz"]/text()')
azimuth = az[0].split(u'\xb0')[0].strip()
#print altitude, azimuth

# Send data to Domoticz
url = baseURL + "&idx=%s&svalue=%s" % (altIdx, altitude)
r = requests.get(url)

url = baseURL + "&idx=%s&svalue=%s" % (azIdx, azimuth)
r = requests.get(url)
Image
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by jmleglise »

Hi mike,

With the script in Lua of this thread, you may have the Sun altitude and azimuth too. The good point is that all the formulae are inside the script. So It may be standalone and not depend of an Internet Service.
So, if you don't need the Lux, you may delete all reference to wheatherunderground, ogimet and Lux.
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de maison de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
Bishop
Posts: 22
Joined: Sunday 11 June 2017 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Real-time solar data : azimuth, Altitude, Lux sensor...

Post by Bishop »

Hello!

I've implemented this script and am very happy that it exists! I'm running into a possible issue. In the beginning of the log you can see there are different GPS coordinates. The second set is correct and the first set comes close but is about 400 meters off. Can someone tell me what causes the first set to be slightly wrong?

Code: Select all

2017-07-07 00:00:00.796 LUA: Lat: 51.*******Long: 5.*******Alt: 18.0 << wrong set!
2017-07-07 00:00:00.796 LUA:
2017-07-07 00:00:00.796 LUA: 2017-07-07 00:00:00
2017-07-07 00:00:00.796 LUA: pws:*********, latitude:51.******, longitude:5.******* << Correct set!
2017-07-07 00:00:00.796 LUA: Home altitude = 18 m
2017-07-07 00:00:00.796 LUA: number ..... etc
I changed the GPS coordinates somewhat because of privacy reasons.
Last edited by Bishop on Friday 07 July 2017 9:08, edited 1 time in total.
Locked

Who is online

Users browsing this forum: No registered users and 1 guest