Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chamber temperature from thermistor without Enclosure plugin. #2562

Open
Akegata opened this issue Jan 11, 2022 · 18 comments
Open

Chamber temperature from thermistor without Enclosure plugin. #2562

Akegata opened this issue Jan 11, 2022 · 18 comments
Labels
enhancement New feature or request

Comments

@Akegata
Copy link

Akegata commented Jan 11, 2022

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 Akegata added the enhancement New feature or request label Jan 11, 2022
@Caipitrooper
Copy link

Caipitrooper commented Mar 31, 2022

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.

@lettore
Copy link

lettore commented Aug 20, 2022

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.

@Ybalrid
Copy link

Ybalrid commented May 18, 2023

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
Copy link

Ybalrid commented May 18, 2023

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.

@jneilliii
Copy link
Contributor

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

export interface PrinterStatus {
status: PrinterState;
bed: Temperature;
tool0: Temperature;
fanSpeed: number;
}
interface Temperature {
current: number;
set: number;
unit: string;
}

@Ybalrid
Copy link

Ybalrid commented May 18, 2023

There's a websocket involved?

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

@jneilliii
Copy link
Contributor

Yeah, octodash switched from api polling to websocket connection

@jneilliii
Copy link
Contributor

Looks like it's probably being set here:

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

@Ybalrid
Copy link

Ybalrid commented May 18, 2023

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
Copy link

Ybalrid commented May 21, 2023

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

@Caipitrooper
Copy link

Caipitrooper commented May 29, 2023

@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?

@Ybalrid
Copy link

Ybalrid commented May 31, 2023

@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.

@Caipitrooper
Copy link

@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?

@Ybalrid
Copy link

Ybalrid commented Jun 1, 2023

@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.

@Caipitrooper
Copy link

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.

@Ybalrid
Copy link

Ybalrid commented Jun 1, 2023

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
Copy link

Ybalrid commented Jun 1, 2023

@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

@Caipitrooper
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants