Hello,
Today I did update "apt-get update Mosquitto" and "git Emonhub".
I also added EmonHubJeeInterfacer to place EmonHubSerialInterfacer.
After this changes the following problem started in EmonHubMqttInterfacer:
Exception in thread MQTT:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/home/pi/emonhub/src/interfacers/emonhub_interfacer.py", line 88, in run
self.action()
File "/home/pi/emonhub/src/interfacers/EmonHubMqttInterfacer.py", line 53, in action
self._mqttc.loop(0)
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 811, in loop
rc = self.loop_read(max_packets)
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 1073, in loop_read
rc = self._packet_read()
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 1475, in _packet_read
rc = self._packet_handle()
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 1943, in _packet_handle
return self._handle_publish()
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 2118, in _handle_publish
self._handle_on_message(message)
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 2274, in _handle_on_message
self.on_message(self, self._userdata, message)
File "/home/pi/emonhub/src/interfacers/EmonHubMqttInterfacer.py", line 170, in on_message
dispatcher.send(channel, cargo=rxc)
File "/usr/local/lib/python2.7/dist-packages/pydispatch/dispatcher.py", line 338, in send
**named
File "/usr/local/lib/python2.7/dist-packages/pydispatch/robustapply.py", line 55, in robustApply
return receiver(*arguments, **named)
File "/home/pi/emonhub/src/interfacers/emonhub_interfacer.py", line 92, in receiver
txc = self._process_tx(cargo)
File "/home/pi/emonhub/src/interfacers/emonhub_interfacer.py", line 421, in _process_tx
for b in ehc.encode(dc,int(scaled[i])):
ValueError: invalid literal for int() with base 10: '55.1'
Everytime I have a "float" value MQTT crashs. What can I be doing wrong? Because it was working perfectly before changes.
Thanx any help.
Re: Exception MQTT: invalid literal for int() with base 10
What version of emonhub are you running? Are you running one of our pre build SD cards? What does the following return:
$ sudo ls /boot | grep emonSD
Re: Exception MQTT: invalid literal for int() with base 10
emonSD-17Jun2015
Re: Exception MQTT: invalid literal for int() with base 10
It is a prebuild SD... I did already an update before.
emonSD-17Jun2015
Re: Exception MQTT: invalid literal for int() with base 10
File "/home/pi/emonhub/src/interfacers/emonhub_interfacer.py", line 421, in _process_tx
for b in ehc.encode(dc,int(scaled[i]))
ValueError: invalid literal for int() with base 10: '55.1
"scaled[i]" will have been previously scaled using multiplication so should already be numeric and since there is both a "f" (float) and a "d" (double) datacode it would be wrong to cast all numeric values to ints, "55.1" could well be a valid value to be encoded, whether "55.1" suits the datacode selected is a different thing altogether but floats should be allowed at this point in the code.
Line 421 of the "emonpi" variant has been altered from the original "experimental" emonhub code so there may be another reason that has been added.
Paul
Re: Exception MQTT: invalid literal for int() with base 10
Changing back to "experimental" I had this error for float value:
Exception in thread MQTT:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/home/pi/emonhub/src/interfacers/emonhub_interfacer.py", line 88, in run
self.action()
File "/home/pi/emonhub/src/interfacers/EmonHubMqttInterfacer.py", line 53, in action
self._mqttc.loop(0)
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 811, in loop
rc = self.loop_read(max_packets)
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 1073, in loop_read
rc = self._packet_read()
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 1475, in _packet_read
rc = self._packet_handle()
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 1943, in _packet_handle
return self._handle_publish()
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 2118, in _handle_publish
self._handle_on_message(message)
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 2274, in _handle_on_message
self.on_message(self, self._userdata, message)
File "/home/pi/emonhub/src/interfacers/EmonHubMqttInterfacer.py", line 170, in on_message
dispatcher.send(channel, cargo=rxc)
File "/usr/local/lib/python2.7/dist-packages/pydispatch/dispatcher.py", line 338, in send
**named
File "/usr/local/lib/python2.7/dist-packages/pydispatch/robustapply.py", line 55, in robustApply
return receiver(*arguments, **named)
File "/home/pi/emonhub/src/interfacers/emonhub_interfacer.py", line 92, in receiver
txc = self._process_tx(cargo)
File "/home/pi/emonhub/src/interfacers/emonhub_interfacer.py", line 421, in _process_tx
for b in ehc.encode(dc,scaled[i]):
File "/home/pi/emonhub/src/emonhub_coder.py", line 46, in encode
result = struct.unpack(e + b*s, struct.pack(e + datacode, value))
error: cannot convert argument to integer