Closed Friday13th87 closed 6 years ago
Could you run the daemon with maximum logging verbosity and post the results?
$ sudo python3 -m wdhwdaemon.daemon -vvv
With some help i made following:
sudo python3
import serial
s = serial.Serial('/dev/ttyS2')
s.write(b'STA\r') # edit: used to be r'STA\r' ... but it should be bytes, not a regex
s.readline()
output:
>>> s.write(r'STA\r')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 518, in write
d = to_bytes(data)
File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 63, in to_bytes
raise TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq))
TypeError: unicode strings are not supported, please encode to bytes: 'STA\\r'
then i made
>>> s.write(r'STA\r'.encode())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 's' is not defined
and afterwards it was working probably...
the daemon is starting now without any problems.
My System is WD PR2100 and locales are de_DE UTF-8
The code above seems to be your testing directly on the serial line only.
pmc_port
) to "/dev/ttyS2"?i changed the port name to ttyS2, the hwmon0 line in temperature.py to hwmon1 and thats it and some changes in my system.
It's still interesting that you initially got a PMCCommandRejectedException
for the getVersion command. I assume you got that when using /dev/ttyS2 already, right? Or did you get that when running on port /dev/ttyS0? Also, are you running any original Western Digital tools on the device? And does the daemon still work once you removed and re-attached the power cable?
no it was already running on port ttyS2. i was able to spin down the fan with
echo -ne 'STA\r' | sudo tee /dev/ttyS2
echo -ne 'FAN=25\r' | sudo tee /dev/ttyS2
echo -ne 'LN1=Cool Story Bro\r' | sudo tee /dev/ttyS2
echo -ne 'LN2=--------------\r' | sudo tee /dev/ttyS2
when i started the daemon the result was a direct fan spin up and shutdown
using the ".encode()" line changed the output even the command was wrong with an "r" instead of an "b" (s.write(b'STA\r'))
"r" is not entirely wrong. It doesn't mark a regex as you assumed, but instead indicates a raw string literal. And that's why r'STA\r'
won't work. In a raw string literal a backslash is treated as just what it is (a "\" character) and not as the start of an escape sequence ("\r" for a carriage return character).
ok i turned the NAS down now, plugged the power cable off, waited 20 seconds and restarted the NAS. Fan controll is still working. i dont have any other WD stuff running. debian is installed on a partition of the HDDs
If you look in this thread https://community.wd.com/t/guide-how-to-install-debian-linux-on-the-my-cloud-pr4100-nas/217141/28
there are more informations and the User "Tfl" made it possible for me to use my PR2100 with debian and Fan Controll
and thank you very much for your help and for your work
after installing the hwtools i am getting some errors in deamon.py and wdpmcprotocol.by i used the files from July 28