Not at all obvious to my eyes, nor do I know how to lint to find that 
stuff, but you're better at this than I am :-)

FWIW - I have a fork of this driver that I added this workaround to...

   - wget 
   
https://github.com/vinceskahan/weatherflow-udp/archive/install_example_sensor_map.zip
 
   -O /var/tmp/weatherflow-udp-1.10.2.zip
   - weectl extension install /var/tmp/weatherflow-udp-1.10.2.zip

Changes from the upstream 1.10 version that's been stable for years...

   - added this @property line so v5 registration works vs. this driver
   - I also add a full Tempest sensor map on a clean installation so you 
   don't need to do any cut+paste (other than editing your sensor ID in)
   - added v5 installation note re: weectl
   - and bumped the version string and changelog of course

I'll ask the upstream author again to merge my PR these changes are on but 
last I checked he was kinda busy with having a life too. 

Hope this helps.

On Sunday, February 18, 2024 at 12:41:37 PM UTC-8 [email protected] wrote:

>
> Good to here. Work around or bug fix, I guess that is in the eye of the 
> beholder….
> While the docs may need some ‘sprucing up’, if one performs static code 
> analysis; the error is pretty obvious. Here is the lint error I got when I 
> removed it
> ‘bin/user/MQTTSubscribe.py:2155:4: W0236: Method 'hardware_name' was 
> expected to be 'property', found it instead as 'method' 
> (invalid-overridden-method)‘
> rich
> On Sunday 18 February 2024 at 15:07:53 UTC-5 vince wrote:
>
>> I can confirm that adding @property in the driver and restarting weewx 
>> 'does' work as a workaround, assuming you didn't use example.com as your 
>> host (sigh - another undocumented thing).
>>
>>     # add the next line here around line 289 in the driver or so...
>>     @property
>>     def hardware_name(self):
>>         return HARDWARE_NAME
>>
>> So there's at least one WeatherFlowUDP v5 system registered now.  Cool.
>>
>> Thanks Rich !
>>
>> On Sunday, February 18, 2024 at 11:03:07 AM UTC-8 [email protected] 
>> wrote:
>>
>>> Quick look of the code and it looks like  ‘example.com’ is rejected. 
>>> Seems the error logging could be improved. I’ll poke around and see if I 
>>> can create a decent pull request. But, I may have to defer to the experts.
>>>
>>> On Sunday 18 February 2024 at 13:30:44 UTC-5 vince wrote:
>>>
>>>> I tried to do so but am still getting BAD REQUEST trying to register a 
>>>> test pi.  Of course now it'll wait a day til trying again.  Sigh.
>>>>
>>>> I opened https://github.com/weewx/weewx/issues/936 on this one rather 
>>>> than get multiple conversations all cross-intermingled here.
>>>>
>>>>
>>>> On Sunday, February 18, 2024 at 7:16:17 AM UTC-8 [email protected] 
>>>> wrote:
>>>>
>>>>>
>>>>> I’d try adding the missing @property decorator. All signs point to 
>>>>> that being the problem. It can’t hurt and it fixes a bug.
>>>>> On Sunday 18 February 2024 at 01:01:05 UTC-5 vince wrote:
>>>>>
>>>>>> Meaning what for users or devs ?
>>>>>>
>>>>>>
>>>>>> On Saturday, February 17, 2024 at 3:45:38 PM UTC-8 Tom Keffer wrote:
>>>>>>
>>>>>>> The difference is that to upload to the station registry, V5 uses an 
>>>>>>> HTTP POST with a serialized JSON payload, while V4 uses an HTTP GET.  
>>>>>>> The 
>>>>>>> GET sent an "unbound method" to the registry as a query parameter. We 
>>>>>>> get a 
>>>>>>> lot of those, so I included a bit of code to salvage the hardware type 
>>>>>>> from 
>>>>>>> the "unbound method" parameter. Hence, no one noticed.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Sat, Feb 17, 2024 at 2:24 PM vince <[email protected]> wrote:
>>>>>>>
>>>>>>>> There are 75 currently registered sites using this driver but 'all' 
>>>>>>>> are showing as running 4.x so I'm guessing something changed in v5 
>>>>>>>> weewx......
>>>>>>>>
>>>>>>>> On Saturday, February 17, 2024 at 1:44:38 PM UTC-8 
>>>>>>>> [email protected] wrote:
>>>>>>>>
>>>>>>>>> Theory:
>>>>>>>>> Drivers are suppose to implement hardware_name as a property. The 
>>>>>>>>> driver is missing the @property for hardware_name. When WeeWX 
>>>>>>>>> accesses it 
>>>>>>>>> as property, for example, instance.hardware_name it returns the 
>>>>>>>>> function 
>>>>>>>>> definition.
>>>>>>>>> Try adding the @property decorator to hardware_name in the driver. 
>>>>>>>>> (I did some minor testing by removing it in my driver)
>>>>>>>>> If this is it, I am stumped why it ever worked….
>>>>>>>>> rich
>>>>>>>>>
>>>>>>>>> On Saturday 17 February 2024 at 13:49:06 UTC-5 vince wrote:
>>>>>>>>>
>>>>>>>>>> Tom - I can duplicate this here with 5.0.2 running vs. my 
>>>>>>>>>> wfudpsimulator tool since I don't have actual hardware any more
>>>>>>>>>>
>>>>>>>>>> If registering is enabled, you get that error when the archive 
>>>>>>>>>> period rolls around.
>>>>>>>>>>
>>>>>>>>>> I added some debugging to restx that might help. 
>>>>>>>>>>
>>>>>>>>>>         # Delay the registration by a random amount so all 
>>>>>>>>>> stations don't hit the server
>>>>>>>>>>         # at the same time.
>>>>>>>>>>         _registry_dict.setdefault('delay_post', random.randint(0, 
>>>>>>>>>> 45))
>>>>>>>>>>
>>>>>>>>>>         log.info("StationRegistry _registry_dict: %s", 
>>>>>>>>>> _registry_dict)
>>>>>>>>>>
>>>>>>>>>> Which outputs....
>>>>>>>>>>
>>>>>>>>>> 2024-02-17T10:36:57.489015-08:00 raspberrypi weewxd[1902]: INFO 
>>>>>>>>>> weewx.restx: StationRegistry _registry_dict: {'log_success': True, 
>>>>>>>>>> 'log_failure': True, 'station_url': '
>>>>>>>>>> https://www.example.com/no-station-here', 'station_type': 
>>>>>>>>>> 'WeatherFlowUDP', 'description': 'WeatherflowUDP Simulator test 
>>>>>>>>>> station', 
>>>>>>>>>> 'latitude': 47.31, 'longitude': -122.36, 'station_model': <bound 
>>>>>>>>>> method 
>>>>>>>>>> WeatherFlowUDPDriver.hardware_name of 
>>>>>>>>>> <user.weatherflowudp.WeatherFlowUDPDriver object at 0xf6ff9670>>, 
>>>>>>>>>> 'config_path': '/home/pi/weewx-data/weewx.conf', 'entry_path': 
>>>>>>>>>> '/home/pi/weewx-venv/lib/python3.11/site-packages/weewxd.py', 
>>>>>>>>>> 'delay_post': 
>>>>>>>>>> 39}
>>>>>>>>>>
>>>>>>>>>>  Notice the station_model value.  Looks a little odd....
>>>>>>>>>>
>>>>>>>>>> The driver sets the following....
>>>>>>>>>>
>>>>>>>>>> # Default settings...
>>>>>>>>>> DRIVER_VERSION = "1.10"
>>>>>>>>>> HARDWARE_NAME = "WeatherFlow"
>>>>>>>>>> DRIVER_NAME = 'WeatherFlowUDP'
>>>>>>>>>>
>>>>>>>>>> Notice the single quotes around DRIVER_NAME there ?
>>>>>>>>>> Perhaps some obscure single vs. double quote thing going on ?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>> 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/742f4e63-77e3-41bc-b24d-ed98a37ab343n%40googlegroups.com
>>>>>>>>  
>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/742f4e63-77e3-41bc-b24d-ed98a37ab343n%40googlegroups.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/e540226b-b184-4864-84b2-443ebc847662n%40googlegroups.com.

Reply via email to