I am trying to send values from a esp32 on my network to my RPi via mqtt, which then evaluates these values and does some stuff with it.
I've written the code and tried it on my pc without any problems, but when executing the exact same code on the RPi it starts spitting out ValueErrors.
payload = str(message.payload)
payload = float(payload[2:-1])
When running the code like this, it says:
ValueError: could not convert string to float:
Trying to convert it to an integer first also returns an error:
ValueError: invalid literal for int() with base 10: ''
(The [2:-1] is needed because the payload/string that is to be converted is always received as b'payload')
It doesn't throw out any errors when used on the pc. I have also tried printing out the strings before converting them, which showed that they only consist of numbers.
Im running Python3.4 on both my pc and the RPi (tried 2.7 as well, didn't work.)
I hope anyone can explain this weird behaviour to me, thanks in advance.