×

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: 1187
  • Thank you received: 370
OK, that's not that suprising. In the second log you see the INDI communication in case that a client connects to the INDI server after the INDI server has connected successfully to the Weather Radio device.

Client 0 in the second log comes from EKOS and client 5 is your other RPi connecting with the python script.

The core question: why does the python script does cannot connect successfully. Could you please take a look into the configuration wr_config.py? Maybe the device parameters INDIDEVICEMODE and NDIDEVICEPORT are set to different values than you use via EKOS.

HTH
Wolfgang
3 years 5 months ago #63209

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

  • Posts: 89
  • Thank you received: 16
more bin/wr_config.py
#!/usr/bin/python
# -*- coding: latin-1 -*-
 
#-----------------------------------------------------------------------
# Configuration for weather radio.
#
# Copyright (C) 2020 Wolfgang Reissenberger <sterne-jaeger@t-online.de>
#
# This application is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# Based upon ideas from indiduinoMETEO (http://indiduino.wordpress.com).
#-----------------------------------------------------------------------
 
 
# INDI server delivering weather data
INDISERVER="localhost"
INDIPORT="7624"
 
# configure INDI devices - separate multiple devices with ","
 
# INDI device name
INDIDEVICE="Weather Radio"
# INDI device connection mode: "Ethernet" or "Serial"
INDIDEVICEMODE="Serial"
# INDI serial device port (only necessary for Serial mode)
INDIDEVICEPORT="/dev/ttyUSB0"
# INDI IP address (only necessary for Ethernet mode)
INDI_IP_ADDRESS="172.28.4.40"
# INDI IP port (only necessary for Ethernet mode)
INDI_IP_PORT="80"
# Geo Coordinates - Latitude (as decimal)
GEO_COORD_LAT="43.916876"
# Geo Coordinates - Longitude (as decimal)
GEO_COORD_LONG="5.716624"
# Geo Coordinates - Elevation (as decimal)
GEO_COORD_ELEV="650.0"
 
# 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"
 
######### INDI Weather vector and element names
WEATHER="WEATHER_PARAMETERS"
WEATHER_TEMPERATURE="WEATHER_TEMPERATURE"
WEATHER_PRESSURE="WEATHER_PRESSURE"
WEATHER_HUMIDITY="WEATHER_HUMIDITY"
WEATHER_CLOUD_COVER="WEATHER_CLOUD_COVER"
WEATHER_SQM="WEATHER_SQM"
WEATHER_DEWPOINT="WEATHER_DEWPOINT"
WEATHER_SKY_TEMPERATURE="WEATHER_SKY_TEMPERATURE"
WEATHER_WIND_GUST="WEATHER_WIND_GUST"
WEATHER_WIND_SPEED="WEATHER_WIND_SPEED"
WEATHER_WIND_DIRECTION="WEATHER_WIND_DIRECTION"

I note that
INDIDEVICEMODE and INDIDEVICEPORT
are the same as in EKOS/Kstars

The differences are in;
GEO_COORD_LAT
GEO_COORD_LONG
GEO_COORD_ELEV

I will make these the same and see what happens.

No that did not fix it. I must have changed something when I updated the software, maybe incompatible versions in Kstars and wr_rrd_update.py or something.

Kstars is version 3.4.3, this is from the raspbian repository
indi_weatherradio is version 1.7

I installed the firmware and web scripts from git the config.h for the firmware says
#define METEORADIO_VERSION "1.6";

Please note that I am running everything on the same pi.
- indiserver, started from systemd as user root
- kstars/ekos, started as user pi
- wr_rrd_update.py, as user pi
Last edit: 3 years 5 months ago by Adrian. Reason: more info
3 years 5 months ago #63228

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

  • Posts: 1187
  • Thank you received: 370
The GEO_... stuff should be irrelevant for connecting. Nevertheless please set at least GEO_COORD_ELEV to the correct value of your location, since this value is used to calculate sea level air pressure.

Are you 100% sure that the serial device is the same as EKOS sets? Sometimes EKOS uses autodetect and changes the value.

The rest of the configuration looks reasonable...

Version 1.7 is OK, the only changes in 1.8 is that it supports multiple instances of Weather Radio. And the Arduino version does not matter.

For further analysis, try the python debugger pdb:
pdb wr_rrd_update.py

And maybe another check: are you starting wr_rrd_update.py from the same directory where wr_config.py is located?

Wolfgang
3 years 5 months ago #63234

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

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

As I was following this thread and as I had a 'similar' problem (wr_rrd_update.py would not connect to INDI), I looked at some code and I may have found a discrepancy in the /usr/share/weatherradio/bin/weatherradio.py file.

Being far from knowing python much, I know it uses indents a lot and, in the 'connect' function of weatherradio.py, where it either connects via Serial or Ethernet, there is al level of indent that may be wrong in the Ethernet part of the if-else. From what I get, the part where it connects to the driver below won't get executed for a Serial connection, resulting in failure in connecting to the INDI Weather Radio driver. I reduced the indent of this section and wr_rrd_update.py could connect again.

Now waiting for some data to be displayed on the Web page and I will let you know if things worked.

Gilles

if mode == "Serial":
                # ensure serial mode
                indi.set_and_send_switchvector_by_elementlabel(dev,"CONNECTION_MODE","Serial")
                # set the configured port
                indi.set_and_send_text(dev,"DEVICE_PORT","PORT",devport)
            else:
                indi.set_and_send_switchvector_by_elementlabel(dev,"CONNECTION_MODE","Ethernet")
                indi.set_and_send_text(dev,"DEVICE_ADDRESS","ADDRESS",ipaddress)
                indi.set_and_send_text(dev,"DEVICE_ADDRESS","PORT",ipport)
 
                # connect driver
                connection = indi.set_and_send_switchvector_by_elementlabel(dev,"CONNECTION","Connect")
                # wait for the connection
                time.sleep(7)
                # ensure that all information is up to date
                indi.process_events()
                # check if the connection has been established
                connection = indi.get_vector(dev, "CONNECTION")
                # set location if connection was successful
                if connection._light.is_ok():
                    indi.set_and_send_float(dev,"GEOGRAPHIC_COORD","LAT",float(lat))
                    indi.set_and_send_float(dev,"GEOGRAPHIC_COORD","LONG",float(long))
                    indi.set_and_send_float(dev,"GEOGRAPHIC_COORD","ELEV",float(elev))
 
 
            # update the result states
            result = result and connection._light.is_ok()
The following user(s) said Thank You: Wolfgang Reissenberger
Last edit: 3 years 5 months ago by Gilles Gagnon.
3 years 5 months ago #63258

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

  • Posts: 294
  • Thank you received: 54
BTW, I hadn't played with the "/usr/share/weatherradio/bin/weatherradio.py" file before I saw the indent issue.
The following user(s) said Thank You: Adrian
3 years 5 months ago #63259

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

  • Posts: 1187
  • Thank you received: 370
Gilles, you are absolutely right, that's the reason why serial devices do not connect!

I started a new branch that should fix the problem: weatherradio V1.9

Wolfgang
The following user(s) said Thank You: Adrian, Gilles Gagnon
3 years 5 months ago #63263

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

  • Posts: 89
  • Thank you received: 16
Super, it works great now.

Wlell done Gilles and Wolfgang.

Bloody indentation! I feel so stupid now I didn't spot it.
3 years 5 months ago #63296

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

  • Posts: 108
  • Thank you received: 4
Hi Wolfgang,

I have done it. It works fine, the sensor data appear in the indi-driver. Thanks for the good job.
As I've seen in the documentation you also incorporated a DHT temp and hum sensor. I did the same but the data are not showing up. The DHT11 works fine with separate firmware.
I tried to understand weatherradio.ino but couldn't locate the place to change or adapt. Can you help me on that?

Thank you

Gunter
3 years 4 months ago #63330

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

  • Posts: 1187
  • Thank you received: 370
Hi Gunter,
please take a look into the Firmware Configuration section of the Readme .

I assume you are familiar with the Arduino IDE. When you open the weatherradio.ino firmware, there are several header files included. All configurations should be placed in config.h:
  1. Enable DHT sensor by removing the comments from
    //#define USE_DHT_SENSOR
  2. Set the appropriate digital PIN of your Arduino where the DHT sensor is attached to and select the DHT type:
    // DHT sensor family
    #define DHTPIN 3          // Digital pin connected to the DHT sensor
    //#define DHTTYPE DHT11   // DHT 11               - Uncomment whatever type you're using!
    #define DHTTYPE DHT22     // DHT 22  (AM2302), AM2321 - Uncomment whatever type you're using!
3 years 4 months ago #63333

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

  • Posts: 108
  • Thank you received: 4
Hi Wolfgang,

thank you a lot. I have overseen the comments in line (#define USE_DHT_SENSOR)
Now it is showing up but no data and with "DHT init: false". Pin is right, typ selection too. I have a model with a resistor on the little board. ?
But anyway, thank you.
Another issue I do have with the add-on and the module activation in apache2. sudo a2enmod weatherradio fails all the time.
"ERROR: Module weatherradio does not exist!" How does a mod looks like? I do have weatherradio.conf in the right place.

best regards

Gunter
3 years 4 months ago #63345

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

  • Posts: 1187
  • Thank you received: 370
Could you post the section of your firmware that recognizes the DHT sensor? In the weather radio header file it looks like this:
#include "DHT.h"
DHT dht(DHTPIN, DHTTYPE);

DHTPIN and DHTTYPE are definitions from config.h
Hm, seems like it is not in the right place. Did you really place it under /etc/apache2/conf-available ?

Wolfgang
3 years 4 months ago #63348

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

  • Posts: 108
  • Thank you received: 4
Sorry, PIN was wrong. Now DHT 11 works fine.
{
"BME280": {
"init": true,
"Temp": 23.39,
"Pres": 1013.406,
"Hum": 33.58496
},
"DHT": {
"init": true,
"Temp": 22.2,
"Hum": 34
},
"MLX90614": {
"init": true,
"T amb": 22.77001,
"T obj": 21.97
},
"TSL2591": {
"init": true,
"Lux": 563.1393,
"Visible": 5008,
"IR": 851,
"Gain": 16,
"Timing": 0
}
}
3 years 4 months ago #63350

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

Time to create page: 0.334 seconds