RS 1.2.1 and HomeAssistant Integration broken?
I just updated from RS 1.2.0 to 1.2.1 and the entities no longer appear in HomeAssistant.
I have had HA and RS working together for a good 6 months and never had an issue before with upgrades..
Anything I can check to see why its not working? The webcam feed, not via the RS API, works still.
I have had HA and RS working together for a good 6 months and never had an issue before with upgrades..
Anything I can check to see why its not working? The webcam feed, not via the RS API, works still.
Comments
This is the setup:
The HA Log reports an error with the RS integration, it is missing "activeExtruder":
Logger: homeassistant.setup
Error during setup of component repetierSource: components/repetier/__init__.py:237 < https://github.com/marthoc/home-assistant/blob/dev/homeassistant/components/repetier/__init__.py >
First occurred: 10:06:59 PM (1 occurrences)
Last logged: 10:06:59 PM
It seems someone reported an issue earlier on another location - https://github.com/home-assistant/core/issues/59430 . this was working for me 2 days ago on the current HA version with RS 1.2.0; I updated to 1.2.1 today and noticed it was not; maybe something else is the cause?
{"data":[{"active":true,"job":"none","jobid":0,"name":"Aquila","online":1,"pauseState":0,"paused":false,"slug":"Aquila"},{"active":true,"job":"none","jobid":0,"name":"Ender 3 v2","online":0,"pauseState":0,"paused":false,"slug":"Ender_3_v2"},{"active":true,"job":"none","jobid":0,"name":"Ender 6","online":0,"pauseState":0,"paused":false,"slug":"Ender_6"}]}
And then the printer slug level IPAddress/printer/api/Aquila?a=stateList&apikey=KEY
{"Aquila":{"activeExtruder":0,"autostartNextPrint":false,"condition":1,"conditionReason":"","debugLevel":6,"doorOpen":false,"extruder":[{"error":0,"output":0.0,"tempRead":29.2,"tempSet":0.0}],"fans":[{"on":false,"voltage":0}],"filterFan":false,"firmware":"Marlin","firmwareStyle":"marlin","firmwareURL":"","flowMultiply":100,"hasXHome":true,"hasYHome":true,"hasZHome":true,"heatedBeds":[{"error":0,"output":0.0,"tempRead":34.7,"tempSet":0.0}],"heatedChambers":[],"layer":2,"lights":0,"notification":"Aquila Ready.","numExtruder":1,"powerOn":true,"rec":false,"sdcardMounted":true,"shutdownAfterPrint":false,"speedMultiply":100,"volumetric":false,"x":150.5229949951172,"y":148.2550048828125,"z":0.2000000029802322},"Ender_3_v2":{"condition":5,"conditionReason":"","firmwareStyle":"marlin"},"Ender_6":{"condition":5,"conditionReason":"","firmwareStyle":"marlin"}}
Should the SLUG level API return to the other printers as well? Should it be limited to just in my query the Aqulia? I have not updated the HomeAssistant for several months and on the 2021.8 build.
Looking inside the clsprinter.py file on my HA installation, the error is around the ActiveExtruder -
To my understanding of the code, its fetching the same URL as I tested above. Then going into the array under the slug. Therefore, it should work as expected.. or am I crazy..
One problem might be that it uses
https://pypi.org/project/pyrepetier/3.0.5/#files
which points to non existent github url, so guess that project was abadonned.
On the other side our answer has not really changed, so see no reason that it should not work if it did before.
Is it safe to downgrade my RPi back to 1.2.0 for testing?
Would there be any logs within RS for the API calls to see if its calling the correct endpoint/apikey?
There is no log for all the communication. Normally you see it in server for our gui if needed so wanting to reduce writes for pi and safe a lot of disk space. Only way would be a network sniffer like wireshark on windows.
Im not sure how easily i can get wireshark on the Pi for local traffic.. maybe ill install RS on another box and see if i can trouble shoot it that way.
Once i get it fixed, ill post back
Today I updated Repetier Server to 1.2.1 and the HA integration is not working anymore.
The HA integration is also outdated and definitely needs some love, but the developer has no time/interest doing so.
Looking at the WebSocket responses, activeExtruder is (now) only returned if a printer is powered on. The HA integration is explicitly looking for that key so fails on startup if it is not present (for any installed printer). I tried powering on all of my printers, restarted Home Assistant and with all the printers on, the Home Assistant integration starts without issue. I have posted my findings on the HA Github, but there has obviously been a change in RS 1.2.1 which no longer exposes the activeExtruder key if a printer is off.
I would be happy to test on my HA installation if it would assist.
Having said that, the Try/Catch to obtain the Raw Data based on the Slug (data = rawdata[self._slug]) in clsprinter.py should not actually be fetching the other printers data anyway..
Anyway, I am happy to test as needed as well. Thanks again for the awesome support!
Kind regards,
Gurry
Hopefully next week we also have a new update 1.2.2 with MQTT including direct homeassistant integration. No plugin required than any more. Works already great in my test and we can provide better support as for an outdated plugin from 3rd party.
Current version is 2022.2.3
Yes, this is the automation i have working currently in Klipper, I also have a small program in Linux that shuts down the computer at a certain time, i only used it for my late night prints. It runs off the Idle timeout period.
[gcode_macro POWEROFF]
MQTT messages only stay if the retain flag is enabled. You can send your own message/topic using
@mqttPublish topic message [QoS] [retain]
Publishes
message
with the topictopic
. Use this for specialized messages to other devices that need this as input.QoS
is the Quality Of Service and can be 0 (try to send to subscribers), 1 (ensure at least one receive to subscribers) or 2 (ensure 1 message per subscriber) with default 0. Higher quality means higher latency.retain
can be 0 or 1. With 1 the message will be kept on broker, while with 0 the message will disappear after disconnection.So a power off function might look like this:
@func shutdown
@execute shutdown
@endfunc
@func powerOff
@mqttPublish your message
@timedCall powerOff 2000 shutdown
@endfunc
You can add it in run on connect if you like. Then you can call it from everywhere. Not handled by klipper directly, but who cares as long as job is done. It sends topic, waits 2 seconds so mqtt has received it and then calls shutdown.
HA must of course delete the topic once seen so it does not always power off since the retain will keep it for ever or as long as MQTT runs.
if both are on the same circuit, you can maybe add one of the Kasa Smart Plugs dedicated to the printer, then you can first shut off the plug to the printer and then the server. That is how i have mine setup and trying to get it to work.
@Repetier
are you saying i can add additional functions to MQTT for each of the ones you listed? then the @mqttPublish would be the IP address of the Smart Plug? Is it actually that simple?