Thank you for providing the extensions.py code, Karen K!
You really rock!!!

I placed it @ /usr/share/weewx/
with this I added new observations. 
(Check)

I also added the database columns with 
sudo wee_database --add-column=gpsLat
sudo wee_database --add-column=gpsLong
(Check)

However, they are empty with NULL

and in weewx.conf I added:
    [[MQTT]]
     server_url = mqtt://xyz:[email protected]:1883/
     topic = RV
     unit_system = METRIC
     binding = loop, archive
     log_success = true
      [[[inputs]]]
       [[[[gpsLat]]]]
         name = gpsLat
#        units = mm_per_hour
       [[[[gpsLong]]]]
         name = gpsLong

(Is adding this to weewx.conf needed?)

Whenever the gps coordinates are sent, the Belchertown MQTT status line 
says:
Connected to weather station live. Data received *Invalid date*

Looking in the Chrome Inspect console I can see:

MQTT: 
[{"dateTime":"1693128694.0","gpsLat":"52.152435"},{"dateTime":"1693128694.0","gpsLong":"9.929356"}]
 
MQTT: 
[{"dateTime":"1693128696.0","gpsLat":"52.152435"},{"dateTime":"1693128696.0","gpsLong":"9.929356"}]
 
 
MQTT: 
[{"dateTime":"1693128698.0","gpsLat":"52.152435"},{"dateTime":"1693128698.0","gpsLong":"9.929356"}]
 
 
MQTT: {"dateTime": "1693128703.0", "inTemp_C": "20.2", "outTemp_C": 
"20.500000000000004", "outHumidity": "66.0", "pressure_mbar": "998.3", 
"relbarometer": "998.3", "wh31_ch1_batt": "0.0", "wh31_ch1_sig": "4.0", 
"inHumidity": "60.0", "altimeter_mbar": "1001.9404121257783", 
"barometer_mbar": "1001.7762197264383", "cloudbase_meter": 
"849.858055043151", "dewpoint_C": "13.923820763390072", "heatindex_C": 
"20.328888888888894", "humidex_C": "23.820824059901074", "inDewpoint_C": 
"12.180722362154029", "rainRate_cm_per_hour": "0.0", "usUnits": "16.0"} 
MQTT: 
[{"dateTime":"1693128700.0","gpsLat":"52.152435"},{"dateTime":"1693128700.0","gpsLong":"9.929356"}]
 
 
MQTT: 
[{"dateTime":"1693128702.0","gpsLat":"52.152435"},{"dateTime":"1693128702.0","gpsLong":"9.929356"}]
 
MQTT: 
[{"dateTime":"1693128704.0","gpsLat":"52.152435"},{"dateTime":"1693128704.0","gpsLong":"9.929356"}]
 
MQTT: {"dateTime": "1693128708.0", "inTemp_C": "20.2", "outTemp_C": 
"20.500000000000004", "outHumidity": "66.0", "pressure_mbar": "998.3", 
"relbarometer": "998.3", "wh31_ch1_batt": "0.0", "wh31_ch1_sig": "4.0", 
"inHumidity": "60.0", "altimeter_mbar": "1001.9404121257783", 
"barometer_mbar": "1001.7762197264383", "cloudbase_meter": 
"849.858055043151", "dewpoint_C": "13.923820763390072", "heatindex_C": 
"20.328888888888894", "humidex_C": "23.820824059901074", "inDewpoint_C": 
"12.180722362154029", "rainRate_cm_per_hour": "0.0", "usUnits": "16.0"}

What do I miss? What may I have done wrongly?


On Thursday, August 24, 2023 at 9:05:49 PM UTC+2 Karen K wrote:

> You can define new observation types in /usr/share/weewx/extensions.py 
> like this:
>
> *import *weewx.units
>
> *for* group *in* weewx.units.std_groups:
>
>     weewx.units.std_groups[group].setdefault('group_coordinate',
> 'degree_compass')
>
> weewx.units.obs_group_dict.setdefault('gpsLat','group_coordinate')
>
> weewx.units.obs_group_dict.setdefault('gpsLong','group_coordinate')
>
>
> Stefan Gliessmann schrieb am Donnerstag, 24. August 2023 um 19:23:27 UTC+2:
>
>> This is what I see in MQTT for the GPS data:
>>
>> [{"dateTime":"1692897570", 
>> "gpsLat":"52.152496"},{"dateTime":"1692897570", "gpsLong":"9.929346"}]
>>
>> versus 
>>
>> {"dateTime": "1692897612.0", "inTemp_C": "30.1", "outTemp_C": "27.5", 
>> "outHumidity": "54.0", "pressure_mbar": "1001.3000000000001", 
>> "relbarometer": "1001.3", "wh31_ch1_batt": "0.0", "wh31_ch1_sig": "4.0", 
>> "inHumidity": "49.0", "altimeter_mbar": "1004.9493958235101", 
>> "barometer_mbar": "1004.7053486054396", "cloudbase_meter": 
>> "1295.8252688165874", "dewpoint_C": "17.347230252723698", "heatindex_C": 
>> "28.22227943194455", "humidex_C": "33.03157722271784", "inDewpoint_C": 
>> "18.191750223011855", "rainRate_cm_per_hour": "0.0", "usUnits": "16.0"}
>>
>> I just noticed the [ ... ], but still MQTT in Belchertown needs to be 
>> explained what these values are. Where would I need to do that?
>>
>> On Thursday, August 24, 2023 at 7:14:15 PM UTC+2 Stefan Gliessmann wrote:
>>
>>> [image: Screenshot 2023-08-24 at 19.08.31.png]
>>> [image: Screenshot 2023-08-24 at 19.08.18.png]
>>>
>>> Well - I was successful in forwarding the RV's GPS data per MQTT to the 
>>> Belchertown skin.
>>>
>>> It receives the coordinates, but it does not know what to do with it 
>>> (e.g. "Data received Invalid date").
>>> Where would I need to define what values these are and how to store them 
>>> in the weewx.sdb?
>>>
>>> Thank you for any input! :)
>>>
>>> Cheers,
>>> Stefan
>>>
>>>
>>> On Thursday, August 10, 2023 at 6:38:10 PM UTC+2 Stefan Gliessmann wrote:
>>>
>>>> Wow - thanks, Tom!
>>>>
>>>> That actually sound pretty straight forward and almost too easy ;)
>>>> Once I have the GPS receiver hooked up to my LTE router; I will try it 
>>>> out!
>>>>
>>>> 😇
>>>>
>>>> On Wed, Aug 9, 2023 at 5:54 PM Tom Keffer <[email protected]> wrote:
>>>>
>>>>> One way of doing this...
>>>>>
>>>>> Station altitude, latitude, and longitude are always obtained from an 
>>>>> instance of StationInfo 
>>>>> <https://github.com/weewx/weewx/blob/26bbcc56b5939d3e7e102ba21e9e656074714f67/bin/weewx/station.py#L14>,
>>>>>  
>>>>> held in the engine. From this, various views are constructed, including 
>>>>> what's used as a tag, such as $station.altitude.
>>>>>
>>>>> So, with every new archive record you could replace that instance with 
>>>>> a fresh instance, created in a WeeWX service, using updated values. 
>>>>> The instance is available as engine.stn_info in the service.
>>>>>
>>>>> How does your service get its information? One way would be to add new 
>>>>> observation types altitude, latitude, and longitude to the archive 
>>>>> record. 
>>>>> Then your new service can get the values from there.
>>>>>
>>>>> If you also want values in the database, add altitude,  longitude, and 
>>>>> latitude to the schema and they will automatically be populated if the 
>>>>> archive record holds matching types.
>>>>>
>>>>> That's off the top of my head. It's a nice approach because it does 
>>>>> not involve modifying any base weewx code. But, I'm sure I've missed 
>>>>> something...
>>>>>
>>>>> -tk
>>>>>
>>>>>
>>>>> On Wed, Aug 9, 2023 at 8:00 AM Stefan Gliessmann <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> After running into major issues with my LTE router in my RV, weewx 
>>>>>> and Belchertown w/ MQTT are up and running :)
>>>>>> Check it out here: https://t.ly/4icFe
>>>>>>
>>>>>> My RV router is actually a serious professional LTE router which can 
>>>>>> provide GPS data, too (once I have a GPs receiver installed).
>>>>>> Now, I still have to figure out how to push the GPS data into weewx 
>>>>>> db and have weewx use it for the weather forecasts using aeris within 
>>>>>> the 
>>>>>> Belchertown skin.
>>>>>> Since I have MQTT already working and my router can send the GPS data 
>>>>>> as MQTT packages, maybe that is a way to do so.
>>>>>> In weewx.conf the long, latitude and altitude are specified. Is there 
>>>>>> a way to not update these in the weewx.conf, but have them read from the 
>>>>>> db 
>>>>>> and considered accordingly?
>>>>>>
>>>>>> Thanks for brainstorming this with me ;)
>>>>>>
>>>>>> TIA,
>>>>>> Stefan
>>>>>>
>>>>>> On Monday, July 31, 2023 at 4:25:05 AM UTC+2 Cameron D wrote:
>>>>>>
>>>>>>> This would be my suggestion as well.  Certainly use a dedicated DB 
>>>>>>> for the task, then populate it according to the effort you want to put 
>>>>>>> into 
>>>>>>> it.
>>>>>>> Options would be:
>>>>>>>
>>>>>>>    - custom GPS unit along the lines Vince suggested
>>>>>>>    - use a normal in-car GPS unit that records your tracks and 
>>>>>>>    download/export data each day.  I combine my car and walking gps 
>>>>>>> tracks for 
>>>>>>>    geotagging photos.
>>>>>>>    - manually enter data once a day
>>>>>>>
>>>>>>> When I do long trips, I often take a simple handheld temp/RH logger 
>>>>>>> that I download occasionally - every few days.
>>>>>>> I also have a second table with one row per day, where I manually 
>>>>>>> enter comments about where the device was located and anything unusual 
>>>>>>> that 
>>>>>>> might have influenced the results.  Probably less necessary in an RV 
>>>>>>> with 
>>>>>>> fixed locations, but my logger might end up left inside the tent, 
>>>>>>> outside 
>>>>>>> the tent, or left inside the car on different days.  This table could 
>>>>>>> also 
>>>>>>> double as a more general diary.
>>>>>>>
>>>>>>> On Sunday, 30 July 2023 at 6:39:28 am UTC+10 vince wrote:
>>>>>>>
>>>>>>>> On Saturday, July 29, 2023 at 1:11:25 PM UTC-7 Stefan Gliessmann 
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> That would work. But I would miss out on the location and elevation 
>>>>>>>> data … I would like to include location in a database …
>>>>>>>>
>>>>>>>>
>>>>>>>> Sure. Get a GPS module for your pi and write a little script to 
>>>>>>>> seed a custom field in the db.   Shouldn't be a big deal.  Just write 
>>>>>>>> to a 
>>>>>>>> secondary sqlite db.
>>>>>>>>
>>>>>>>>  
>>>>>>>>
>>>>>>> -- 
>>>>>> 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 [email protected].
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/weewx-user/c0a89ba0-e981-4e58-8a3b-9412bbd0b1c4n%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/weewx-user/c0a89ba0-e981-4e58-8a3b-9412bbd0b1c4n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> -- 
>>>>>
>>>> You received this message because you are subscribed to a topic in the 
>>>>> Google Groups "weewx-user" group.
>>>>> To unsubscribe from this topic, visit 
>>>>> https://groups.google.com/d/topic/weewx-user/Fwd1BvCfCoM/unsubscribe.
>>>>> To unsubscribe from this group and all its topics, send an email to 
>>>>> [email protected].
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/weewx-user/CAPq0zECNoy6YbZTHN7DvwhN0n0SEJF5AR4GYEWEjf0hdkomcAA%40mail.gmail.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/weewx-user/CAPq0zECNoy6YbZTHN7DvwhN0n0SEJF5AR4GYEWEjf0hdkomcAA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/8e10c463-7e95-4663-814f-5fd128a0f0a2n%40googlegroups.com.

Reply via email to