×

INDI Library v1.9.8 Released (29 Sep 2022)

Bi-monthly INDI Library released with new drivers and bug fixes.

Parse INDI weather to Boltwood data file?

  • Posts: 94
  • Thank you received: 3
Hi,
I am currently using Wolfgangs' Weather Radio with Ekos very stable. But recently, I want to extend the driver support for this to ASCOM. The easiest way that I can think of with my limited coding experience is to create a parser that reads values from INDI server and writes it into a Boltwood 1 line data file which then can be read by an ASCOM driver that supports this kind of format (which is readily available).
But coding from scratch is hard for me. Is there anyone who ever worked on the same project or 1 similiar and ready to share the code? I can try to find a way to mold it to my needs. Thanks. 
i have found code from someone who wrote it for parsing OpenWeather data into the boltwood file but if anyone have and INDI parser would be better. Thanks!
gist.github.com/gshau/bee3ef8f9efeb35f69cb43cc08b29ef9
8 months 4 weeks ago #81115

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

  • Posts: 94
  • Thank you received: 3
8 months 3 weeks ago #81159

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

  • Posts: 238
  • Thank you received: 49
What data is available from the weatherradio driver when it is connected to your source?

With the weatherradio driver running and connected, in a terminal execute

indi_getprop "Weather Radio.*.*"

Now given the data available, you are looking to write out specific available data in this format?
interactiveastronomy.com/skyroof_help/Weatherdatafile.html

?

Gene
The following user(s) said Thank You: Nguyễn Trọng Minh
8 months 3 weeks ago #81161

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

  • Posts: 94
  • Thank you received: 3
Hi Gene,
Thanks for the reply.
Here is what I have when getprop
Weather Radio.CONNECTION.CONNECT=On
Weather Radio.CONNECTION.DISCONNECT=Off
Weather Radio.DRIVER_INFO.DRIVER_NAME=Weather Radio
Weather Radio.DRIVER_INFO.DRIVER_EXEC=indi_weatherradio
Weather Radio.DRIVER_INFO.DRIVER_VERSION=1.14
Weather Radio.DRIVER_INFO.DRIVER_INTERFACE=128
Weather Radio.CONFIG_PROCESS.CONFIG_LOAD=Off
Weather Radio.CONFIG_PROCESS.CONFIG_SAVE=Off
Weather Radio.CONFIG_PROCESS.CONFIG_DEFAULT=Off
Weather Radio.CONFIG_PROCESS.CONFIG_PURGE=Off
Weather Radio.DEBUG.ENABLE=Off
Weather Radio.DEBUG.DISABLE=On
Weather Radio.CONNECTION_MODE.CONNECTION_SERIAL=Off
Weather Radio.CONNECTION_MODE.CONNECTION_TCP=On
Weather Radio.DEVICE_ADDRESS.ADDRESS=192.168.1.108
Weather Radio.DEVICE_ADDRESS.PORT=80
Weather Radio.CONNECTION_TYPE.TCP=On
Weather Radio.CONNECTION_TYPE.UDP=Off
Weather Radio.FIRMWARE.FIRMWARE_INFO=1.15
Weather Radio.FIRMWARE_CONFIGS.Arduino::free memory=33608
Weather Radio.FIRMWARE_CONFIGS.RG11 Rain Sensor::mode=drop detect
Weather Radio.FIRMWARE_CONFIGS.RG11 Rain Sensor::rain sensor pin=12
Weather Radio.FIRMWARE_CONFIGS.WiFi::SSID=Minh_Let
Weather Radio.FIRMWARE_CONFIGS.WiFi::status=disconnected
Weather Radio.REFRESH_CONFIG.REFRESH=Off
Weather Radio.WIFI.DISCONNECT=On
Weather Radio.WIFI.CONNECT=Off
Weather Radio.RG11 Rain Sensor.count=0
Weather Radio.RG11 Rain Sensor.rain volume=0
Weather Radio.RG11 Rain Sensor.drop freq=0
Weather Radio.BME280.Temp=26.070000000000000284
Weather Radio.BME280.Pres=1016.1800000000000637
Weather Radio.BME280.Hum=54.581049999999997624
Weather Radio.MLX90614.T amb=25.950009999999998911
Weather Radio.MLX90614.T obj=22.749990000000000379
Weather Radio.TSL2591.Lux=4.6454899999999996751
Weather Radio.TSL2591.Visible=1246
Weather Radio.TSL2591.IR=144
Weather Radio.TSL2591.Gain=32
Weather Radio.TSL2591.Timing=1
Weather Radio.TEMPERATURE_SENSOR.BME280 (Temp)=On
Weather Radio.TEMPERATURE_SENSOR.MLX90614 (T amb)=Off
Weather Radio.AMBIENT_TEMP_SENSOR.BME280 (Temp)=On
Weather Radio.AMBIENT_TEMP_SENSOR.MLX90614 (T amb)=Off
Weather Radio.TEMPERATURE_CALIBRATION.FACTOR=1
Weather Radio.TEMPERATURE_CALIBRATION.SHIFT=0
Weather Radio.SKY_TEMP_CALIBRATION.K1=33
Weather Radio.SKY_TEMP_CALIBRATION.K2=0
Weather Radio.SKY_TEMP_CALIBRATION.K3=4
Weather Radio.SKY_TEMP_CALIBRATION.K4=100
Weather Radio.SKY_TEMP_CALIBRATION.K5=100
Weather Radio.SKY_TEMP_CALIBRATION.T_CLEAR=-8
Weather Radio.SKY_TEMP_CALIBRATION.T_OVERCAST=0
Weather Radio.PRESSURE_SENSOR.BME280 (Pres)=On
Weather Radio.HUMIDITY_SENSOR.BME280 (Hum)=On
Weather Radio.HUMIDITY_CALIBRATION.FACTOR=1
Weather Radio.HUMIDITY_CALIBRATION.SHIFT=0
Weather Radio.LUMINOSITY_SENSOR.TSL2591 (Lux)=On
Weather Radio.OBJECT_TEMP_SENSOR.MLX90614 (T obj)=On
Weather Radio.RAIN_DROPS_SENSOR.RG11 Rain Sensor (drop freq)=On
Weather Radio.RAIN_VOLUME_SENSOR.RG11 Rain Sensor (rain volume)=On
Weather Radio.WEATHER_STATUS.WEATHER_TEMPERATURE=Busy
Weather Radio.WEATHER_STATUS.WEATHER_PRESSURE=Ok
Weather Radio.WEATHER_STATUS.WEATHER_HUMIDITY=Ok
Weather Radio.WEATHER_STATUS.WEATHER_SQM=Busy
Weather Radio.WEATHER_STATUS.WEATHER_CLOUD_COVER=Busy
Weather Radio.WEATHER_STATUS.WEATHER_RAIN_DROPS=Ok
Weather Radio.WEATHER_PARAMETERS.WEATHER_TEMPERATURE=26.070000000000000284
Weather Radio.WEATHER_PARAMETERS.WEATHER_PRESSURE=1016.1800000000000637
Weather Radio.WEATHER_PARAMETERS.WEATHER_HUMIDITY=54.581049999999997624
Weather Radio.WEATHER_PARAMETERS.WEATHER_DEWPOINT=16.198665733490479113
Weather Radio.WEATHER_PARAMETERS.WEATHER_SQM=10.915980564867073355
Weather Radio.WEATHER_PARAMETERS.WEATHER_CLOUD_COVER=100
Weather Radio.WEATHER_PARAMETERS.WEATHER_SKY_TEMPERATURE=13.604557406645822581
Weather Radio.WEATHER_PARAMETERS.WEATHER_RAIN_DROPS=0
Weather Radio.WEATHER_PARAMETERS.WEATHER_RAIN_VOLUME=0
Weather Radio.WEATHER_TEMPERATURE.MIN_OK=-10
Weather Radio.WEATHER_TEMPERATURE.MAX_OK=30
Weather Radio.WEATHER_TEMPERATURE.PERC_WARN=15
Weather Radio.WEATHER_PRESSURE.MIN_OK=950
Weather Radio.WEATHER_PRESSURE.MAX_OK=1070
Weather Radio.WEATHER_PRESSURE.PERC_WARN=15
Weather Radio.WEATHER_HUMIDITY.MIN_OK=0
Weather Radio.WEATHER_HUMIDITY.MAX_OK=100
Weather Radio.WEATHER_HUMIDITY.PERC_WARN=15
Weather Radio.WEATHER_DEWPOINT.MIN_OK=-10
Weather Radio.WEATHER_DEWPOINT.MAX_OK=30
Weather Radio.WEATHER_DEWPOINT.PERC_WARN=15
Weather Radio.WEATHER_SQM.MIN_OK=10
Weather Radio.WEATHER_SQM.MAX_OK=30
Weather Radio.WEATHER_SQM.PERC_WARN=15
Weather Radio.WEATHER_CLOUD_COVER.MIN_OK=0
Weather Radio.WEATHER_CLOUD_COVER.MAX_OK=100
Weather Radio.WEATHER_CLOUD_COVER.PERC_WARN=50
Weather Radio.WEATHER_SKY_TEMPERATURE.MIN_OK=-30
Weather Radio.WEATHER_SKY_TEMPERATURE.MAX_OK=20
Weather Radio.WEATHER_SKY_TEMPERATURE.PERC_WARN=0
Weather Radio.WEATHER_RAIN_DROPS.MIN_OK=0
Weather Radio.WEATHER_RAIN_DROPS.MAX_OK=1
Weather Radio.WEATHER_RAIN_DROPS.PERC_WARN=10
Weather Radio.WEATHER_RAIN_VOLUME.MIN_OK=0
Weather Radio.WEATHER_RAIN_VOLUME.MAX_OK=100000
Weather Radio.WEATHER_RAIN_VOLUME.PERC_WARN=10
Weather Radio.WEATHER_REFRESH.REFRESH=Off
Weather Radio.WEATHER_UPDATE.PERIOD=60
Weather Radio.WEATHER_OVERRIDE.OVERRIDE=Off
Weather Radio.GEOGRAPHIC_COORD.LAT=0
Weather Radio.GEOGRAPHIC_COORD.LONG=0
Weather Radio.GEOGRAPHIC_COORD.ELEV=0
Weather Radio.ACTIVE_DEVICES.ACTIVE_GPS=GPS Simulator
Weather Radio.RESET_ARDUINO.RESET=Off


And yes, I 'd want to output the data into a Boltwood file similiar to the link you send.
Last edit: 8 months 3 weeks ago by Nguyễn Trọng Minh.
8 months 3 weeks ago #81177

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

  • Posts: 238
  • Thank you received: 49
Ok, there are a few things in the file format I do not know
1) The file seems to be fixed format columns
2) If fixed format, how to handle negative values, just put the sign in?

In the example
2018-01-17 14:51:45.00 F M 35.9 78.1

Sky temperatures go negative, as do ambient temperatures

So if the sky temp (35.9) if -12.0 should the file then show
2018-01-17 14:51:45.00 F M-12.0 78.1
or
2018-01-17 14:51:45.00 F M -12.0 78.1
which is no longer fixed format output

The GIT you posted indicates it is not exactly as shown in the example
def write_data(self):
self.line_format = '''{date_string:10} {time_string:11} {temp_scale} {wind_scale} {sky_temp:6.1f} \
{amb_temp:6.1f} {sens_temp:6.1f} {wind_speed:6.1f} {humidity:3d} {dewpoint:6.1f} \
{dew_heater_pct:3} {rain_flag} {wet_flag} {elapsed_time} {elapsed_days} \
{cloud_condition_flag} {wind_condition_flag} {rain_condition_flag} {dark_condition_flag} {close_flag} {alert_flag}'''

Now that being said, below is a bash script to partially populate the first few values in the 1 line file
===============CUT here============================
#!/bin/bash
MDATE=`date +"%F %H:%M:%S.00"`
# Change the F and M below to C and K for Centigrade and Knots
fmt="%s F M"
MS=`printf "$fmt" "$MDATE"`

# Uncomment next and comment second next for real values
Weather Radio.MLX90614.T obj=22.749990000000000379
# SKYTEMP=`indi_getprop -1 "Weather Radio.WEATHER_PARAMETERS.WEATHER_SKY_TEMPERATURE"`
SKYTEMP=13.604557406645822581

fmt="%6.1f"
MS=$MS`printf "$fmt" "$SKYTEMP"`

# Uncomment next and comment second next for real values
#AMBTEMP=`indi_getprop -1 "Weather Radio.MLX90614.T amb"`
AMBTEMP=25.950009999999998911

MS=$MS`printf "$fmt" "$AMBTEMP"`

# Uncomment next and comment second next for real values
#SENSTEMP=`indi_getprop -1 "Weather Radio.MLX90614.T amb"`
SENSTEMP=25.950009999999998911
MS=$MS`printf "$fmt" "$SENSTEMP"`
echo $MS

#Uncomment next to write to the given file
#echo $MS >/tmp/BW1line.log
===============CUT HERE==================================
The following user(s) said Thank You: Nguyễn Trọng Minh
8 months 3 weeks ago #81182

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

  • Posts: 94
  • Thank you received: 3
Hi Gene,
Thank so much for the help. I am not quite sure about how the boltwood file handles minus values. I think I'd try to make a file from your example and feed it into a boltwood file reader and see if it works. Again, thanks!
8 months 3 weeks ago #81185

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

  • Posts: 94
  • Thank you received: 3
Actually, in the GIT I posted, I think it's in the older Boltwood file format (there are the older V1) and the example you send in the link is the V2 file that haves a few more column, boltwood drivers usually have backward compatible of the V1 file.
8 months 3 weeks ago #81186

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

  • Posts: 238
  • Thank you received: 49
Understood!

Please excuse the stray line in the above, cut/paste error
E.g.
Weather Radio.MLX90614.T obj=22.749990000000000379

Just delete it
The following user(s) said Thank You: Nguyễn Trọng Minh
8 months 3 weeks ago #81187

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

  • Posts: 94
  • Thank you received: 3
Okay so after testing the data line with the ascom driver (I copied your example above and paste it into a text file then change the values) it turns out the column is quite resilient to change in number of digits. I can simply add the minus sign to before the temperature without delete any space and the driver still reads the data. 
8 months 3 weeks ago #81205

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

  • Posts: 238
  • Thank you received: 49
Good to hear they are parsing it versus fixed format!
The one data value in the file that is more complex is the "Elapsed days since last write"

Below will calculate it
======================================
# from rfc868 seconds from 1/1/1900 to 1/1/1970 converted to days
Days1900To1970=25567
DateSecNow=`date +%s`
DayNow=`echo "$Days1900To1970 + ($DateSecNow / 86400)" | bc -l`
echo $DayNow
printf "0%.5f" "$DayNow"
===================================

The other value, for "Elapsed time since last file write", seems to be in seconds according to the GIT
but the GIT seems to just set it to '00000'
The following user(s) said Thank You: Nguyễn Trọng Minh
8 months 3 weeks ago #81217

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

  • Posts: 7
  • Thank you received: 0
Hi,
I need to use this weather station with ascom to, and found this post.
How did you succeed in the conversion?
I don't understand exactly the way to use : export data with a python script, then read it from ascom driver? Wich one?
Can you explain to me how to do this please?
3 months 2 weeks ago #85445

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

Time to create page: 1.252 seconds