×

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: 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.

  • Posts: 108
  • Thank you received: 4
pi@allsky:/etc/apache2/conf-available $ ll
insgesamt 40
drwxr-xr-x 2 root root 4096 Nov 24 17:33 .
drwxr-xr-x 8 root root 4096 Nov 24 17:40 ..
-rw-r--r-- 1 root root 315 Apr 2 2019 charset.conf
-rw-r--r-- 1 root root 127 Jul 29 2013 javascript-common.conf
-rw-r--r-- 1 root root 3224 Apr 2 2019 localized-error-pages.conf
-rw-r--r-- 1 root root 189 Apr 2 2019 other-vhosts-access-log.conf
-rw-r--r-- 1 root root 1139 Feb 16 2020 php7.3-cgi.conf
-rw-r--r-- 1 root root 2174 Apr 2 2019 security.conf
-rw-r--r-- 1 root root 455 Apr 2 2019 serve-cgi-bin.conf
-rw-r--r-- 1 root root 215 Nov 24 17:31 weatherradio.conf
3 years 4 months ago #63351

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

  • Posts: 108
  • Thank you received: 4
pi@allsky:/etc/apache2/conf-available $ cat weatherradio.conf
Alias /weatherradio /usr/share/weatherradio/html

<Directory "/usr/share/weatherradio/html">
Options Indexes FollowSymlinks
AllowOverride None
Require all granted
AddDefaultCharset off
</Directory>
3 years 4 months ago #63352

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

  • Posts: 1187
  • Thank you received: 370
Hm, strange. What happens if you place a symbolic link into /etc/apache2/conf-enabled and restart apache:
cd /etc/apache2/conf-enabled/
ln -s ../conf-available/weatherradio.conf .
sudo systemctl restart apache2.service
3 years 4 months ago #63353

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

Time to create page: 0.445 seconds