I personally submitted a Pull Request two years ago to fix this problem:
https://github.com/matthewwall/weewx-emoncms/pull/1/files
If you have the current version, it should work. Unfortunately, in my PR,
I did not update the version code, so you'll have to look at the actual
code to see if you have the fix. You want to see
def check_response(self, response):
txt = response.read().decode().lower()
if txt != u'ok' :
On Fri, Feb 17, 2023 at 12:43 PM [email protected] <[email protected]>
wrote:
> I think Gary has it right -- EmonCMS is ancient.
> https://github.com/matthewwall/weewx-emoncms. The last update was 3 years
> ago.
>
> I did a python2 - 3 conversion on it ages ago, but I must have missed
> something that is finally coming back to haunt me.
>
> It's not overly complicated code... But if that 'ok' is coming back as
> bytes instead of a string, this comparison is going to fail.
> def check_response(self, response):
> txt = response.read()
> if txt != 'ok' :
> raise weewx.restx.FailedPost("Server returned '%s'" % txt)
>
> On Friday, February 17, 2023 at 4:17:00 AM UTC-8 Tom Keffer wrote:
>
>> Gary may be on to something. The current version of the uploader already
>> does
>> <https://github.com/matthewwall/weewx-emoncms/blob/master/bin/user/emoncms.py#L291>
>> a decode(), yet the log shows a byte string.
>>
>> Are you sure you're running the latest version of the uploader?
>>
>> On Thu, Feb 16, 2023 at 8:23 PM gjr80 <[email protected]> wrote:
>>
>>> Sounds like a classic python2/python3 string issue. I'm guessing that
>>> WeeWX is running under python3 and the EmonCMS was written for python2 ?.
>>> If so chances are EmonCMS is returning a byte string which python2 happily
>>> accepts as a string but python3 treats strings and bytestrings separately.
>>> You probably need to a .decode() call to the result the uploader
>>> obtains from EmonCMS.
>>>
>>> Gary
>>>
>>> On Friday, 17 February 2023 at 11:37:25 UTC+10 [email protected] wrote:
>>>
>>>> I would agree. The EmonCMS extension does not seem to be interpreting
>>>> the return value correctly.
>>>>
>>>>
>>>> On Thu, Feb 16, 2023 at 5:14 PM [email protected] <[email protected]>
>>>> wrote:
>>>>
>>>>> Thanks for the debug tip. But I'm not sure which is worse... that
>>>>> AWEKAS is now logging success, or that EmonCMS isn't telling me much of
>>>>> anything:
>>>>> Feb 16 17:00:16 weather weewx[2314849] INFO weewx.restx: AWEKAS:
>>>>> Published record 2023-02-16 17:00:00 PST (1676595600)
>>>>> Feb 16 17:05:26 weather weewx[2314849] DEBUG weewx.restx: AWEKAS:
>>>>> Failed upload attempt 1: timed out
>>>>> Feb 16 17:05:32 weather weewx[2314849] INFO weewx.restx: AWEKAS:
>>>>> Published record 2023-02-16 17:05:00 PST (1676595900)
>>>>>
>>>>> Feb 16 17:05:16 weather weewx[2314849] DEBUG weewx.restx: EmonCMS:
>>>>> Failed upload attempt 1: Server returned 'b'ok''
>>>>> Feb 16 17:05:21 weather weewx[2314849] DEBUG weewx.restx: EmonCMS:
>>>>> Failed upload attempt 2: Server returned 'b'ok''
>>>>> Feb 16 17:05:26 weather weewx[2314849] DEBUG weewx.restx: EmonCMS:
>>>>> Failed upload attempt 3: Server returned 'b'ok''
>>>>> Feb 16 17:05:26 weather weewx[2314849] ERROR weewx.restx: EmonCMS:
>>>>> Failed to publish record 2023-02-16 17:05:00 PST (1676595900): Failed
>>>>> upload after 3 tries
>>>>>
>>>>> I have to wonder if this is a problem with the way the plugin is
>>>>> checking the return value. I'll dig into the plugin code
>>>>> <https://github.com/matthewwall/weewx-emoncms>, it looks like it
>>>>> hasn't been updated in ages.
>>>>>
>>>>> On Thursday, February 16, 2023 at 3:57:50 PM UTC-8 Tom Keffer wrote:
>>>>>
>>>>>> If you set debug=1 in weewx.conf, then restart, it will give you more
>>>>>> information in the system log about the failure modes.
>>>>>>
>>>>>> On Thu, Feb 16, 2023 at 1:58 PM [email protected] <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> I was going through my logs and noticed that weewx is logging upload
>>>>>>> failures to both my local EmonCMS server and AWEKAS. But the thing is,
>>>>>>> the
>>>>>>> data in both of those is fresh. Does anyone have any ideas what could
>>>>>>> cause
>>>>>>> it to throw an error but still upload the data?
>>>>>>>
>>>>>>> Feb 16 13:55:25 weather weewx[2305507] ERROR weewx.restx: EmonCMS:
>>>>>>> Failed to publish record 2023-02-16 13:55:00 PST (1676584500): Failed
>>>>>>> upload after 3 tries
>>>>>>> Feb 16 13:55:27 weather weewx[2305507] ERROR weewx.restx: AWEKAS:
>>>>>>> Failed to publish record 2023-02-16 13:55:00 PST (1676584500): Failed
>>>>>>> upload after 3 tries
>>>>>>>
>>>>>>> --
>>>>>>> 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/aa31d711-1ad7-44e6-bdab-60c2992ba5c1n%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/weewx-user/aa31d711-1ad7-44e6-bdab-60c2992ba5c1n%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/82924a10-8cd2-4b1b-a390-13f188d4ea63n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/weewx-user/82924a10-8cd2-4b1b-a390-13f188d4ea63n%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/86331587-d9dc-4ed4-a96c-733ac6e1f837n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-user/86331587-d9dc-4ed4-a96c-733ac6e1f837n%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/07bb6c47-853e-4a51-85ac-476dc3eddfd2n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/07bb6c47-853e-4a51-85ac-476dc3eddfd2n%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/CAPq0zEAoThZjbQEGe__q0mEEHuGJ2%2B2SnAOcnNrGAw6zbFsAsg%40mail.gmail.com.