It has to do with the different way strings are handled in python 3 vs 2.
If you look at the on_message _keyword method (approx line 576), you will
see that I decode the payload under python 3.
- rich
On Sunday, 5 January 2020 17:59:20 UTC-5, KSKENYON wrote:
>
> I'm stumped. wxMesh.py v0.2 runs fine with b7 and python3 after a few
> small tweaks.
>
> Now matter what or how I send data from mosquitto I get this weewx error
> about being unable to convert to float. I've tried every format I can
> think of on the publish line and everything is rejected. I must be missing
> something obvious about the format for the publish data. Any ideas?
>
> Jan 05 17:49:12 mythtv /weewxd[173413]: wxMesh: dateTime 1578264552
>
> Jan 05 17:49:12 mythtv /weewxd[173413]: *wxMesh: cannot read value for
> 'weewx': could not convert string to float: "b'{time:0}\\n\\n'"*
>
> *Kevin*
>
>
> On Tuesday, February 21, 2017 at 8:23:33 AM UTC-5, Bill Morrow wrote:
>>
>> This conversation has been copied over from the weewx-user group (
>> https://groups.google.com/d/msg/weewx-user/zhl4I7oRtt8/5pwhOAioBgAJ). I
>> believe it is more appropriate to continue here.
>>
>> Some imbedded comments below, as we discuss the design of receiving
>> weather observations from an MQTT broker.
>>
>>
>>
>> On Tuesday, 21 February 2017 06:06:40 UTC-4, wysiwyg wrote:
>>>
>>> Hello !
>>>
>>>
>>> *Regarding websockets: *
>>>
>>> Just found the howto I was talking about:
>>> http://www.frugalprototype.com/installation-de-votre-propre-broker-mqtt/
>>>
>>> it's in french (very convenient for me, sorrry guys ;-).
>>> But as a summary, it says the websocket function of mosquitto can be
>>> enabled just with a small config file.
>>>
>>> I will try this (quick & easy to test).
>>>
>>> *Also, just to summarise my setup:*
>>> I just received last week a brand new Orange Pi PC plus (kind of low
>>> cost raspberry which as a nice advantage imho: it has integrated emmc 8GB
>>> memory).
>>> It is setup with Armbiam Ubuntu Xenial (server), v5.25. (I am more
>>> familiar to ubuntu so it's easier for me too)
>>> I just setup mosquitto from depot ( apt-get install mosquitto ).
>>> I setup weewx using the quick start guide with depot (
>>> http://www.weewx.com/docs/apt-get.htm )
>>>
>>> So it's all fresh install.
>>> I only modified mosquitto config to use "user/password" and play a bit
>>> with weewx and wxMesh as you know.
>>>
>>>
>>> *finally, I have a general question regarding how the driver works:*
>>> let me know if my understanding is correct or wrong
>>>
>>> the "on_message" stuff is kind of asynchronous
>>> then when a message is available on the broker, this function will be
>>> trigged and will load the message content in payload.
>>>
>>
>> Yes, when a message is received, the on_message callback is triggered.
>>
>>
>>>
>>> then the genLoopPackets is synchronous (I mean executed every n
>>> seconds, n=poll interval defined in weewx.conf)
>>> So every n seconds, it checks if payload as some content and if yes, it
>>> will process the data and deliver the "_packet" to next weewx process
>>>
>>> Correct. I originally planned to build the loop packet in the on_message
>> call back, but on_message actually runs in a separate thread I think, and I
>> could not figure out how to easily get the data back to the weewx thread.
>> generating the loop packet only when a subscription arrives would be more
>> efficient. I do not understand weewx or python quite well enough to design
>> this yet.
>>
>>>
>>> If this is correct, does it mean that if several mqtt messages are
>>> delivered inside the n seconds interval, maybe only the last one will be
>>> processed ?
>>>
>>
>> I believe any number of "loop" packets can arrive within n seconds,
>> especially for n>1. Read the Data Architecture section here:
>> http://www.weewx.com/docs/customizing.htm
>>
>>
>>> The background of the question is that I'm thinking if it may be
>>> possible to use a sub topic structure for mqtt
>>> The simplest idea I have in mind is to have:
>>> weather/<weewx_schemas_label>:
>>> weather/outTemp
>>> weather/outHumidity
>>> ....
>>>
>>>
>>> Then each of these topics may be sent at any time: Temp, humidity,
>>> barometer may be send only every few minutes. Wind may be sent every 1 or
>>> few seconds, rain may be send only when it's raining...
>>> weewx driver may subscribe to /weather/# to get them all and process
>>> whenever they arrive ?
>>>
>>> -Ok- I speak but don't have a clue on how to do that :-) not sure it is
>>> realistic.
>>>
>>
>> That was exactly my original idea on how to build the driver. However, if
>> a datum does not get set within the time interval of a RECORD (see the
>> setting in the [StdArchive] section of weewx.conf), then it will be set to
>> None, I think. I don't think this is what we want. Depending on the type of
>> observation (wind, rain) we may want to keep the last value, or enter a
>> zero.
>>
>> wxMesh is definitely a work in progress. It may very well grow away from
>> the original names
>>
>>
>>> The advantage could that it stick better to what I have seen from mqtt
>>> usage, then same published topics could be used by other subscribers (
>>> home-assistant <https://home-assistant.io/>, automatic watering for the
>>> garden or whatever)
>>>
>>> Best regards,
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Le mardi 21 février 2017 00:05:11 UTC+1, mwall a écrit :
>>>>
>>>> i found it helpful to configure the broker so that it publishes using
>>>> websockets. then you can use a web browser to see what is happening.
>>>> this
>>>> is especially useful when you're trying to decode someone else's topic
>>>> hierarchy, or to figure out why your own topics are not showing up where
>>>> you think they should be.
>>>>
>>>> the hivemq folks wrote one of the first ones, which many people have
>>>> now embedded:
>>>>
>>>> http://www.hivemq.com/blog/full-featured-mqtt-client-browser
>>>>
>>>> http://www.espert.io/mqtt/index.html
>>>>
>>>> but many other browser-based clients are out there:
>>>>
>>>> http://mitsuruog.github.io/what-mqtt/
>>>>
>>>> https://www.cloudmqtt.com/docs-websocket.html
>>>>
>>>> if you're using the mosquitto broker, you'll have to compile it with
>>>> websocket compatibility. but once you do that, enabling websockets is
>>>> just
>>>> a matter of making the broker listen on the websocket port.
>>>>
>>>> m
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"weewx-development" 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-development/95aae7dc-4ea6-4440-ae3c-ccaa302e6763%40googlegroups.com.