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

feat(history): add support for Moonraker sensor history_fields #1884

Merged

Conversation

meteyou
Copy link
Member

@meteyou meteyou commented May 17, 2024

Description

This PR will add the support for Moonraker sensors with history_fields in the print history.

Related Tickets & Documents

This FR comes via discord. Here is the link to post from the user "beavis": https://discord.com/channels/758059413700345988/1239686378678128650

and this was his config example:

[mqtt]
address:192.168.0.54
enable_tls: False
username: tasmota
password: **************

[power printer]
type:tasmota
initial_state: on
off_when_shutdown: False
locked_while_printing: True
address: 192.168.0.96
#off_when_shutdown_delay: 120
bound_services: klipper

[sensor tasmota_power]
type: mqtt
state_topic: tele/tasmota_voronv02/SENSOR
state_response_template:
  {% set resp = payload|fromjson %}
  {% set edata = resp["ENERGY"] %}
  {set_result("energy", edata["Total"])}
  {set_result("voltage", edata["Voltage"])}
  {set_result("power", edata["Power"])}
  {set_result("current", edata["Current"])}
history_field_energy_consumption:
  parameter=energy
  desc=Printer energy consumption
  strategy=delta
  units=kWh
  init_tracker=true
  precision=6
  exclude_paused=false
  report_total=true
  report_maximum=true
history_field_average_current:
  parameter=current
  desc=Average current draw
  strategy=average
  units=A
  report_total=false
  report_maximum=true
# Mulitple history fields may track the same sensor parameter:
history_field_max_current:
  parameter=current
  desc=Maximum current draw
  strategy=maximum
  units=A
  init_tracker=true
  report_total=false
  report_maximum=false

Mobile & Desktop Screenshots/Recordings

in the print history list:
image

in the job details:
image

and you can also hide these cols in this list:
image

[optional] Are there any post-deployment tasks we need to perform?

Signed-off-by: Stefan Dej <meteyou@gmail.com>
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label May 17, 2024
@beavis69
Copy link

Hi, it works for me, great job
Screenshot from 2024-05-18 01-47-23

Signed-off-by: Stefan Dej <meteyou@gmail.com>
@meteyou meteyou requested review from dw-0 and rackrick May 18, 2024 08:42
Signed-off-by: Stefan Dej <meteyou@gmail.com>
@meteyou meteyou changed the title feat: add support for Moonraker sensor history_fields feat(history): add support for Moonraker sensor history_fields May 18, 2024
Signed-off-by: Stefan Dej <meteyou@gmail.com>
@meteyou meteyou requested a review from rackrick May 25, 2024 18:39
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 25, 2024
@meteyou meteyou merged commit 8bccd7e into mainsail-crew:develop May 25, 2024
11 checks passed
@meteyou meteyou deleted the feat/add-moonraker-sensors-to-history branch May 25, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants