Closed puterboy closed 1 year ago
Will look.
Implemented as "Hide if printer is disconnected" is next version
Should be fixed in https://github.com/LazeMSS/OctoPrint-TopTemp/releases/tag/0.0.2.0 - please reopen if not working/fixed as expected
Works only partially...
Perhaps you are only checking/triggering on printer disconnect and need to also check when Octoprint starting
Sorry this does not make sense to me...
Could you post screenshot of the temp sensor you are trying to hide and maybe explain in more details what your expecting
if you disconnect the printer while octoprint is running then yes the printer is offline
The specific example is that I want to display the temperature from the Einsy temperature sensor on my Prusa. Here is a fragment of the setup I use for a custom sensor in your TopTemp plugin:
Name: Einsy
Type: From printer
*Regexp: (?:T|T0):.*? A:([^ ]+)
-Only show while printer is printing
+Hide if printer is disconnected
-Input is a temperature value
+Show overlay with more details on mouse hover
+Show temperature unit symbol
*Label: "Einsy "
Obviously, this sensor will only be able to read data when the printer is connected. Indeed, I would think that the "From Printer" type should DEFAULT to only appearing when the printer is connected.
With the above setting, I get the following behavior:
This leads me to suspect that the logic for "Hide if printer is disconnected" is only partially implemented and perhaps is only triggered when the printer is disconnected but not checked at startup to see the state of the printer.
Hope this helps.
The only reason I had requested the "Hide if No Printer" feature was to cover the case of the Einsy temperature sensor but now I realize that this feature request may not even be necessary since ideally the whole "From printer" type should only display if the printer is connected.
Also looking at the code in TopTemp.js, it seems like the sensor should not be displayed if there is no valid data regardless of the value of hideIfNoPrinter
// Do know this or want it shown
if (typeof iSettings == "undefined"
|| iSettings.show() == false
|| data.actual == null
|| data.actual == undefined
|| (data.target == 0 && iSettings.hideOnNoTarget())
|| (!customType && self.settings.hideInactiveTemps() && self.tempModel.isOperational() !== true)
|| ('waitForPrint' in iSettings && iSettings.waitForPrint() && !self.connection.isPrinting())
|| ('hideIfNoPrinter' in iSettings && iSettings.hideIfNoPrinter() && !self.tempModel.isOperational())
){
$('#navbar_plugin_toptemp_'+name).hide();
$('#navbar_plugin_toptemp_'+name+'_divider').hide();
return;
}else{
$('#navbar_plugin_toptemp_'+name).show();
$('#navbar_plugin_toptemp_'+name+'_divider').show();
}
I haven't dived deeply into the code, but shouldn't "data.actual == null" and/or "data.actual == undefined" alone be sufficient to hide the sensor when the Printer is not connected? And if true, the "hideIfNoPrinter" functionality may not even be necessary in the first place.
Either way, I'm not sure why the Einsy sensor displays when the printer is off...
Anyway, attached is a screenshot of what happens when I restart Octoprint with the printer off (and hence disconnected):
Note that the first whirling-circle is supposed to be the Outdoor temperature but it is now about -3degC outside (i.e. cold!), so that fails as per my other bug report. The last whirling circle is the one caused by the printer being off when trying to get the Einsy temperature (as per the config above).
Basically the logic is using the standard octoprint way of handling stuff - based on your screenshot and if you have checked "Hide if printer is disconnected" then the last spinning circle should not be there but maybe its because it delayed/not getting data due to the other bug.
Should be fixed now: https://github.com/LazeMSS/OctoPrint-TopTemp/releases/tag/0.0.2.1
Thanks! Works!!
Minor display bug here. When the sensor first turns on, there is no leading white space around the spacer. If printer is turned off and then on again, the white space appears correctly.
Minor display bug here. When the sensor first turns on, there is no leading white space around the spacer. If printer is turned off and then on again, the white space appears correctly.
Please make new issues instead of adding to existing issues when not related. The missing spacing is probably missing due the way the spacing is made by giving the last item a margin of 0px - but im not 100% sure - i could not recreate - it could be due to the number of sensors shown/hidden etc.
Sorry for all these wish list requests but I really love your plugin :)
Some custom options like the Einsy board temperature are only available when the printer is connected (not just when printing) -- so if not connected, then I get a "spinning thing" in the toolbar.