@bwduncan: for emonpiLCD python3, I suppose I have to use your branch python3-fixes ?
[edit]
I’ve tested your branch and managed to make it work
The class IPAddress seems not to work any more with python3 :
class IPAddress:
def __init__(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def get_ip_address(self, ifname):
try:
return socket.inet_ntoa(fcntl.ioctl(
self.sock.fileno(),
0x8915, # SIOCGIFADDR
struct.pack('256s', ifname[:15])
)[20:24])
except Exception:
return 0
this is working :
def get_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
# doesn't even have to be reachable
s.connect(('10.255.255.255', 1))
IP = s.getsockname()[0]
except:
IP = '127.0.0.1'
finally:
s.close()
return IP
Moreover, each time the script calls r.get, I had to add a decode(‘utf8’)
cf page 3 for example :
lcd[0] = feed1_name + ':' + r.get("feed1").decode('utf8') + feed1_unit
or page 4 and 5 :
basedata = r.get("basedata").decode('utf8')
moreover there is some hardcoded paths, like in the LCD class…it should be something like that :
lcd_status = subprocess.check_output([path+"/emonPiLCD_detect.sh", "%s" % i2c_address])
with path defined at the top of the script by :
path=os.path.dirname(os.path.realpath(__file__))
anyway the subprocess.check_output command is not working…
best
Alex