--
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/zhl4I7oRtt8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
It would be possible to configure the weewx system to be able to receive the data from the different sensosrs of our weather estation?
Thanks in davance!
/home/pi/weather-station/interrupt_daemon.py
script to publish to MQTT, run mosquitto or some other MQTT broker, and use my MQTT subscribing driver to read from the broker and generate loop packets (snapshopts of your readings) inside weewx.
I built a system where an Arduino reads sensors using I2C, and sends the data to a Raspberry Pi as a small packet using RF24Mesh radios. Then a process running on the Pi, modeled after one of the RF24Mesh examples, publishes to an MQTT broker. A weewx driver subscribes to the publication and writes to the weewx database. The broker and weewx are running on a different computer, but they could be on the Pi.
In your case, where the Pi already has the data, you could make something similar but simpler. Change the/home/pi/weather-station/interrupt_daemon.py
script to publish to MQTT, run mosquitto or some other MQTT broker, and use my MQTT subscribing driver to read from the broker and generate loop packets (snapshopts of your readings) inside weewx.https://github.com/morrowwm/weewxMQTT.git, look for weewxMQTT/bin/weewx/drivers/wxMesh.py
I'm new to github, so hope I've done that right.
standard practice is to put a new driver in the user folder (not the weewx/drivers folder) so that you can update weewx without losing your modifications. unless you're working on core weewx code, this approach tends to be easier than maintaining a separate fork or branch.
you could make it easier to manage (for yourself) and share (for others) if you put the mqtt driver into its own repository (i.e., just the wxMesh.py file). that way you don't have to duplicate the entire weewx codebase.
even better, package the mqtt driver as a weewx extension so it can be easily applied to any weewx installation. packaging should be pretty easy - see the fileparse driver as one example, and the customization guide for details:
http://weewx.com/docs/customizing.htm#extensions
if any of that is unclear or difficult to understand, please let us know so we can make it better!
m
To start with, should I delete that entire weewxMQTT repository, and start over with only my new file(s)?
2. The requirement for US units is because of weewx requiring US units. The driver doesn't do any conversion, just passes the data through. That might be a good enhancement to make.
Node 5 sent:temperature : 4.96 Cpressure : 1009.25 mbarhumidity : 79.05 %temperature at humidity sensor: 0.8 Cirradiance : 13battery voltage : 933solar voltage : 874mcu temperature : 32.8At 2017-02-02 11:19:50 waiting for up to 10 seconds for publication of TIME:0,AMBT: 4.96,BARP:1009.25,RHUM:79.05,HUMT: 0.76,IRRA:13,BATV:933,PHOV:874,SYST:32.80,WIND: 0.0,WDIR: 0.0on topic weather for client with ClientID: surveyMessage with delivery token 3 delivered return code 0rcvNode 5 sent:temperature : 5.21 Cpressure : 1009.27 mbarhumidity : 77.71 %temperature at humidity sensor: 1.6 Cirradiance : 10battery voltage : 933solar voltage : 870mcu temperature : 32.9At 2017-02-02 11:20:17 waiting for up to 10 seconds for publication of TIME:0,AMBT: 5.21,BARP:1009.27,RHUM:77.71,HUMT: 1.61,IRRA:10,BATV:933,PHOV:870,SYST:32.90,WIND: 0.0,WDIR: 0.0on topic weather for client with ClientID: surveyMessage with delivery token 4 delivered return code 0rcv
The program running on your pi that acts as a base station, is it running on a node.js server?
I just watched a youtube video of a home automation system using node.js, mqtt and 434 MHz radios. Just reading about those radios and their range, would almost eliminate the need for the mesh part of it, if you're just doing very low data transfer stuff like we do with weather sensors. Outdoor range is hundreds of feet with very simple antenna arrangements.
Sorry for not trimming the previous replies...now one more thing, how are you getting the weather data from the mqtt broker into weewx?
From what I understand the mqtt extension only pushes weather data to an mqtt broker and not vice versa? Maybe it does, but the wording on Mathew's GIT page suggests it only publishes it doesn't subscribe. Would be nice if it subscribed too, then you could completely decouple weewx from the hardware a universal translator so to speak. Maybe it does this, and I'm not understanding it completely.
TIME:0,AMBT: 7.23,BARP:1001.97,RHUM:70.92,HUMT: 4.44,IRRA:12,BATV:974,PHOV:673,SYST:33.20,WIND: 0.0,WDIR: 0.0
Unfortunately, I am not confortable with python and I was not able to read how the MQTT message shall looks like as input for wxMesh.
If I guessed well, the mqtt topic id should be weather.
I have many questions !!In a previous message of this thread, it is mentionned:
TIME:0,AMBT: 7.23,BARP:1001.97,RHUM:70.92,HUMT: 4.44,IRRA:12,BATV:974,PHOV:673,SYST:33.20,WIND: 0.0,WDIR: 0.0
But I dont see the link with weewx labels here,c an you help a bit with that ?
Also I wonder how to deal with multiple publisher: I have in mind to have at least 2 (1 for outside, 1 for inside and barometric sensor).last question, what is the expected format for time stamp ? unix epoc timestamp? ( like 1487603802 ).
And finally: simple measurements (temp, humidity, pressure...) seems ok, but how is working measurements like rain ? ( what is the data to be put here: daily total? )
Sorry for this question avalanche !
weather/outside/temperature = 21
weather/outside/humiduty = 77
weather/inside/temperature = 21
....
('rainRate', 'REAL'),
('rain', 'REAL'),
Many thanks for so quick answer and wiki link. I will read this page carefully !One more question:Would it make sense to use topic instead of all data in one topic ?I meanThis is just an open question, I know mqtt since yesterday so, only have a noob point of view :D...
weather/outside/temperature = 21
weather/outside/humiduty = 77
weather/inside/temperature = 21
....
I understand your solution for the timestamp. The only issue I see is that it might slightly delay data...weewx will consider reading time as the measurement time which might be a few seconds earlier.but it does not seems critical for most measurement.
Regarding raingauge, you may know that there are some raingauge with heating function to melt the snow ;-pppMore seriously: from what I have seen: there is this Rainwise "1wire" compatible rain gauge. it uses a DS2423 counter IC.As far as I understand, this IC just count the ticks: I mean it starts from 0 and just count, always up, never goes down.Then, you can read it every minute, hour, day to calculate the minute, hourly or daily total rain (for the rainwise, 1 tick = 0.25mm)This calculation should be easy to do in an ESP8266 (or anything arduino, whatever like).We just need to know how to feed weewx correctly :-)If I correctly understand (also after looking the "fileparser" driver). The data we have to feed in the driver match the database schemas.there is only 2 rain data here.
('rainRate', 'REAL'),
('rain', 'REAL'),
def __init__(self, **stn_dict):
# where to find the data file
self.host = stn_dict.get('host', 'localhost')
self.topic = stn_dict.get('topic', 'weather')
self.username = stn_dict.get('username', 'XXX')
self.password = stn_dict.get('password', 'password')
# how often to poll the weather data file, seconds
self.poll_interval = float(stn_dict.get('poll_interval', 5.0))
# mapping from variable names to weewx names
self.label_map = stn_dict.get('label_map', {})
loginf("host is %s" % self.host)
loginf("topic is %s" % self.topic)
loginf("polling interval is %s" % self.poll_interval)
loginf('label map is %s' % self.label_map)
self.payload = "Empty"
#self.payloadList = [payload]
self.client = mqtt.Client(client_id="XXX", protocol=mqtt.MQTTv31)
#self.client.on_connect = self.on_connect
self.client.on_message = self.on_message
self.client.username_pw_set(self.username, self.password)
self.client.connect(self.host, 1883, 60)
self.client.subscribe(self.topic, qos=1)
for information: syslog, I have only this every 1s (my poll interval)
Feb 20 21:31:59 localhost weewx[9448]: wxMesh: Sleeping for 1
Feb 20 21:32:00 localhost weewx[9448]: wxMesh: Working on payload : Empty
Feb 20 21:32:00 localhost weewx[9448]: wxMesh: Sleeping for 1
Feb 20 21:32:01 localhost weewx[9448]: wxMesh: Working on payload : Empty
Feb 20 21:32:01 localhost weewx[9448]: wxMesh: Sleeping for 1
1487626012: New connection from 192.168.1.180 on port 1883.
1487626012: Socket error on client <unknown>, disconnecting.
1487626042: New connection from 192.168.1.180 on port 1883.
1487626042: Socket error on client <unknown>, disconnecting.
# Set to 1 for extra debug info, otherwise comment it out or set to zero.
debug = 1
--
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/zhl4I7oRtt8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
import paho.mqtt.client as mqtt
....
self.client = mqtt.Client(client_id=self.client_id, protocol=mqtt.MQTTv31)
fred@orangepipcplus:~$ mosquitto --help
mosquitto version 1.4.8 (build date Fri, 19 Feb 2016 12:03:16 +0100)
mosquitto is an MQTT v3.1 broker.
Usage: mosquitto [-c config_file] [-d] [-h] [-p port]
.....
"""
This is an MQTT v3.1 client module. MQTT is a lightweight pub/sub messaging
protocol that is easy to implement and suitable for low powered devices.
"""
logdbg("Set username to %s and password to %s" % (self.username, self.password))
sudo /etc/init.d/weewx start
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: Got message TIME:0,AMBT: 7.23,BARP:1001.97,RHUM:70.92,HUMT: 4.44,IRRA:12,BATV:974,PHOV:673,SYST:33.20,WIND: 0.0,WDIR: 0.0
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: Working on payload : TIME:0,AMBT: 7.23,BARP:1001.97,RHUM:70.92,HUMT: 4.44,IRRA:12,BATV:974,PHOV:673,SYST:33.20,WIND: 0.0,WDIR: 0.0
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: key: TIME value: 1487658179
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: key: AMBT value: 7.23
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: key: BARP value: 1001.97
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: key: RHUM value: 70.92
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: key: HUMT value: 4.44
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: key: IRRA value: 12
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: key: BATV value: 974
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: key: PHOV value: 673
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: key: SYST value: 33.20
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: key: WIND value: 0.0
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: key: WDIR value: 0.0
Feb 21 06:22:59 localhost weewx[17227]: wxMesh: Sleeping for 10
weather/outTemp
weather/outHumidity
....
Hey you left me a lot of job guys! ;-) (just kidding).So, let's try to check as much as I can:
4- and now I dont what happens but I received a packet :-)
Hello !Regarding websockets:Just found the howto I was talking about: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 wrongthe "on_message" stuff is kind of asynchronousthen when a message is available on the broker, this function will be trigged and will load the message content in payload.
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
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 ?
The background of the question is that I'm thinking if it may be possible to use a sub topic structure for mqttThe 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.