Belchertown - MQTT with webhosting

496 views
Skip to first unread message

Christian Gruber

unread,
Mar 10, 2021, 1:46:52 AM3/10/21
to weewx-user
hello,

i am uploading the reports via FTP to my webhoster. can i use mqtt then for live data oder do i need a locally webserver?

regards,
chris

Karen K

unread,
Mar 10, 2021, 5:59:33 AM3/10/21
to weewx-user
You need a publicly available MQTT broker. Either you install one on your webhoster's webspace (if possible), or you use a public broker like test.mosquitto.org.

Manfred Maier

unread,
Mar 10, 2021, 9:16:35 AM3/10/21
to weewx-user
Hi Chris,
I've been in a similar situation to you.
My web hosting service didn't allow me to run a MQTT broker and the (free) public brokers didn't perform very well. The majority of MQTT packages got lost and were not delivered to the web client.
So in the end I've decided to rent an additional vServer and run my own MQTT broker. The setup was really easy, but there's a server cost of approx. 2€ per month.

Manfred  

Christian Gruber

unread,
Mar 10, 2021, 1:12:12 PM3/10/21
to weewx-user
hi manfred,

did you try to run the broker locally before? 

i have a static ip with symmetric bandwidth. or are there other reasons why it doesnt work?

regards,
chris

Manfred Maier

unread,
Mar 10, 2021, 1:23:40 PM3/10/21
to weewx-user
No, I didn't.

I'm (unfortunately) sitting behind fiberglass without a static IPv4. 
So I anyway had to rent a vServer for running my own tunneling solution for my local webcam.

Christian Gruber

unread,
Mar 10, 2021, 2:05:55 PM3/10/21
to weewx-user
ok, i will try it locally before, but vserver is also a good (cheap) option :-)

another question to you: how do you calculate sun hours on your site, is it from here? https://github.com/gjr80/weewx-weewx-wd

Manfred Maier

unread,
Mar 10, 2021, 2:44:02 PM3/10/21
to weewx-user
I'm using the attached file, which I found somewhere here in this user forum. 
I've slightly adapted it to bette fit my needs. 

Don't get confused by the filed name 'EmptyReal'. That was just a spare field I had in my database.

The calculation of the theoretical radiation level is not 100% perfect, but it does the job.
radiationhours.py

Christian Gruber

unread,
Mar 11, 2021, 4:00:07 AM3/11/21
to weewx-user
hi,

thanks for this file, i will try it after mqtt-setup :-)

i always get failed connecting on my website and i think it's because my site is using https

the test here is working fine, i get the live data http://www.hivemq.com/demos/websocket-client/

do i have to run my local mosquitto installation also with ssl/tls or is there another way to get it working?

regards,
chris

Manfred Maier

unread,
Mar 11, 2021, 1:28:55 PM3/11/21
to weewx-user
Yes, you are correct. If the page is using https, all components need to have a ssl certificate.

Christian Gruber

unread,
Mar 12, 2021, 2:42:17 AM3/12/21
to weewx-user
got it, thank you manfred!

now a question about radiationhours: i have extended the schema already one time for the weatherlink-driver: https://github.com/michael-slx/weewx-weatherlink-live

whats the correct way to extend the schema a second time? i tried it one time, but then i lost the additional fields from the weatherlink-driver

Manfred Maier

unread,
Mar 12, 2021, 3:53:59 AM3/12/21
to weewx-user
I've also extended my database scheme a second time - without any issues.

Here's my extensions.py
I've just added the additional three fields to the already extended scheme.

extensions.py

Christian Gruber

unread,
Mar 12, 2021, 4:49:16 AM3/12/21
to weewx-user
ok i think i didn't do the first extension with extension.py because mine is empty :-)

i changed schema in weewx.config and recreated the database, then i got the new fields

i am a bit confused now what to do :-)

[DataBindings]

    [[wx_binding]]
        # The database must match one of the sections in [Databases].
        # This is likely to be the only option you would want to change.
        database = archive_sqlite
        # The name of the table within the database
        table_name = archive
        # The manager handles aggregation of data for historical summaries
        manager = weewx.manager.DaySummaryManager
        # The schema defines the structure of the database.
        # It is *only* used when the database is created.
        schema = user.weatherlink_live.schema

Manfred Maier

unread,
Mar 13, 2021, 2:25:11 PM3/13/21
to weewx-user
I've just looked at my installation.
I think the only missing step is to include the extension in the weewx.conf:

##############################################################################

#   This section configures the internal weewx engine.

[Engine]
    
    [[Services]]
        # This section specifies the services that should be run. They are
        # grouped by type, and the order of services within each group
        # determines the order in which the services will be run.
        prep_services = weewx.engine.StdTimeSynch
        data_services = ,
        process_services = user.radiationhours.RadiationHours, weewx.engine.StdConvert, weewx.engine.StdCalibrate, weewx.engine.StdQC, weewx.wxservices.StdWXCalculate
        #        process_services = weewx.engine.StdConvert, weewx.engine.StdCalibrate, weewx.engine.StdQC, weewx.wxservices.StdWXCalculate
        archive_services = weewx.engine.StdArchive
        restful_services = weewx.restx.StdStationRegistry, weewx.restx.StdWunderground, weewx.restx.StdPWSweather, weewx.restx.StdCWOP, weewx.restx.StdWOW, weewx.restx.StdAWEKAS, user.mqtt.MQTT, user.windy.Windy, user.wcloud.WeatherCloud, user.twitter.Twitter, user.wetter.Wetter, user.owm.OpenWeatherMap
        report_services = weewx.engine.StdPrint, weewx.engine.StdReport

Silvio Schömann

unread,
May 14, 2021, 1:14:22 PM5/14/21
to weewx-user
Hello everyone, 

can someone help me and explain why the SunshinTime code does not run in Weewx version 4.5.1? The calculation of the ratio_value is not carried out. The 0 values ​​are entered in the DB. An error message in the log is also not output. I'm using Manfred's simplified code. extensions.py and weewx.conf are also correct. 

 Thank you greetings Silvio

Silvio Schömann

unread,
May 18, 2021, 2:55:00 AM5/18/21
to weewx-user

I found the error, db-sql not specified extended in the weewx.conf :)   

Karen K

unread,
May 18, 2021, 11:58:34 AM5/18/21
to weewx-user
I found those sources:
Jterrettaz / sunduration - that version with the complicated formula
brewster76 / util-archer - a quite too simple solution

@Manfred Maier: Would you mind me including your formula into weewx-GTS, where sun energy is already included?

Reply all
Reply to author
Forward
0 new messages