I am working on a way to graph the temperatures in Graphite/Grafana, currently the only way I have discovered to do this is through the serial log however that causes system load or i/o issues.
Is there a place to hook in a simple python script for example
Where $message = "3dprinter.ultimate.HotEnd.realtemp $tool/bed $stamp"
Would like to have target temperature as well as actual temperature.
In the current model I have also defined max temperatures that are gathered from 1-wire sensors mounted close to the print head and the hot bed as well as the ambient air in the enclosure.
PI system loads never go over .4 but the print buffer to the printer empties and the printer pauses causing small blobs in the model that is printing......
Another question, how can I tell if octoprint is connected to the printer? If I try to read the API while not connected the script I have is failing otherwise it is working quite well.
Statistics really...... Simply graphs of the temperatures gathered during a print. One of my printers has the safety features of the firmware disabled and there is no OEM update available, cooking up another version of firmware would be a long process to have the same printer so I have not approached that yet. This version of the script/hack has built in temperature maximums hooked to both the firmware gathered temps and to the 1-wire temps and the ability to shut off the AC power using a DLI Web Power Switch if temps go out of spec. Just about any smart plug could be used I am sure since all it does is call an external shell script it would customize easily.
Very Pre-Beta in nature and not a great solution to the firmware lacking safety but it provided the incentive to learn how to collect the data and set some alarms/actions at least.
I went through the plugin tutorial I am going to give making the plugin a shot. I will need to learn to use the OctoPrint methods instead of using the API. I am curious if there is a list of Python modules that are included in the virtual/chroot environment? To run stand alone I had to install some modules and just installed the libraries at the OS level with apt-get.
Modules used;
import os
import signal
import sys
import time
import socket
import syslog
import smtplib
import subprocess
import requests
import stat
import os.path
I am interested in my python program using the bed temperature and the code here looked just what I want. I quite simply copied the code given by tedder42 without any changes as I am not sure I fully understand it, dangerous I know!
The result was the error message below:
Traceback (most recent call last):
File "temp2.py", line 4, in
print("extruder temp: {}, target: {}".format(temperatures['tool0']['actual'], temperatures['tool0']['target']))
TypeError: 'NoneType' object is not subscriptable
Thanks for your comments. I had noticed the age of the thread but my searches failed to anything else relevant apart from those mentioning writing a plug in. I fear the latter is beyond my limited skill with python.
The error is self-explanatory. You are trying to subscript an object which you think is a list or dict, but actually is None (i.e: the object has no value). This means that you tried to do:
None[something]
Here you attempted to index an object that doesn’t have that functionality. You might have noticed that the method sort() that only modify the list have no return value printed – they return the default None. This is a design principle for all mutable data structures in Python.
This ‘NoneType’ object is not subscriptable is the one thrown by python when you use the square bracket notation object[key] where an object doesn’t define the getitem method.