Some additional info:

that's the log from mosquitto:

tail -f /var/log/mosquitto/mosquitto.log 
1506252845: mosquitto version 1.4.14 (build date Mon, 10 Jul 2017 23:48:43 
+0100) starting
1506252845: Config loaded from /etc/mosquitto/mosquitto.conf.
1506252845: Opening ipv4 listen socket on port 1883.
1506252845: Opening ipv6 listen socket on port 1883.
1506252851: New connection from 192.168.2.153 on port 1883.
1506252851: New client connected from 192.168.2.153 as XXX (c1, k60, 
u'XXX').
1506252940: Client XXX has exceeded timeout, disconnecting.

(.143 is the mosquitto server, .153 is the weewx machine)



Am Sonntag, 24. September 2017 12:21:14 UTC+2 schrieb Christian Peters:
>
> Hi group members,
>
> as described in weewx-user topic "add external sensors on remote computer 
> to a main weewx installation?"
>
> I now set up a test enviroment to get MQTT running.
> Moquitto server is running:
>
> ● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
>    Loaded: loaded (/etc/init.d/mosquitto)
>    Active: active (running) since Sun 2017-09-24 11:50:53 CEST; 12s ago
>   Process: 2193 ExecStart=/etc/init.d/mosquitto start (code=exited, 
> status=0/SUCCESS)
>    CGroup: /system.slice/mosquitto.service
>            └─2197 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
>
> I installed wxMesh.py (didn’t work per wee_extension so I copied the the 
> file to /usr/share/weewx/user).
> My weewx.conf:
> ….
> # Set to type of station hardware. There must be a corresponding stanza
>     # in this file with a 'driver' parameter indicating the driver to be 
> used.
>     station_type = wxMesh
>     
>     # If you have a website, you may specify an URL
>     #station_url = http://www.example.com
>     
>     # The start of the rain year (1=January; 10=October, etc.). This is
>     # downloaded from the station if the hardware supports it.
>     rain_year_start = 1
>     
>     # Start of week (0=Monday, 6=Sunday)
>     week_start = 6
>
>
> ##############################################################################
>
> [Simulator]
>     # This section is for the weewx weather station simulator
>     
>     # The time (in seconds) between LOOP packets.
>     loop_interval = 2.5
>     
>     # The simulator mode can be either 'simulator' or 'generator'.
>     # Real-time simulator. Sleep between each LOOP packet.
>     #mode = simulator
>     # Generator.  Emit LOOP packets as fast as possible (useful for 
> testing).
>     mode = generator
>     
>     # The start time. If not specified, the default is to use the present 
> time.
>     #start = 2011-01-01 00:00
>     
>     # The driver to use:
>     driver = weewx.drivers.simulator
>
> [wxMesh]
>      host = 192.168.2.143           # MQTT broker hostname
>      topic = weather            # topic
>      driver = user.wxMesh
>      poll_interval = 5
>
>      [[label_map]]
>          temp = outTemp
>          humi = outHumidity
>          in_temp = inTemp
>          in_humid = inHumidity
> .....
>
>
> I’m not sure which format wxMesh will expect?
>
> I published a test data per:
>
> mosquitto_pub -h 192.168.2.143 -t weather/temp -m "59"
>
> Is this the right way?
>
> If I subscribe to the mosquitto server with:
>
> mosquitto_sub -h 192.168.2.143 -v -t weather/#
>
>
> I got:
>
> weather/temp 59
>
> So all is well I think. 
>
> I started weewx with wxMesh driver: 
>
> here is the log (debug=1):
>
> Sep 24 11:25:47 debian systemd[1]: Starting LSB: weewx weather system...
> Sep 24 11:25:47 debian weewx[1414]: engine: Initializing weewx version 
> 3.7.1
> Sep 24 11:25:47 debian weewx[1414]: engine: Using Python 2.7.13 (default, 
> Jan 19 2017, 14:48:08) #012[GCC 6.3.0 20170118]
> Sep 24 11:25:47 debian weewx[1414]: engine: Platform 
> Linux-4.9.0-3-amd64-x86_64-with-debian-9.1
> Sep 24 11:25:47 debian weewx[1414]: engine: Locale is 'en_US.UTF-8'
> Sep 24 11:25:47 debian weewx[1414]: engine: pid file is /var/run/weewx.pid
> Sep 24 11:25:47 debian weewx[1418]: engine: Using configuration file 
> /etc/weewx/weewx.conf
> Sep 24 11:25:47 debian weewx[1418]: engine: debug is 1
> Sep 24 11:25:47 debian weewx[1418]: engine: Initializing engine
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading station type wxMesh 
> (user.wxMesh)
> Sep 24 11:25:47 debian weewx[1404]: Starting weewx weather system: weewx.
> Sep 24 11:25:47 debian systemd[1]: Started LSB: weewx weather system.
> Sep 24 11:25:47 debian weewx[1418]: wxMesh: host is 192.168.2.143
> Sep 24 11:25:47 debian weewx[1418]: wxMesh: topic is weather
> Sep 24 11:25:47 debian weewx[1418]: wxMesh: polling interval is 5.0
> Sep 24 11:25:47 debian weewx[1418]: wxMesh: label map is {'temp': 
> 'outTemp', 'humi': 'outHumidity', 'in_temp': 'inTemp', 'in_humid': 
> 'inHumidity'}
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.engine.StdTimeSynch
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.engine.StdTimeSynch
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.engine.StdConvert
> Sep 24 11:25:47 debian weewx[1418]: engine: StdConvert target unit is 0x1
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.engine.StdConvert
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.engine.StdCalibrate
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.engine.StdCalibrate
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.engine.StdQC
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.engine.StdQC
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.wxservices.StdWXCalculate
> Sep 24 11:25:47 debian weewx[1418]: wxcalculate: The following values will 
> be calculated: barometer=prefer_hardware, windchill=prefer_hardware, 
> dewpoint=prefer_hardware, appTemp=prefer_hardware, 
> rainRate=prefer_hardware, windrun=prefer_hardware, 
> heatindex=prefer_hardware, maxSolarRad=prefer_hardware, 
> humidex=prefer_hardware, pressure=prefer_hardware, 
> inDewpoint=prefer_hardware, ET=prefer_hardware, altimeter=prefer_hardware, 
> cloudbase=prefer_hardware
> Sep 24 11:25:47 debian weewx[1418]: wxcalculate: The following algorithms 
> will be used for calculations: altimeter=aaNOAA, maxSolarRad=RS
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.wxservices.StdWXCalculate
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.engine.StdArchive
> Sep 24 11:25:47 debian weewx[1418]: engine: Archive will use data binding 
> wx_binding
> Sep 24 11:25:47 debian weewx[1418]: engine: Record generation will be 
> attempted in 'software'
> Sep 24 11:25:47 debian weewx[1418]: engine: Using archive interval of 60 
> seconds (specified in weewx configuration)
> Sep 24 11:25:47 debian weewx[1418]: engine: Use LOOP data in hi/low 
> calculations: 1
> Sep 24 11:25:47 debian weewx[1418]: manager: Daily summary version is 2.0
> Sep 24 11:25:47 debian weewx[1418]: engine: Using binding 'wx_binding' to 
> database 'weewx.sdb'
> Sep 24 11:25:47 debian weewx[1418]: manager: Starting backfill of daily 
> summaries
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.engine.StdArchive
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.restx.StdStationRegistry
> Sep 24 11:25:47 debian weewx[1418]: restx: StationRegistry: Registration 
> not requested.
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.restx.StdStationRegistry
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.restx.StdPWSweather
> Sep 24 11:25:47 debian weewx[1418]: restx: PWSweather: Posting not enabled.
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.restx.StdPWSweather
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.restx.StdCWOP
> Sep 24 11:25:47 debian weewx[1418]: restx: CWOP: Posting not enabled.
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.restx.StdCWOP
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.restx.StdWOW
> Sep 24 11:25:47 debian weewx[1418]: restx: WOW: Posting not enabled.
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.restx.StdWOW
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.restx.StdAWEKAS
> Sep 24 11:25:47 debian weewx[1418]: restx: AWEKAS: Posting not enabled.
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.restx.StdAWEKAS
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.engine.StdPrint
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.engine.StdPrint
> Sep 24 11:25:47 debian weewx[1418]: engine: Loading service 
> weewx.engine.StdReport
> Sep 24 11:25:47 debian weewx[1418]: engine: Finished loading service 
> weewx.engine.StdReport
> Sep 24 11:25:47 debian weewx[1418]: engine: Starting up weewx version 3.7.1
> Sep 24 11:25:47 debian weewx[1418]: engine: Station does not support 
> reading the time
> Sep 24 11:25:47 debian weewx[1418]: engine: Starting main packet loop.
> Sep 24 11:25:47 debian weewx[1418]: wxMesh: Working on payload : Empty
> Sep 24 11:25:47 debian weewx[1418]: wxMesh: Sleeping for 5
> Sep 24 11:25:52 debian weewx[1418]: wxMesh: Working on payload : Empty
> Sep 24 11:25:52 debian weewx[1418]: wxMesh: Sleeping for 5
> Sep 24 11:25:58 debian weewx[1418]: wxMesh: Working on payload : Empty
> Sep 24 11:25:58 debian weewx[1418]: wxMesh: Sleeping for 5
> Sep 24 11:26:04 debian weewx[1418]: wxMesh: Working on payload : Empty
>
>
> I didn’t get any data in? 
>
> I checked with this little demo python script (subscriber.py):
>
> import paho.mqtt.client as mqtt
>
> def on_connect(client, userdata, flags, rc):
>     print("Connected with result code " + str(rc))
>
>     client.subscribe("weather/#")
>
> def on_message(client, userdata, msg):
>     print(msg.topic + " " + str(msg.payload))
>
> client = mqtt.Client()
> client.on_connect = on_connect
> client.on_message = on_message
>
> client.connect("192.168.2.143", 1883, 60)
>
> client.loop_forever()
>
> and get data:
>
> python subscriber.py 
> Connected with result code 0
> weather/temp 59
>
>
> Do I something wrong? Does anyone got the driver working and data into 
> weewx!? 
> Any idea what will do the trick….?
>
> Thanks in advance!
>
> Regards,
>
> Christian 
>

Reply via email to