entrippy / OctoPrint-OctoHue

Illuminate your print job and signal its status using a Philips Hue lights.
GNU Affero General Public License v3.0
18 stars 4 forks source link

Installation fails at first time; second Install without errors but plugin won´t work #20

Closed ugusko closed 10 months ago

ugusko commented 4 years ago

Hi Entrippy,

thanks for that plugin. I have updated Octoprint to the newest version 1.4.0. There after I installed your plugin. The first Installation throws the same errors like in an closed post reported (numpy). At the second installation all works fine, but... the plugin don´t work as expected. So i looked at the log and found the following lines :

2020-03-05 19:01:24,775 - octoprint.plugins.octohue - INFO - Received Event: Connected 2020-03-05 19:01:24,781 - octoprint.plugins.octohue - INFO - Setting lampid: 1 Is Group: with State: {'transitiontime': 5, 'on': True, 'xy': [0.31271163465853535, 0.3290082765355151], 'bri': 255} 2020-03-05 19:01:24,794 - octoprint.plugin - ERROR - Error while calling plugin octohue Traceback (most recent call last): File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/plugin/init.py", line 224, in call_plugin result = getattr(plugin, method)(*args, kwargs) File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_octohue/init.py", line 72, in on_event self.rgb(self._settings.get(['connectedc']),bri=255) File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_octohue/init.py", line 47, in rgb return self.set_state(state) File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_octohue/init.py", line 54, in set_state self.pbridge.lights[self._settings.get(['lampid'])].state(state) File "/home/pi/oprint/local/lib/python2.7/site-packages/qhue/qhue.py", line 43, in call r = requests.put(url, data=json.dumps(kwargs, default=list), timeout=self.timeout) File "/home/pi/oprint/local/lib/python2.7/site-packages/requests/api.py", line 131, in put return request('put', url, data=data, kwargs) File "/home/pi/oprint/local/lib/python2.7/site-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, kwargs) File "/home/pi/oprint/local/lib/python2.7/site-packages/requests/sessions.py", line 519, in request prep = self.prepare_request(req) File "/home/pi/oprint/local/lib/python2.7/site-packages/requests/sessions.py", line 462, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/home/pi/oprint/local/lib/python2.7/site-packages/requests/models.py", line 313, in prepare self.prepare_url(url, params) File "/home/pi/oprint/local/lib/python2.7/site-packages/requests/models.py", line 390, in prepare_url raise InvalidURL("Invalid URL %r: No host supplied" % url) InvalidURL: Invalid URL u'http:///api//lights/1/state': No host supplied

entrippy commented 4 years ago

Hi @ugusko,

Looking at the error (last line), it looks like the Hue Bridge Address isn't populated, and possibly also missing the Hue username (I can't test to see if it should appear right now, but I believe it should appear in the url if its printed in the error).

To bring me up to speed, can you confirm that you have created a Hue username as mentioned in the readme, that the bridge address and username are present in the settings, and also that you intend for you configuration to talk to a group of lights (room/scene/etc) as opposed to a single light, and that that groups ID is "1"?

There is some logging on startup that should confirm the presence of the bridge addr and username settings, or remind you to create them if missing.

ugusko commented 4 years ago

Hello Simon,

Yes, I have entered all nessesary information. And I also have done several boots for the complete system ;-)

Thanks for your help

Uwe

Simon Beckett notifications@github.com schrieb am Do. 5. März 2020 um 22:20:

Hi @ugusko https://github.com/ugusko,

Looking at the error (last line), it looks like the Hue Bridge Address isn't populated, and possibly also missing the Hue username (I can't test to see if it should appear right now, but I believe it should appear in the url if its printed in the error).

To bring me up to speed, can you confirm that you have created a Hue username as mentioned in the readme, that the bridge address and username are present in the settings, and also that you intend for you configuration to talk to a group of lights (room/scene/etc) as opposed to a single light, and that that groups ID is "1"?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/entrippy/OctoPrint-OctoHue/issues/20?email_source=notifications&email_token=ABRRQLX5VYIE6D2UXZZ25KTRGAJTDA5CNFSM4LCRESZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN66LJA#issuecomment-595453348, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRRQLSSBXFSC2FGYZNQLALRGAJTDANCNFSM4LCRESZA .

entrippy commented 4 years ago

Good news, I believe I've replicated the error on my live instance (installed a fresh plugin copy on a new instance running 1.4.0).

I'll update again once I've fixed it

entrippy commented 4 years ago

I have just pushed Octohue-0.4.1 and with it I performed a clean plugin install (OctoHue setting cleared from persistence) Once installed I configured the settings and immediately tried the light, and received the same error as you. After restarting octoprint, lights worked as intended.

I believe this problem is due to some sloppy code on my end where I am only initialising the Hue Bridge after start up, so changes to the bridge address and username will only be recognised each restart.

I need to add a bridge reinitialisation to on_settings_save changes are recognised immediately so that restarting is no longer required.

ugusko commented 4 years ago

Hi Simon,

thanks, works fine now. The start, cancel, connect and disconnect events are well done. The "Printing" -> "Pausing" and "Pausing" -> "Printing" Events are not triggering Octo-Hue Here´s the log 2020-03-08 11:34:06,625 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting" 2020-03-08 11:34:06,642 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: Testmuster.gcode, owner: Uwe, user: Uwe 2020-03-08 11:34:06,655 - octoprint.plugins.octohue - INFO - Received Status Event: PrintStarted 2020-03-08 11:34:06,677 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing" 2020-03-08 11:34:08,805 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Pausing" 2020-03-08 11:34:08,824 - octoprint.printer.standard.job - INFO - Print job paused - origin: local, path: Testmuster.gcode, owner: Uwe, user: Uwe 2020-03-08 11:34:08,845 - octoprint.util.comm - INFO - Changing monitoring state from "Pausing" to "Paused" 2020-03-08 11:34:12,806 - octoprint.util.comm - INFO - Changing monitoring state from "Paused" to "Cancelling" 2020-03-08 11:34:12,840 - octoprint.printer.standard.job - INFO - Print job cancelled - origin: local, path: Testmuster.gcode, owner: Uwe, user: Uwe 2020-03-08 11:34:12,870 - octoprint.util.comm - INFO - Changing monitoring state from "Cancelling" to "Operational" 2020-03-08 11:34:12,937 - octoprint.plugins.octohue - INFO - Received Status Event: PrintFailed 2020-03-08 11:34:28,659 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting" 2020-03-08 11:34:28,674 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: Testmuster.gcode, owner: Uwe, user: Uwe 2020-03-08 11:34:28,682 - octoprint.plugins.octohue - INFO - Received Status Event: PrintStarted 2020-03-08 11:34:28,716 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing" 2020-03-08 11:34:29,736 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Pausing" 2020-03-08 11:34:29,757 - octoprint.printer.standard.job - INFO - Print job paused - origin: local, path: Testmuster.gcode, owner: Uwe, user: Uwe 2020-03-08 11:34:29,773 - octoprint.util.comm - INFO - Changing monitoring state from "Pausing" to "Paused" 2020-03-08 11:34:32,873 - octoprint.util.comm - INFO - Changing monitoring state from "Paused" to "Cancelling" 2020-03-08 11:34:32,912 - octoprint.printer.standard.job - INFO - Print job cancelled - origin: local, path: Testmuster.gcode, owner: Uwe, user: Uwe 2020-03-08 11:34:32,948 - octoprint.util.comm - INFO - Changing monitoring state from "Cancelling" to "Operational" 2020-03-08 11:34:33,004 - octoprint.plugins.octohue - INFO - Received Status Event: PrintFailed 2020-03-08 11:34:42,216 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Offline" 2020-03-08 11:34:42,224 - octoprint.plugins.octohue - INFO - Received Status Event: Disconnected 2020-03-08 11:34:44,512 - octoprint.util.comm - INFO - Changing monitoring state from "Offline" to "Opening serial port" 2020-03-08 11:34:44,522 - octoprint.util.comm - INFO - Changing monitoring state from "Opening serial port" to "Connecting" 2020-03-08 11:34:51,376 - octoprint.util.comm - INFO - Changing monitoring state from "Connecting" to "Offline" 2020-03-08 11:34:51,389 - octoprint.plugins.octohue - INFO - Received Status Event: Disconnected 2020-03-08 11:34:57,358 - octoprint.util.comm - INFO - Changing monitoring state from "Offline" to "Detecting serial port" 2020-03-08 11:34:57,394 - octoprint.util.comm - INFO - Changing monitoring state from "Detecting serial port" to "Opening serial port" 2020-03-08 11:34:57,399 - octoprint.util.comm - INFO - Changing monitoring state from "Opening serial port" to "Connecting" 2020-03-08 11:35:04,839 - octoprint.util.comm - INFO - Changing monitoring state from "Connecting" to "Offline" 2020-03-08 11:35:04,853 - octoprint.plugins.octohue - INFO - Received Status Event: Disconnected 2020-03-08 11:35:08,052 - octoprint.util.comm - INFO - Changing monitoring state from "Offline" to "Opening serial port" 2020-03-08 11:35:08,059 - octoprint.util.comm - INFO - Changing monitoring state from "Opening serial port" to "Detecting baudrate" 2020-03-08 11:35:09,085 - octoprint.util.comm - INFO - Changing monitoring state from "Detecting baudrate" to "Operational" 2020-03-08 11:35:09,112 - octoprint.plugins.octohue - INFO - Received Status Event: Connected

Kind regards Uwe

Am So., 8. März 2020 um 11:49 Uhr schrieb Simon Beckett < notifications@github.com>:

I have just pushed Octohue-0.4.1 and with it I performed a clean plugin install (OctoHue setting cleared from persistence) Once installed I configured the settings and immediately tried the light, and received the same error as you. After restarting octoprint, lights worked as intended.

I believe this problem is due to some sloppy code on my end where I am only initialising the Hue Bridge after start up, so changes to the bridge address and username will only be recognised each restart.

I need to add a bridge reinitialisation to on_settings_save changes are recognised immediately so that restarting is no longer required.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/entrippy/OctoPrint-OctoHue/issues/20?email_source=notifications&email_token=ABRRQLSAILZ4TVIXIKHIBNLRGNZ3XA5CNFSM4LCRESZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOESSXA#issuecomment-596191580, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRRQLW6YW4FDRECMF4CM4DRGNZ3XANCNFSM4LCRESZA .

entrippy commented 4 years ago

Good to hear things are moving forward.

To make sure I understand you properly, most things are now up and working, however transitioning between print and pause is not correct?

ugusko commented 4 years ago

Hi Simon,

Yes that’s correct

Uwe

Simon Beckett notifications@github.com schrieb am So. 8. März 2020 um 13:25:

Good to hear things are moving forward.

To make sure I understand you properly, most things are now up and working, however transitioning between print and pause is not correct?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/entrippy/OctoPrint-OctoHue/issues/20?email_source=notifications&email_token=ABRRQLT6M52GY6IKJPHOSD3RGOFCVA5CNFSM4LCRESZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOEUTZQ#issuecomment-596199910, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRRQLQCXXA46PE2ZR66FNTRGOFCVANCNFSM4LCRESZA .

entrippy commented 4 years ago

Hi @ugusko I believe the problem you are having is that "Paused" is not an event that is sent to Octoprint by the printer. As per OctoPrint Available Events the closest event I can see would be PrintPaused.

To make life a little easier, I have pushed 0.4.2, which contains an additional debug log command that will print every status event OctoHue receives, while the normal info level logging only records the status event that matches. Just remember to switch your logging back to info level once you have things nailed down.

entrippy commented 4 years ago

Hi @ugusko , can you confirm if this is resolved or if you're still experiencing problems?

ugusko commented 4 years ago

Hi Simon, seems like there are some states, with no connection to hue Take a look at the log Uwe

Simon Beckett notifications@github.com schrieb am Di. 10. März 2020 um 12:17:

Hi @ugusko https://github.com/ugusko , can you confirm if this is resolved or if you're still experiencing problems?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/entrippy/OctoPrint-OctoHue/issues/20?email_source=notifications&email_token=ABRRQLQW3E6ZXDCVKHMXDBTRGYOURA5CNFSM4LCRESZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOLACAA#issuecomment-597033216, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRRQLWPZRT5MOH3QK775N3RGYOURANCNFSM4LCRESZA .

entrippy commented 4 years ago

Hi @ugusko, which log are you referring to?

In the log you included 3 days ago, you included a number of status updates logged by octoprint.printer.standard.job and octoprint.util.comm, such as octoprint.printer.standard.job - INFO - Print job cancelled - origin: local, path: Testmuster.gcode, owner: Uwe, user: Uwe and 2020-03-08 11:34:08,805 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Pausing" Neither of these are valid state messages from Octoprints event handler, as such can't be used for triggering octohue. As per my last reply printer status events are documented in https://docs.octoprint.org/en/master/events/index.html#sec-events-available-events.

The fact that I cannot see any log messages like : 2020-03-08 11:35:04,853 - octoprint.plugins.octohue - INFO - Received Status Event: PrintPaused or 2020-03-08 11:35:04,853 - octoprint.plugins.octohue - INFO - Received Status Event: PrintResumed

Suggests to me you have configured things incorrectly.

If you require further help, please include the specific event states you are using and perhaps a screenshot of your settings (username redacted for security)

ugusko commented 4 years ago

Hi Simon

thanks for the hint... it seems to me, that PrintStarted, PrintDone, PrintResumed, PrintFailed, Connected, Disconnected works fine. All new status events ( PrintPaused, PrintCancelling, PrintCancelled ) are not continuesly saved. After restart OctoPrint all new entered status events are gone. In the meantime i rebooted OctoPrint a lot of times; also deleted and re-installed OctoHue completely. Oh, by the way, i switched from german to english in the hope that solves the problem...

Here´s my actual Log: 2020-03-11 17:59:53,887 - octoprint.util.comm - INFO - Changing monitoring state from "Offline" to "Detecting serial port" 2020-03-11 17:59:53,923 - octoprint.util.comm - INFO - Changing monitoring state from "Detecting serial port" to "Opening serial port" 2020-03-11 17:59:53,931 - octoprint.util.comm - INFO - Changing monitoring state from "Opening serial port" to "Detecting baudrate" 2020-03-11 17:59:54,964 - octoprint.util.comm - INFO - Changing monitoring state from "Detecting baudrate" to "Operational" 2020-03-11 17:59:54,984 - octoprint.plugins.octohue - INFO - Received Configured Status Event: Connected 2020-03-11 18:00:19,249 - octoprint.plugins.logging - INFO - Setting logger octoprint level to 20 2020-03-11 18:00:28,090 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Offline" 2020-03-11 18:00:28,105 - octoprint.plugins.octohue - INFO - Received Configured Status Event: Disconnected 2020-03-11 18:00:33,673 - octoprint.util.comm - INFO - Changing monitoring state from "Offline" to "Detecting serial port" 2020-03-11 18:00:33,812 - octoprint.util.comm - INFO - Changing monitoring state from "Detecting serial port" to "Opening serial port" 2020-03-11 18:00:33,819 - octoprint.util.comm - INFO - Changing monitoring state from "Opening serial port" to "Detecting baudrate" 2020-03-11 18:00:34,845 - octoprint.util.comm - INFO - Changing monitoring state from "Detecting baudrate" to "Operational" 2020-03-11 18:00:34,874 - octoprint.plugins.octohue - INFO - Received Configured Status Event: Connected 2020-03-11 18:00:38,262 - octoprint.printer.standard.job - INFO - Print job selected - origin: local, path: BMW-Test4_Schaum.gcode, owner: Uwe, user: Uwe 2020-03-11 18:00:38,448 - octoprint.plugins.bettergrblsupport - INFO - finished reading file length=60 width=90 2020-03-11 18:00:40,178 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting" 2020-03-11 18:00:40,193 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: BMW-Test4_Schaum.gcode, owner: Uwe, user: Uwe 2020-03-11 18:00:40,199 - octoprint.plugins.octohue - INFO - Received Configured Status Event: PrintStarted 2020-03-11 18:00:40,253 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing" 2020-03-11 18:00:48,054 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Pausing" 2020-03-11 18:00:48,074 - octoprint.printer.standard.job - INFO - Print job paused - origin: local, path: BMW-Test4_Schaum.gcode, owner: Uwe, user: Uwe 2020-03-11 18:00:48,102 - octoprint.util.comm - INFO - Changing monitoring state from "Pausing" to "Paused" 2020-03-11 18:00:53,042 - octoprint.util.comm - INFO - Changing monitoring state from "Paused" to "Resuming" 2020-03-11 18:00:53,065 - octoprint.printer.standard.job - INFO - Print job resumed - origin: local, path: BMW-Test4_Schaum.gcode, owner: Uwe, user: Uwe 2020-03-11 18:00:53,074 - octoprint.plugins.octohue - INFO - Received Configured Status Event: PrintResumed 2020-03-11 18:00:53,104 - octoprint.util.comm - INFO - Changing monitoring state from "Resuming" to "Printing" 2020-03-11 18:00:55,099 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Pausing" 2020-03-11 18:00:55,107 - octoprint.printer.standard.job - INFO - Print job paused - origin: local, path: BMW-Test4_Schaum.gcode, owner: Uwe, user: Uwe 2020-03-11 18:00:55,117 - octoprint.util.comm - INFO - Changing monitoring state from "Pausing" to "Paused" 2020-03-11 18:00:57,979 - octoprint.util.comm - INFO - Changing monitoring state from "Paused" to "Cancelling" 2020-03-11 18:00:58,016 - octoprint.printer.standard.job - INFO - Print job cancelled - origin: local, path: BMW-Test4_Schaum.gcode, owner: Uwe, user: Uwe 2020-03-11 18:00:58,044 - octoprint.util.comm - INFO - Changing monitoring state from "Cancelling" to "Operational" 2020-03-11 18:00:58,077 - octoprint.plugins.octohue - INFO - Received Configured Status Event: PrintFailed

entrippy commented 4 years ago

Ok, so the problem is the settings getting lost between reboots. Let me take a look.

entrippy commented 10 months ago

the problem of saving settings between reboots has been resolved in 0.4.4 Unfortunately you will need to either reinstall octohue including cleaning up its settings, or manuallty remove statusDict from the config.yaml.