Implemented temperature and humidity display in graph #392
@@ -150,7 +150,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
|
||||
self.print_complete = False
|
||||
|
||||
def get_settings_version(self):
|
||||
return 8
|
||||
return 9
|
||||
|
||||
def on_settings_migrate(self, target, current=None):
|
||||
self._logger.warn("######### current settings version %s target settings version %s #########", current, target)
|
||||
@@ -158,9 +158,10 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
|
||||
self._logger.info("rpi_outputs: %s", self.rpi_outputs)
|
||||
self._logger.info("rpi_inputs: %s", self.rpi_inputs)
|
||||
self._logger.info("######### End Current Settings #########")
|
||||
if current >= 4 and target == 8:
|
||||
self._logger.warn("######### migrating settings to v8 #########")
|
||||
if current >= 4 and target == 9:
|
||||
self._logger.warn("######### migrating settings to v9 #########")
|
||||
old_outputs = self._settings.get(["rpi_outputs"])
|
||||
old_inputs = self._settings.get(["rpi_inputs"])
|
||||
for rpi_output in old_outputs:
|
||||
if 'shutdown_on_failed' not in rpi_output:
|
||||
rpi_output['shutdown_on_failed'] = False
|
||||
@@ -190,6 +191,10 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
|
||||
rpi_input['temp_i2c_address'] = 1
|
||||
if 'temp_i2c_register' not in rpi_input:
|
||||
rpi_input['temp_i2c_register'] = 1
|
||||
if 'show_graph_temp' not in rpi_input:
|
||||
rpi_input['show_graph_temp'] = False
|
||||
if 'show_graph_humidity' not in rpi_input:
|
||||
rpi_input['show_graph_humidity'] = False
|
||||
self._settings.set(["rpi_inputs"], old_inputs)
|
||||
else:
|
||||
self._logger.warn("######### settings not compatible #########")
|
||||
@@ -2118,6 +2123,15 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
|
||||
comm_instance._log("Setting TEMP/HUM control output %s to value %s" % (index_id, set_value))
|
||||
return
|
||||
|
||||
def get_graph_data(self, comm, parsed_temps):
|
||||
for sensor in list(filter(lambda item: item['input_type'] == 'temperature_sensor', self.rpi_inputs)):
|
||||
if sensor["show_graph_temp"]:
|
||||
parsed_temps[str(sensor["label"])] = (sensor['temp_sensor_temp'], None)
|
||||
if sensor["show_graph_humidity"]:
|
||||
parsed_temps[str(sensor["label"])+" Humidity"] = (sensor['temp_sensor_humidity'], None)
|
||||
|
||||
return parsed_temps
|
||||
|
||||
|
||||
__plugin_name__ = "Enclosure Plugin"
|
||||
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||
@@ -2130,5 +2144,6 @@ def __plugin_load__():
|
||||
global __plugin_hooks__
|
||||
__plugin_hooks__ = {
|
||||
"octoprint.comm.protocol.gcode.queuing" : __plugin_implementation__.hook_gcode_queuing,
|
||||
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
|
||||
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information,
|
||||
"octoprint.comm.protocol.temperatures.received": (__plugin_implementation__.get_graph_data, 1)
|
||||
}
|
||||
|
||||
@@ -466,7 +466,9 @@ $(function () {
|
||||
temp_sensor_i2cbus: ko.observable(1),
|
||||
temp_i2c_bus: ko.observable(1),
|
||||
temp_i2c_address: ko.observable(1),
|
||||
temp_i2c_register: ko.observable(1)
|
||||
temp_i2c_register: ko.observable(1),
|
||||
show_graph_temp: ko.observable(false),
|
||||
show_graph_humidity: ko.observable(false)
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -859,6 +859,24 @@
|
||||
</label>
|
||||
<span class="help-inline">Enable and disable temperature on navbar</span>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: show_graph_temp"> {{ _('Show temperature in graph') }}
|
||||
</label>
|
||||
<span class="help-inline">Enable to show temperature in temperature graph, when a printer is connected.
|
||||
<!-- ko if: ($data.show_graph_temp()) -->
|
||||
<p><i><strong>Note:</strong>This feature currently requires a custom graph plugin like <a href="https://github.com/jneilliii/OctoPrint-PlotlyTempGraph" target="_blank">PlotlyTempGraph</a></i></span></p>
|
||||
<!-- /ko -->
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: show_graph_humidity"> {{ _('Show humidity in graph') }}
|
||||
</label>
|
||||
<span class="help-inline">Enable to show humidity in temperature graph, when a printer is connected.
|
||||
<!-- ko if: ($data.show_graph_humidity()) -->
|
||||
<p><i><strong>Note:</strong>This feature currently requires a custom graph plugin like <a href="https://github.com/jneilliii/OctoPrint-PlotlyTempGraph" target="_blank">PlotlyTempGraph</a></i></span></p>
|
||||
<!-- /ko -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /ko -->
|
||||
<div class="control-group">
|
||||
|
||||
Reference in New Issue
Block a user