×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Weather radio don't want connect

  • Posts: 108
  • Thank you received: 4
Good morning and thanks for your report. I saw all the things you mention. But Wolfgang will help. Please read my note. BTW, I ajusted all the pathes in different scrips to /usr/share/weatherradio. I think we will make it work. What OS du you use? In the Apache2 configuration is one differnece to the instructions of WEATHERRADIO.Wolggang enables a module by:sudo a2enmod weatherradio but there is no one. For me only worked: sudo a2enconfThis could not be the reason for the missing data because the web content / frame is shown.

I thing it is a issue with permissions. We will see.

Have a good day.

Gunter
1 year 7 months ago #85653
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 1185
  • Thank you received: 370
Hi Gunter,
I would always recommend using a normal user for running the weather radio scripts, never use root. Therefore the directory holding the RRD files must at least be readable for the user, the RRD files must be writable.

I would recommend to add an entry User=pi below [Service] in your indiserver.service file.

And forget line 2, it's simply a mistake.

There are two scripts that need to run such that the web page displays current data:
1. wr_rrd_update.py which reads current weather data and stores it in the RRD file. This needs to run regularly (every 5 min at least)
2. wr_rrd_fetch.py which reads data from the RRD file and creates a JSON file holding the weather data to be displayed on the web page. Since the web page has several time frames (6h, 1d, 7d, 30d), this script needs to run for each time frame with the corresponding options.

As long as wr_rrd_update.py does not run, the other one does not make sense.

OK, let's check now if you get until this point. If yes, we can continue.

Cheers
Wolfgang
1 year 7 months ago #85672

Please Log in or Create an account to join the conversation.

  • Posts: 294
  • Thank you received: 54
Hello Gunter and Wolfgang,

Gunter, I am running Ubuntu 20.04 LTS and I faced a similar issue some time ago regarding a2enmod and a2enconf but don't recall which one worked. That was not a problem though as the server would work.

Wolfgang, I access my Weather Radio over Wifi but fail to see how wr_rrd_update.py gets the information from it. If I run wr_rrd_update.py a few times, it does not seem to populate the RRD file. I use the following in wr_config.py but it does not seem to access my Weather Radio. Any clue?

<code>

# web server configuration
self.config.set('WeatherRadio', 'INDISERVER', '192.168.2.245')
self.config.set('WeatherRadio', 'INDIPORT', '7624')

# Weather Radio configuration
self.config.set('WeatherRadio', 'INDIDEVICEMODE', 'Ethernet')
self.config.set('WeatherRadio', 'INDI_IP_ADDRESS', '192.168.2.155')
self.config.set('WeatherRadio', 'INDI_IP_PORT', '80')

</code>

Thanks,

Gilles
Last edit: 1 year 7 months ago by Gilles Gagnon.
1 year 7 months ago #85673

Please Log in or Create an account to join the conversation.

  • Posts: 1185
  • Thank you received: 370
I think I found the problem. All wr_rrd... scripts use wr_config.py as config reader. And config.py expects the configuration file weatherradio.ini either in /etc or in /usr/local/share/weatherradio.

Simply move the configuration file to /etc and then it should be used.

If you want to place it in a different location, simply change the corresponding code from line 63 onwards:
        # read config files
        for file in ['/etc/weatherradio.ini',
                     '/usr/local/share/weatherradio/weatherradio.ini']:
            self.config.read(file)
1 year 7 months ago #85674

Please Log in or Create an account to join the conversation.

  • Posts: 294
  • Thank you received: 54
Thanks Wolfgang,

I seem to have move forward as running wr_rrd_update.py with verbose gives me the following output, to which I added the print statement to confirm the connection:
Establishing connection SUCCEEDED to "Device:1"@192.168.2.245:7624
Reading weather data from "Weather Radio"@192.168.2.245:7624
Reading weather parameter...
Reading weather parameter... (succeeded)
Reading sensor data from "Weather Radio"@192.168.2.245:7624

My /etc/weatherradio.ini file is as follows:
#-----------------------------------------------------------------------
# Configuration file for weather radio.
#-----------------------------------------------------------------------
 
[WeatherRadio]
# INDI server delivering weather data
INDISERVER = 192.168.2.245
INDIPORT = 7624
# RRD storage holding time series data
RRDFILE = /usr/share/weatherradio/weather.rrd
 
# RRD storage holding time series for raw sensor data
RRDSENSORSFILE = /usr/share/weatherradio/sensors.rrd
 
# path to the JSON files holding the data
DATAPATH = /usr/share/weatherradio/html/data
 
# path to the directory holding web cam images and videos
MEDIADIR = /usr/share/weatherradio/html/media
 
#-----------------------------------------------------------------------
# configure INDI devices - create for each a separate section and
# let its name start with Device
#-----------------------------------------------------------------------
[Device:1]
# INDI device name
INDIDEVICE = Weather Radio
# INDI device connection mode: Ethernet or Serial
INDIDEVICEMODE = Ethernet
# INDI serial device port (only necessary for Serial mode)
###INDIDEVICEPORT = /dev/ttyUSB0
# INDI IP address (only necessary for Ethernet mode)
INDI_IP_ADDRESS = 192.168.2.155
# INDI IP port (only necessary for Ethernet mode)
INDI_IP_PORT = 80
# Geo Coordinates - Latitude (as decimal)
GEO_COORD_LAT = 45.5
# Geo Coordinates - Longitude (as decimal)
GEO_COORD_LONG = -75.75
# Geo Coordinates - Elevation (as decimal)
GEO_COORD_ELEV = 60.0
 
# [Device:2]
# INDIDEVICE = Rain Radio
# INDIDEVICEMODE = Serial
# INDIDEVICEPORT = /dev/ttyUSB0
# INDI_IP_ADDRESS = 172.28.4.42
# INDI_IP_PORT = 80
# GEO_COORD_LAT = 43.916876
# GEO_COORD_LONG = 5.716624
# GEO_COORD_ELEV = 650.0

What I am not sure of is that it's not clear that the script connects to the Weather Radio device @192.168.2.155 to get the weather and sensor data. The current weather data is not displayed on 192.168.2.245. I may be missing something trivial but I can't find it.

Thanks again for any help,

Gilles
1 year 7 months ago #85684

Please Log in or Create an account to join the conversation.

  • Posts: 1185
  • Thank you received: 370
Glad to see, Gilles!

The script wr_rrd_update.py connects to the INDI server you configured in the [WeatherRadio] section. This script needs to be run from the server that hosts the web page, since the wr_rrd_fetch.py script creates JSON files with the current weather data that should be placed in a directory that Apache sees. This directory is configured with the DATAPATH entry.

Wolfgang
1 year 7 months ago #85687

Please Log in or Create an account to join the conversation.

  • Posts: 294
  • Thank you received: 54
Got a little further as far as making sure connections were established but, apart from what seems to be a time code since the web page display the correct time range, the json sensor data are all 0.0. Below is the indi-weatherradio.service restart and output from ./bin/wr_rrd_update.py --verbose; as well as some data from /usr/share/weatherradio/html/data/RTdata_6h.json.

<code>
gilles@MissionControl:/usr/share/weatherradio$ sudo systemctl restart indi-weatherradio.service
gilles@MissionControl:/usr/share/weatherradio$ ./bin/wr_rrd_update.py --verbose
Setting ethernet ip:port to 192.168.2.155:80
Waiting for connection...
Connection succeeded.
Setting location to lat=45.5, long=-75.75, elev=60.0.
Reading weather data from "Weather Radio"@192.168.2.245:7624
Reading weather parameter...
Reading weather parameter... (succeeded)
Reading sensor data from "Weather Radio"@192.168.2.245:7624
gilles@MissionControl:/usr/share/weatherradio$ ./bin/wr_rrd_fetch.py -s 6h
</code>

<code>
{
"CloudCover":{
"data":[
[
1661423100000.0,
0.0
],
[
1661423400000.0,
0.0
],
[
1661423700000.0,
0.0
],
[
1661424000000.0,
0.0
],
[
1661424300000.0,
0.0
],
[
1661426100000.0,
0.0
],
[
1661426400000.0,
0.0
],
[
1661426700000.0,
0.0
],
[
1661428500000.0,
0.0
],
[
1661431200000.0,
0.0
],
[
1661431500000.0,
0.0
],
[
1661431800000.0,
0.0
]
],
"name":"CloudCover"
},
"DewPoint":{
"data":[
[
1661423100000.0,
0.0
],
[
1661423400000.0,
0.0
],
...
</code>

If I go directly to http://192.168.2.155 I get the current Weather Radio as shown below:
{"weather":{"Davis Anemometer":{"init":true,"direction":98,"avg speed":0.320915908,"min speed":0.22614342,"max speed":0.552159548,"rotations":8},"RG11 Rain Sensor":{"init":true,"mode":"drop detect","count":0,"drop freq":0},"BME280":{"init":true,"Temp":32.72999954,"Pres":1012.715942,"Hum":80.35742188},"MLX90614":{"init":true,"T amb":49.36998749,"T obj":3.249993801},"TSL2591":{"init":true,"Lux":60971.78516,"Visible":63550,"IR":19968,"Gain":0,"Timing":1}}}

And here is the Weather Radio web page:




Thanks again for any insight.
Last edit: 1 year 7 months ago by Gilles Gagnon. Reason: Added more info
1 year 7 months ago #85690
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 1185
  • Thank you received: 370
Gilles,
it takes a couple of minutes until values are shown. If you want to check whether the RRD contains data, use
rrdtool fetch weather.rrd AVERAGE -s -6h

This should show you the last 6h of data from the RRD. Maybe you need to install rrdtool.

HTH
Wolfgang
1 year 7 months ago #85692

Please Log in or Create an account to join the conversation.

  • Posts: 294
  • Thank you received: 54
Thanks Wolfgang,

Interestingly enough, the sensors.rrd file gets populated with valid data, interspersed with lines of "... -nan -nan -nan... -nan", so the sensor data is being read from the Weather Radio station. On the other hand the weather.rrd file only gets filled with either -nan or 0.0000000000e+00. Furthermore, even after a fair bit of time, the web page does not show any sensor data. Even though I installed the web interface according to the instructions provided and every file should be in the appropriate place, I will dig a little further in case of a problem on my part.
1 year 7 months ago #85696

Please Log in or Create an account to join the conversation.

  • Posts: 294
  • Thank you received: 54
Endlich, hurra!

After adding a print (result) statement in weatherradio.py I traced down the problem between the Indi Weather Radio driver and weatherradio.py as I was only getting 0.0000 as data values from the driver, via the indiserver. Trying something simplistic such as purging the xml configuration file of the driver and re-creating it again by saving the configuration, in KStars/EKOS/Indi, solved the data value problem. Yeah!

Now, on with the crontab to automate it.

Thanks for all the clues.
1 year 7 months ago #85700

Please Log in or Create an account to join the conversation.

  • Posts: 294
  • Thank you received: 54
Hello Wolfgang,

Well, its a little bit more obscure than what I thought.

After a fresh reboot, if I stop and restart the indi-weatherradio.service, /usr/share/weatherradio/bin/wr_rrd_update.py --verbose connects to the Weather Radio device and gives me only 0.000 weather values. If I start and then stop KStars/EKOS/indi with the Weather Radio driver I get expected weather values once I run /usr/share/weatherradio/bin/wr_rrd_update.py --verbose again. Makes me wonder if wr_rrd_update.py or what is in between wr_rd_update.py and the Weather Radio driver is missing some sensors or parameters configuration or initialisation, unless KStars and friends are run prior.

Currently running KStars 3.6.0 stable with indilib 1.9.7

Thanks
1 year 7 months ago #85735

Please Log in or Create an account to join the conversation.

  • Posts: 1185
  • Thank you received: 370
I'm not so sure where this problem is coming from, but be careful connecting with EKOS, since it might shutdown the INDI driver. Better connect first with EKOS, configure the sensors, SAVE the profile (don't forget that!) and then leave the INDI server. If you connect now with wr_rrd_update.py, it should work.
1 year 7 months ago #85745

Please Log in or Create an account to join the conversation.

Time to create page: 0.347 seconds