Open joesalty opened 10 months ago
Problem solved:
Had to add a little code to helpers.py after line nr 17, to solve the problem:
if h is None:
h = 0
Before:
def format_seconds(seconds):
h = int(seconds / 3600)
m = int((seconds - h * 3600) / 60)
return '{}h {}m'.format(h, m) if h > 0 else '{}m'.format(m)
After:
def format_seconds(seconds):
h = int(seconds / 3600)
if h is None:
h = 0
m = int((seconds - h * 3600) / 60)
return '{}h {}m'.format(h, m) if h > 0 else '{}m'.format(m)
This solved my problem.
Thank you! Would you like to make a pull request with the change, or should I add it?
Just installed the plugin without problems. After the restart, the screen shows "Initialized/ B:22 To:23" Started a new print, but the screen did not refreshed, just stucked there. In log I see the followings:
2024-01-18 23:35:10,016 - octoprint.printer.standard - ERROR - Exception while pushing current data to callback <octoprint_ssd1306oleddisplay.Ssd1306_oled_displayPlugin object at 0x71a63658> Traceback (most recent call last): File "/home/xxxxxxxxx/oprint/lib/python3.9/site-packages/octoprint/printer/standard.py", line 251, in _sendCurrentDataCallbacks callback.on_printer_send_current_data(data_copy) File "/home/xxxxxxxxx/oprint/lib/python3.9/site-packages/octoprint_ssd1306oleddisplay/__init__.py", line 81, in on_printer_send_current_data format_seconds(data['progress']['printTimeLeft']), File "/home/xxxxxxxxx/oprint/lib/python3.9/site-packages/octoprint_ssd1306oleddisplay/helpers.py", line 17, in format_seconds h = int(seconds / 3600) TypeError: unsupported operand type(s) for /: 'NoneType' and 'int' 2024-01-18 23:35:10,614 - octoprint.plugins.tracking - INFO - Sent tracking event print_started, payload: {'origin': 'local', 'file': 'cd3e6b49437a10b606482e8d91bcf69421ead14e'}
Also when i tried to install some libraries, as suggested I also received the following error: `xxxxxxxx@octoprint:~/oprint $ sudo apt install python3-dev python-smbus i2c-tools python3-pil python3-pip python3-setuptools python3-rpi.gpio [sudo] password for xxxxxxxxx: Reading package lists... Done Building dependency tree... Done Reading state information... Done Package python-smbus is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source
E: Package 'python-smbus' has no installation candidate xxxxxxxxxx@octoprint:~/oprint $`
Environment: Raspberry Pi 3B+ Octoprint version: 1.9.3.
Any suggestions?