Closed dejarikbcn closed 4 years ago
Hi! I'm on vacation now. I think I can fix this problem after 15th September. Sorry.
Hi! Thanks!! We will be looking forward to hearing from you! :-) 👍 👍
Raspbian GNU/Linux 9 (stretch) is using Python 3.5.3 while the f-strings were introduced in Python 3.6 per docs.
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
$ python3 --version
Python 3.5.3
A temporary fix is to replace that string with old style string replace:
raise ValueError('Units value must be one of %s' % self.UNITS_CODES.keys())
Just noticed that Pipfile
clearly states that Python 3.7 is required:
https://github.com/h4/lywsd02/blob/d13d013258b1285ed77cd51ef9c4ad940771e071/Pipfile#L12-L13
Not sure why pip
isn't complaining about it when installing it on Raspbian that doesn't have the required version of Python installed.
Hi,
I'm trying to read data from my sensor using your amazing lib, but I'm getting the following error. May you take a minute to help me?
Installing everythin seemts to go fine:
pi@raspberrypi:~/python_scripts $ sudo pip3 install lywsd02 Collecting lywsd02 ... Successfully built bluepy Installing collected packages: bluepy, lywsd02 Successfully installed bluepy-1.3.0 lywsd02-0.0.2
I have my device's MAC address:
pi@raspberrypi:~ $ sudo hcitool lescan LE Scan ... 3F:5B:7D:81:45:12 LYWSD02
However, when launching a simple test:
from lywsd02 import Lywsd02Client mac = '3F:5B:7D:81:45:12' client = Lywsd02Client(mac)
I'm always getting this exception:
pi@raspberrypi:~/python_scripts $ sudo python3 sensortest.py _Traceback (most recent call last): File "sensortest.py", line 1, in
from lywsd02 import Lywsd02Client
File "/usr/local/lib/python3.5/dist-packages/lywsd02/init.py", line 1, in
from lywsd02.client import Lywsd02Client
File "/usr/local/lib/python3.5/dist-packages/lywsd02/client.py", line 70
raise ValueError(f'Units value must be one of {self.UNITS_CODES.keys()}')
^
SyntaxError: invalid syntax_
Please can you help me?
Thanks!