×

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

Bi-monthly release with minor bug fixes and improvements

Weather watcher question

  • Posts: 126
  • Thank you received: 16
Does the weather watcher driver need a file to read from?
I have a diy weather station based on a esp32 wifi board. The board acts as a webserver. When I configure this to create a index.html file, it gets read into the driver all right. The problem is that this is not a long term solution, as this file resides in the esp32 flash memory, which is not intended for frequent rewrites. My other option is to create a web page response "on the fly", when a request from a client is received. But when I test this with the weather watcher driver, it doesn't work. My question is, is the latter scenario supported by the driver? If so, what would I need to make it work?
The only other options I can think of are to either invest in a sd-card hat for the esp, or to have it write to a file on the sbc that holds indi/kstars. I don't know if that's even possible.
Any help would be appreciated.

Wim
4 years 2 months ago #48745

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

  • Posts: 249
  • Thank you received: 62
Hi Wim,
It should work when you set a web address as well.
Did you add the http:// at the beginning? Like
http://192.168.1.1:10800/cgi-bin/cgiLastData

Ferrante
4 years 2 months ago #48758

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

  • Posts: 126
  • Thank you received: 16
Yes, I did. Made that mistake before, but not this time. There are also no subdirectories. The server code is generated by micropython code. I can see that the esp receives connections from indi, just that indi doesn't interprete what's coming back. If I connect with chrome, I get the response I should get:
temp=21.3
pressure=991
...
4 years 2 months ago #48761

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

  • Posts: 249
  • Thank you received: 62
can you please post here the source code of the output of the server?
and can you test this as weather data source?
kramers.mynetgear.com:10443/cgi-bin/cgiLastData

ferrante
4 years 2 months ago #48762

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

  • Posts: 126
  • Thank you received: 16
Your link works fine. I did some more tests. It seems that the WW driver reads the file as lines. My "web page" is output as one big chunk/line. This causes WW to only read the first keyword, which in my case was the time stamp. This time stamp isn't parsed by the driver. All subsequent text was just rejected. When I removed the timestamp and set temp= as the first piece of data, the driver reads this fine, but nothing after it.
Now I've recoded the webserver response and it works

Before:

conn, addr = s.accept()
print('Got a connection from %s' % str(addr))
request = conn.recv(1024)
conn.send('HTTP/1.1 200 OK\n')
conn.send('Content-Type: text/html\n')
conn.send('Connection: close\n\n')
conn.sendall(WebPage)
conn.close()

where 'WebPage' contained formatted html code with the data

Now:

conn, addr = s.accept()
print('Got a connection from %s' % str(addr))
request = conn.recv(1024)
conn.send('HTTP/1.1 200 OK\n')
conn.send('Content-Type: text/html\n')
conn.send('Connection: close\n\n')
conn.send('dataTime=' + strTimestamp +'\n')
conn.send('temp=' + bme_t +'\n')
conn.send('rain=0.00\n')
conn.send('pressure=' + bme_p +'\n')
conn.send('humidity=' + bme_h +'\n')
conn.send('dewpoint=' + bme_dp +'\n')
conn.send('clouds=' + ir_clouds +'\n')
conn.send('wind=1.50\n')
conn.close()

And this works fine. (Btw, don't have a rain and wind sensor installed yet)

Thanks for the help.

Wim
4 years 2 months ago #48771

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

  • Posts: 249
  • Thank you received: 62
yes it is parsing the input line by line.
Good to hear that it works.
ferrante
The following user(s) said Thank You: Wim van Berlo
4 years 2 months ago #48772

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

  • Posts: 60
  • Thank you received: 1
Hello,
I can't get Weather watcher to work.
The driver remains stuck on: <strong>"[INFO] Weather update is in progress ..."</strong>
And i have not the "Parameters" panel.
I tested with a script that returns:
dataGMTTime = 2020/02/11 11:42:25
temperature = 20
wind = 5
gust = 8
rain = 0
clouds = 0

With a file that contains its values,
with a "text / plain" and "text / html" website:
temperature = 20
wind = 5
gust = 8
rain = 0
clouds = 0

My script:
My website (ESP32):
String msg ="rain=0 <br>\ntemperature=0 <br>\nvent =0<br>\nrafale= 0<br>\nnuages=0 \ n";
   server.send (200, "text/html", msg);

or:
String msg = "rani=0\ntemperature=0 \nvent =0\nrafale=0<\ nnuages= 0\ n";
   server.send (200, "text/plain", msg);

I did a test with Watcher Proxy (and a json output), but there, the module crashes.
Last edit: 4 years 2 months ago by Serge CLAUS.
4 years 2 months ago #49358

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

  • Posts: 60
  • Thank you received: 1
You can remove my post.
It's work with an Apache server...
4 years 2 months ago #49359

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

  • Posts: 60
  • Thank you received: 1
I found my problem:
The Indi driver must be restarted after each configuration change.
4 years 2 months ago #49360

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

Time to create page: 0.751 seconds