The clock in my about page is actually 
from https://github.com/roe-dl/websocket-clock-js/commits?author=roe-dl aka 
Karen K in this group!
She did a lot of work to use German weather data (DWD) with the Belchertown 
skin.
Check out her work on her PWS page https://www.woellsdorf-wetter.de/


On Friday, September 8, 2023 at 6:35:37 PM UTC+2 Stefan Gliessmann wrote:

> Vince, thank you again for the scripts ... once I figured out that my MQTT 
> requires  user & password, it works now ...
> seems that I still have to do something with the units for the GPS 
> coordinates ...
>
> [image: Screenshot 2023-09-08 at 18.32.17.png]
>
> On Sunday, September 3, 2023 at 2:24:04 AM UTC+2 vince wrote:
>
>> Yes.  ipv6 is an adventure.  I tried to turn it on for my home LAN and 
>> DNS was a big problem until I figured out that I just needed to always use 
>> "hostname.local" for the LAN DNS and it would work.  Unfortunately it also 
>> seemed to break my pihole ad-blocking so I turned ipv6 back off here after 
>> a few day test.
>>
>> I like the clock on your About page too!
>> On Saturday, September 2, 2023 at 1:02:04 PM UTC-7 Stefan Gliessmann 
>> wrote:
>>
>>> Dear Vince,
>>>
>>> thank you very much for providing the scripts! I really do appreciate!
>>> However, last Tuesday I changed my ISP. Good think - it is 1 Gbps! And 
>>> my challenge was that it is IPv6 and I had to learn very quickly that port 
>>> forwarding with IPv6 is completely different to IPv4, and even more 
>>> particular DDNS with IPv6.
>>> But I am happy to report that my server is back online rv.sgplex.de :)
>>> As I will be on vacation in Spain the next few weeks, I will place your 
>>> scripts in action!
>>>
>>> Thanks again for providing them!
>>>
>>> Cheers
>>>
>>> On Monday, August 28, 2023 at 10:17:58 PM UTC+2 vince wrote:
>>>
>>>> (sorry - ignore the earlier truncated post)
>>>>
>>>> I cooked up a bash script that subscribes, calls a python script to 
>>>> reformat, then publishes.   The bash script sleeps a second between loops 
>>>> to not eat up your cpu.   You 'should' be able to change the variables in 
>>>> the bash script to match your configuration pretty easily...
>>>>
>>>> This subscribes to ORIGINAL_TOPIC and publishes to FINAL_TOPIC in the 
>>>> bash script.
>>>> To test:
>>>>
>>>>    - open a bash window and subscribe to the FINAL_TOPIC
>>>>    - open a second window and run the bash script which will 
>>>>    listen/reformat/publish
>>>>    - if you're not querying your gps currently, open a third window 
>>>>    and publish to the ORIGINAL_TOPIC ala
>>>>
>>>>             mosquitto_pub -h 192.168.1.171 -t RV/original -m 
>>>> '[{"dateTime":"1693128700.0","gpsLat":"52.152435"},{"dateTime":"1693128700.0","gpsLong":"9.929356"}]'
>>>>
>>>> What you should see in window1 that is subscribing is output ala:
>>>> {"dateTime": "1693128700.0", "gpsLat": "52.152435", "gpsLong": 
>>>> "9.929356"}
>>>>
>>>> That kind of data should be ok to subscribe to in weewx for your 
>>>> lat/lon data....
>>>>
>>>> #---- reformat_mqtt.bash ----
>>>>
>>>> #!/bin/bash
>>>> #
>>>> # ip address of MQTT broker
>>>> BROKER="192.168.1.171"
>>>>
>>>> ORIGINAL_TOPIC="RV/original"
>>>> FINAL_TOPIC="RV/final"
>>>>
>>>> while true; do
>>>>
>>>>   # subscribe to a topic
>>>>   # run the python script to reformat to stdout
>>>>   # publish to a final topic
>>>>
>>>>   mosquitto_sub -C 1 -h ${BROKER} -t ${ORIGINAL_TOPIC} \
>>>>     | python3 reformat_mqtt.py \
>>>>     | mosquitto_pub --stdin-line -h ${BROKER} -t ${FINAL_TOPIC}
>>>>
>>>>   # sleep a bit to not eat up your cpu
>>>>   sleep 1
>>>>
>>>> done
>>>>
>>>>
>>>> #---- reformat_mqtt.py -----
>>>> #
>>>> # this reformats the GPS information
>>>> # to a more normal looking output
>>>> #
>>>>
>>>> # it assumes your input data is always in the same order and always 
>>>> complete
>>>> # ala: 
>>>> [{"dateTime":"1693128700.0","gpsLat":"52.152435"},{"dateTime":"1693128700.0","gpsLong":"9.929356"}]
>>>>
>>>> import json
>>>> import sys
>>>> for line in sys.stdin:
>>>>     jsondata = json.loads(line)
>>>>     reorganized_data = {}
>>>>     reorganized_data['dateTime'] = jsondata[0]['dateTime']
>>>>     reorganized_data['gpsLat']   = jsondata[0]['gpsLat']
>>>>     reorganized_data['gpsLong']  = jsondata[1]['gpsLong']
>>>>     print(json.dumps(reorganized_data))
>>>>
>>>>
>>>> On Monday, August 28, 2023 at 5:19:15 AM UTC-7 Stefan Gliessmann wrote:
>>>>
>>>>> I asked in the community forum for my router and I was told that this 
>>>>> is the only way they can currently forward data via MQTT.
>>>>> A future firmware release shall allow more formatting.
>>>>>
>>>>> I might now play around with this 
>>>>> https://github.com/mrtncls/mqtt-translator to get the MQTT payload 
>>>>> from an array in one single statement ...
>>>>> Anybody used the MQTT Translator for this purpose?
>>>>>
>>>>> On Monday, August 28, 2023 at 11:01:41 AM UTC+2 Stefan Gliessmann 
>>>>> wrote:
>>>>>
>>>>>> Which code do you refer to?
>>>>>> [image: Screenshot 2023-08-28 at 11.00.03.png]
>>>>>> This is what I specified in the GPS/Router to push via MQTT to my 
>>>>>> broker ...
>>>>>> On Sunday, August 27, 2023 at 8:39:40 PM UTC+2 vince wrote:
>>>>>>
>>>>>>> We'd have to see your code to see what you are publishing.
>>>>>>>
>>>>>>> Your MQTT log looks very odd and likely needs some tweaking
>>>>>>>
>>>>>>> MQTT: 
>>>>>>> [{"dateTime":"1693128700.0","gpsLat":"52.152435"},{"dateTime":"1693128700.0","gpsLong":"9.929356"}]
>>>>>>>  
>>>>>>>  
>>>>>>>
>>>>>>> I'd expect something like {"dateTime":"1233456", "gpsLat":"52.1234", 
>>>>>>> "gpsLong": "9.987"} for a more typical set of JSON to publish.   You 
>>>>>>> want 
>>>>>>> one element (not in an array) with three items therein - 
>>>>>>> dateTime/lat/lon.
>>>>>>>
>>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/da61ea94-ba64-4414-a358-7fa145c6a10fn%40googlegroups.com.

Reply via email to