Hello Bill,
Thank you for the quick help! The errors were caused by copying (mac RTF -
TXT). Am beginners ...
In the file were still many formatting errors for this reason, I copied
from the github the zip file weewxMQTT / bin / user / wxMesh.py from
January 19th in the Raspberry. I hope it is the right wxMesh file. If not,
please refer to the correct wxMesh.py file.
Unfortunately I get another error here, see logfile.
What am I doing wrong?
Thank you for your help!
Greetings Franz
● weewx.service - LSB: weewx weather system
Loaded: loaded (/etc/init.d/weewx)
Active: active (exited) since Mo 2018-05-21 19:50:32 CEST; 40min ago
Process: 1520 ExecStop=/etc/init.d/weewx stop (code=exited,
status=0/SUCCESS)
Process: 1680 ExecStart=/etc/init.d/weewx start (code=exited,
status=0/SUCCESS)
Mai 21 19:50:32 raspberrypi weewx[1694]: **** File
"/home/weewx/bin/user/...4
Mai 21 19:50:32 raspberrypi weewx[1694]: **** except ValueError, e:
Mai 21 19:50:32 raspberrypi weewx[1694]: **** ^
Mai 21 19:50:32 raspberrypi weewx[1694]: **** SyntaxError: invalid syntax
Mai 21 19:50:32 raspberrypi weewx[1694]: **** Exiting.
Mai 21 19:50:32 raspberrypi systemd[1]: Started LSB: weewx weather system.
Mai 21 19:50:32 raspberrypi weewx[1680]: Starting weewx weather system:
weewx.
Mai 21 20:11:02 raspberrypi systemd[1]: Started LSB: weewx weather system.
Mai 21 20:15:25 raspberrypi systemd[1]: Started LSB: weewx weather system.
Mai 21 20:30:30 raspberrypi systemd[1]: Started LSB: weewx weather system.
Hint: Some lines were ellipsized, use -l to show in full.
Am Montag, 21. Mai 2018 17:22:02 UTC+2 schrieb Bill Morrow:
>
> Franz, it looks like some of the indentation in the wxMesh.py driver has
> been corrupted. python uses indentation to understand the structure of the
> code. Could you check the lines I have indicated below? The error might be
> right - do you have some special character on line 48?.
>
> You are using wysiwig's fork of my original driver, and your MQTT
> publication looks correct for it.
>
> Also, paste source code in and use the {} to "Highlight code syntax". This
> will help understand where the issue is.
>
> def __init__(self, **stn_dict):
> # where to find the data file
> self.host = stn_dict.get('host', 'localhost')
> # subscribe to all sub-topic of the topic define in weewx.conf
> self.topic = stn_dict.get('topic', 'weather') + "/#"
> self.username = stn_dict.get('username', 'XXX') <---- Is this line not
> indented in your wxMesh.py file?
> 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.receive_buffer = {} <---- This line should be indented
> #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) <----
> Too much indent, probably harmless
> self.client.connect(self.host, 1883, 60)
> self.client.subscribe(self.topic, qos=0)
>
> # The callback for when a PUBLISH message is received from the server.
> def on_message(self, client, userdata, msg):
> self.payload = str(msg.payload)
> string_topic = str(msg.topic)
> key = string_topic.split('/')[-1]
> self.receive_buffer[key] = str(msg.payload)<----Too much indent,
> probably harmless
>
>
>