OctoDash icon indicating copy to clipboard operation
OctoDash copied to clipboard

Chamber temperature from thermistor without Enclosure plugin.

Open Akegata opened this issue 3 years ago • 18 comments

It would be great if we could see the chamber temperature from a chamber thermistor on the home screen without using the Enclosure plugin.

When checking the "Heated Chamber" box in the "Print bed and build volume" tab of the printer profile, the chamber temp shows up in OctoPrint. This is the temp I'd like to have next to the bed temp on the OctoDash home page.

Akegata avatar Jan 11 '22 11:01 Akegata

I would like to add an entry with the same question. I'm using Klipper with Octoprint/Octodash and set the chamber thermistor to respond to M105 with the ID "C": Example: Recv: ok B:110.1 /110.0 C:46.3 /0.0 T0:239.8 /240.0 It shows up in the Octoprint temperature tab just fine: OctoprintTemperatureTab

Would be great if this temperature could be shown on the Octodash screen as well without the need of the Enclosure plugin.

Caipitrooper avatar Mar 31 '22 07:03 Caipitrooper

Yes I agree that shouldn't be necessary to install the enclosure plugin when Octoprint already show the temperature in the UI with the chamber temperature reported with the C prefix.

lettore avatar Aug 20 '22 07:08 lettore

I also agree, it should be doable. I am unfamiliar with Octoprint's API, but I am guessing it probably expose the chamber temp in a similar way if it exist.

Currently skimming through OctoDash code trying to figure out how these things are accessed. I never touched any TypeScript (and very little JavaScript) but I guess it should not be too hard to imitate what temperatureHotendCommand calls?

Ybalrid avatar May 18 '23 19:05 Ybalrid

https://docs.octoprint.org/en/master/api/printer.html?highlight=chamber#retrieve-the-current-chamber-state

GET /api/printer/chamber should return the number as read by OctoPrint without any plugins, if there's a chamber temperature

Edit: That API endpoint "just works"

pi@voron2:~/.config/octodash$ curl -v  -H "X-Api-Key: TheAPIKeyOctoDashIsAlreadyUsing"  "http://127.0.0.1/api/printer/chamber"
*   Trying 127.0.0.1:80...
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET /api/printer/chamber HTTP/1.1
> Host: 127.0.0.1
> User-Agent: curl/7.74.0
> Accept: */*
> X-Api-Key: TheAPIKeyOctoDashIsAlreadyUsing
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< content-type: application/json
< content-length: 52
< cache-control: max-age=0
< x-clacks-overhead: GNU Terry Pratchett
< server-timing: app;dur=11
< x-robots-tag: noindex, nofollow, noimageindex
< x-content-type-options: nosniff
< x-frame-options: sameorigin
<
{"chamber":{"actual":32.8,"offset":0,"target":0.0}}
* Connection #0 to host 127.0.0.1 left intact

@UnchartedBull I am unsure where to go if I wanted to contribute a patch to this feature. Tho maybe it would be easier for you to integrate this

I guess a model needs to be created to represent the chamber data, or the one from the Enclosure plugin integration can be reused somehow?

Same question for how to get that temperature on the display.

Checking if the temperature is accessible seems to be a matter of looking up if this REST call returns status 200 or not.

Ybalrid avatar May 18 '23 19:05 Ybalrid

I suspect it would need adjustment to this section, as well as wherever the websocket updates this data.

https://github.com/UnchartedBull/OctoDash/blob/88f5a898a0ce9474325170ea0c825ea1178d3ef8/src/app/model/printer.model.ts#L1-L12

jneilliii avatar May 18 '23 20:05 jneilliii

There's a websocket involved?

Sorry, I am not familiar at all with the architecture of the application 🙂

Ybalrid avatar May 18 '23 21:05 Ybalrid

Yeah, octodash switched from api polling to websocket connection

jneilliii avatar May 18 '23 21:05 jneilliii

Looks like it's probably being set here:

https://github.com/UnchartedBull/OctoDash/blob/88f5a898a0ce9474325170ea0c825ea1178d3ef8/src/app/services/socket/socket.octoprint.service.ts#L224-L235

jneilliii avatar May 18 '23 21:05 jneilliii

image

"current" message do contain chamber temp!

Added a "chamber" temperature in the model to match, and added the following where you pointed at

      this.printerStatus.chamber = {
        current: Math.round(message?.current?.temps[0]?.chamber?.actual),
        set: Math.round(message?.current?.temps[0]?.chamber?.target),
        unit: '°C',
      }

Now, gotta get this on the webpage being displayed somehow!

I have created this draft, so in case what I am doing is not too broken I could turn this into a PR #3654

Ybalrid avatar May 18 '23 21:05 Ybalrid

If anybody in this thread is interested, the result of the code in the PR linked above adds the temperature gauge at the bottom of the screen like here

image

Ybalrid avatar May 21 '23 18:05 Ybalrid

@Ybalrid, yes I'm very interested. This is exactly what I'm looking for. Unfortunately I have no idea how I could implement this. I would have to compile the files, but this is definitely out of my comfort zone. Is there a ready made installer file for this?

Caipitrooper avatar May 29 '23 08:05 Caipitrooper

@Ybalrid, yes I'm very interested. This is exactly what I'm looking for. Unfortunately I have no idea how I could implement this. I would have to compile the files, but this is definitely out of my comfort zone. Is there a ready made installer file for this?

Yeah, you would have to checkout my branch from the pull request and get it up and running with npm and such. There are steps in CONTRIBUTING.md that explain how to do that.

Ybalrid avatar May 31 '23 16:05 Ybalrid

@Ybalrid I tried but there are error over errors coming up. I don't even know if the node.js/npm was correctly installed because there were many warnings. I guess I have to wait until the change is finally in the official release, or do you have a ready package file for Raspberry?

Caipitrooper avatar Jun 01 '23 07:06 Caipitrooper

@Ybalrid I tried but there are error over errors coming up. I don't even know if the node.js/npm was correctly installed because there were many warnings. I guess I have to wait until the change is finally in the official release, or do you have a ready package file for Raspberry?

No warranties this works for you:

Assuming you're running 64bit, I have a build. But I only tested it on an Orange Pi 3 LTS running Armbain. However, I expect it to also run on Raspberry Pi OS or OctoPi on a Raspberry Pi

https://github.com/Ybalrid/OctoDash/releases/download/chambertemp/octodash-with-standard-chamber-temp.zip

Get this, unzip it into your /home/pi directory on your Pi, then run this command

chmod +x /home/pi/linux-arm64-unpacked/octodash

Then, edit the /home/pi/.xinitrc file to replace the line that says "octodash" alone to /home/pi/linux-arm64-unpacked/octodash

That should look like this

#!/bin/sh

xset s off
xset s noblank
xset -dpms

ratpoison&
/home/pi/linux-arm64-unpacked/octodash

Then reboot everything.

To undo the above, you just undo the change you did to .xinitrc, and you delete the folder you unzipped.

Ybalrid avatar Jun 01 '23 09:06 Ybalrid

Unfortunately it doesn't work on my Raspberry 4 with Octopi (exec format error). Thank you very much for trying to help. Maybe I find somebody else who can try to compile it.

Caipitrooper avatar Jun 01 '23 10:06 Caipitrooper

Unfortunately it doesn't work on my Raspberry 4 with Octopi (exec format error). Thank you very much for trying to help. Maybe I find somebody else who can try to compile it.

It runs 32bit?

Ybalrid avatar Jun 01 '23 10:06 Ybalrid

@Caipitrooper try this https://github.com/Ybalrid/OctoDash/releases/download/chambertemp/linux-armv7l-unpacked.zip

Replace arm64 in every file path mentioned above with armv7l and give it a spin

Ybalrid avatar Jun 01 '23 10:06 Ybalrid

Finally it works. Thank you so much @Ybalrid 👍 🥇 I hope this will soon find its way into the official release as well, since this is a much better solution than the now none-supported enclosure plugin.

Caipitrooper avatar Jun 01 '23 11:06 Caipitrooper