Skip to content

feat: adds Moonraker sensor charts#1885

Merged
pedrolamas merged 10 commits into
fluidd-core:developfrom
pedrolamas:feat/sensor-history-charts
Jun 23, 2026
Merged

feat: adds Moonraker sensor charts#1885
pedrolamas merged 10 commits into
fluidd-core:developfrom
pedrolamas:feat/sensor-history-charts

Conversation

@pedrolamas

@pedrolamas pedrolamas commented Jun 18, 2026

Copy link
Copy Markdown
Member

Adds Moonraker sensor charts showing history data from Moonraker.

Screenshots

image

Resolves #1883

Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
@pedrolamas pedrolamas added this to the 1.37.2 milestone Jun 18, 2026
@pedrolamas pedrolamas requested a review from Copilot June 18, 2026 12:47
@pedrolamas pedrolamas added the FR - Enhancement New feature or request label Jun 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds charting for Moonraker “Sensors” by loading historical measurements from Moonraker and appending live numeric sensor updates into per-sensor chart stores, then rendering those charts in the Sensors widget UI.

Changes:

  • Add Moonraker sensor measurement typings and a new server.sensors.measurements socket action.
  • Initialize and maintain per-sensor chart stores (sensor:<id>) from historical measurements + live sensor updates.
  • Update Sensors widget UI to show expandable panels with charts per numeric field (with “No data” fallback text).

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/typings/moonraker.sensor.d.ts Adds typings for sensor measurement history payload.
src/store/sensors/actions.ts Requests initial sensor measurements; streams live sensor updates into chart helper.
src/store/charts/mutations.ts Adds mutation to initialize a per-sensor chart store.
src/store/charts/actions.ts Adds action to build per-sensor chart data from Moonraker measurement history.
src/store/chart_helpers.ts Adds helper to append numeric sensor updates into chart series.
src/locales/en.yaml Adds app.general.label.no_data string.
src/components/widgets/sensors/Sensors.vue Reworks sensor display into expansion panels and renders charts per numeric field.
src/components/widgets/sensors/SensorChart.vue New chart component for a single sensor field.
src/api/socketActions.ts Adds serverSensorsMeasurements() calling server.sensors.measurements.

Comment thread src/components/widgets/sensors/SensorChart.vue
@mike00107

mike00107 commented Jun 18, 2026

Copy link
Copy Markdown

First impressions:

image image
  1. The chart section is collapsed by default after forcing a page reset.
  2. The charts look good overall, but the scaling needs adjustment. The Energy and Current charts appear very small compared with the Voltage and Power charts.
  3. The plotted line touches the chart boundary; it would look better with some padding or margin around the values.

Overall for me personally this is a really nice feature to have!

Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
@pedrolamas

Copy link
Copy Markdown
Member Author

Thank you @mike00107, that's perfect feedback and helps me testing this!

  • The chart section is collapsed by default after forcing a page reset.

Fluidd will now remember what section were expanded so it starts the same way when you reload the page.

  • The charts look good overall, but the scaling needs adjustment. The Energy and Current charts appear very small compared with the Voltage and Power charts.
  • The plotted line touches the chart boundary; it would look better with some padding or margin around the values.

I've now implemented some changes touching these 2 items to improve the chart max and min (max is now padded, min always shows 0 in the bottom of the chart, or goes negative when there are actually negative values)

@mike00107

mike00107 commented Jun 18, 2026

Copy link
Copy Markdown

Hey, Just pulled and extracted the patch.

image

Looking good! Will continue to use it and report any bugs.

@mike00107

mike00107 commented Jun 21, 2026

Copy link
Copy Markdown
image

After a few days of use:

  1. Better graph scaling in widgets
    It would be useful if graphs could automatically scale to fit the available widget space more effectively. For example, when displaying four graphs in one widget, each graph could resize proportionally so all four remain readable without feeling cramped.

  2. Optional average or median reference line
    Adding an optional average or median line to graphs would make it easier to understand typical usage at a glance. This would be helpful for values like average power consumption, average temperature, or other sensor trends.

  3. Ability to combine related graphs
    It would be great to allow multiple related sensors to be combined into a single graph, similar to the thermals section. For example, power, voltage, and current could be grouped together, or multiple temperature sensors could be displayed in one combined chart.

Other note: found no bugs as of now.

@pedrolamas

Copy link
Copy Markdown
Member Author
  1. Better graph scaling in widgets
    It would be useful if graphs could automatically scale to fit the available widget space more effectively. For example, when displaying four graphs in one widget, each graph could resize proportionally so all four remain readable without feeling cramped.

No saying it is impossible, but layout is quite tricky and can easily break (as I've seen a few times before). The fact that we allow 2 to 4 columns in Fluidd makes layout always very fiddly to changes...

  1. Optional average or median reference line
    Adding an optional average or median line to graphs would make it easier to understand typical usage at a glance. This would be helpful for values like average power consumption, average temperature, or other sensor trends.
  2. Ability to combine related graphs
    It would be great to allow multiple related sensors to be combined into a single graph, similar to the thermals section. For example, power, voltage, and current could be grouped together, or multiple temperature sensors could be displayed in one combined chart.

I get your point, but this is not Grafana nor will we ever get to that level! 🤣

@mike00107

Copy link
Copy Markdown

Ahh, I suspected it had something to do with the layout preset. Thank you for clarifying. As for average I can calculate that anyway in moonraker and add an extra graph!

Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.

Comment thread src/store/printer/actions.ts
Comment thread src/store/chart_helpers.ts
Comment thread src/store/charts/mutations.ts Outdated
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Comment thread src/components/widgets/sensors/Sensors.vue
Comment thread src/store/chart_helpers.ts
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread src/store/sensors/mutations.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread src/components/widgets/sensors/SensorChart.vue

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 17 changed files in this pull request and generated 1 comment.

Comment thread src/components/widgets/sensors/SensorChart.vue
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 17 changed files in this pull request and generated 1 comment.

Comment thread src/components/ui/AppInlineChart.vue

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 17 changed files in this pull request and generated 1 comment.

Comment thread src/components/widgets/sensors/SensorChart.vue
@pedrolamas

Copy link
Copy Markdown
Member Author

@mike00107 I've refactored most of the code here as I noticed the graph was missing a lot of data points. If you are able to pull the latest and give it a test, I would really appreciate it! 😁

@mike00107

Copy link
Copy Markdown

I saw the notifications, will try tomorrow!

@mike00107

mike00107 commented Jun 23, 2026

Copy link
Copy Markdown

Sensor update interval causes misleading tooltip timestamps

@pedrolamas I just pulled the latest code and noticed one (issue?) with the graph tooltip.

One important detail I forgot to mention earlier: my sensor only reports a new value every 15 seconds.

Currently, when hovering over the graph, the tooltip shows a timestamp and value for the exact hover position. This makes it look like there is new sensor data at that timestamp, even though the sensor can only provide a new reading every 15 seconds.

For example, in the video the tooltip shows a value at a specific time such as 08:53:38, but there may not actually be a real sensor reading at that exact time.

Expected behavior

I would expect the graph/tooltip to better reflect the actual reported sensor values. For example:

  • The tooltip could snap to the nearest real data point.
  • The tooltip could show the previous/last known reported value until the next update.
  • The chart could make it clearer that values are only reported every 15 seconds, instead of implying continuous updates.

The last example image is closer to what I expected: a graph based on the actual reported samples, without implying intermediate readings between sensor updates.

Possible improvement

Maybe showing timestamps on the graph, similar to the Thermals tab, could also help make this clearer.

That said, this would only be useful if it does not clutter the Sensors tab too much.

Main concern

The current hover behavior makes it look like the sensor is reporting more frequently than it actually is.

For low-frequency sensors, this can be misleading because the tooltip appears to show values at times where no real sensor update happened.

Image of current situation (after pull)

image

Video of current behaviour

Recording.2026-06-23.090412.mp4

Expected behaviour of what is logical to me

image

As always. Please correct me if there is something that i mentioned which is not doable or in the scope of Fluidd. Thank you for maintaining Fluidd and adding this new feature!

@mike00107

Copy link
Copy Markdown

Full page reload causes data to be lost

When i reload the brouwer it causes the graph to go empty and start from the beginning.

@pedrolamas

Copy link
Copy Markdown
Member Author

Thank you for your comments and review, @mike00107.

I've made some decisions here considering how Fluidd works, how Moonraker stores and reports the data, and how these sensors work.

Starting by the sensors, I have a couple of sensors myself and noticed a similar behavior to yours, where it will only report the value if there is an actual change, or after a long period.

This can easily lead to measurement errors but that is something that Moonraker or upstream devices would have to fix, so I will skip that issue altogether.

Then there is how Moonraker stores sensor history once the services starts: it will record every second, no matter if the sensor has reported a value or not - so it will just use the last known value as the current one and move on. This behavior led to an issue because when it starts, Moonraker doesn't actually have a known value for the sensor and thus records as undefined and the chart would just show undefined indefinitely (until all undefined values are purged).

Given this, I decided not to load the historical data from Moonraker to avoid this situation, and to use the same approach as to sensor data recording (use the last known value on the chart) and record a data point every second.

I will see if there is anything we can do from Fluidd side to mitigate this, but truth is that all the charts around Fluidd are using this approach (use last known value from heater/fan/sensor/etc. when recording new data point for chart)

@mike00107

Copy link
Copy Markdown

Thank you for clarifying!

@pedrolamas pedrolamas merged commit c199394 into fluidd-core:develop Jun 23, 2026
4 checks passed
@pedrolamas pedrolamas deleted the feat/sensor-history-charts branch June 23, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FR - Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graph's in the sensor section

3 participants