Coder Social home page Coder Social logo

marcolivierarsenault / moonraker-home-assistant Goto Github PK

View Code? Open in Web Editor NEW
225.0 225.0 25.0 8.46 MB

Home Assistant integration for Moonraker, Klipper and Mainsail

Home Page: https://moonraker-home-assistant.readthedocs.io

License: MIT License

Python 99.77% Shell 0.23%
hacs home-assistant klipper moonraker

moonraker-home-assistant's People

Contributors

benbergman avatar busheezy avatar cashew22 avatar dependabot[bot] avatar leokeba avatar linw1995 avatar marcolivierarsenault avatar master92 avatar nelsongraca avatar reemo3dp avatar ressu avatar sam565 avatar tehmaze avatar thejefe avatar tyron avatar vyolex avatar wolfecub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

moonraker-home-assistant's Issues

Use port below 1024 - moonraker behind reverse proxy

Hi.
I have moonraker behind reverse proxy and I use it over HTTPS. But at configuration stage I cannot use port with number lower than 1024. Why is there such a validation?
Mainsail have no problem with moonraker on port 443.

Control PWM Heater Outputs - LEDs

Is your feature request related to a problem? Please describe.

I would like to be able to control my chamber lighting through HASS.

Describe your setup

I have chamber lighting that is controlled via PWM on a 24v heater output. The config for this is here.

[output_pin daylight]
pin: PB11 #HE3
pwm: True
cycle_time: 0.01

This is controllable via the Mainsail UI (0.0 > 1, shown in the UI as 0% - 100%).

Describe the solution you'd like

It would be nice for this to be exposed to HASS and ideally have control over the brightness and not just on/off, currently, this is not picked up by the integration at all.

Cheers :)

Values differ and no camera

I really like the idea of having access to Moonraker through HA and the connection in general works like a charm through, but looking into the details, there is something wrong with the values.
F.e. the camera was not added to HA while I actually have it up and running in klipper, the progress percentage is about 10% lower than in the klipper interface, timing is showing as seconds,...
My setup is a Creality SonicPad running klipper and Home Assistant 2023.3.3

Add 'Print Time Remaining' as sensor

In an older configuration for Moonraker in HA, I was able to retrieve the remaining print time for my printer (as a countdown). In this integration, I only see the ETA and print durations, not the remaining print time.

Here's the YAML from the previous config:

- name: 3d_printer_time_remaining
  unique_id: "<moonraker-ip-address>e12c8def-5ebe-43a4-9f75-605a0c46fc0f"
  state: '{{ (((states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"]/states.sensor.printer_3d_sensor.attributes["display_status"]["progress"]- states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"]) if states.sensor.printer_3d_sensor.attributes["display_status"]["progress"]>0 else 0)) | timestamp_custom("%H:%M:%S", 0)}}'
  availability: >
    {% set items = ['sensor.printer_3d_sensor'] %}
    {{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
      |list|count == items|count }}
  icon: mdi:timer-sand
  attributes:
    friendly_name: "Time Remaining"

Could we have this implemented? Thanks!

[speeder pad of FLSUN] Camera into Home Assistant

Hello

I have install the integration on my Home Assistant and it was connected nice with the speeder pad of my printer 3D FLSUN V400

For complete the information : FL SUN V400 has a tablet speeder pad where is installed into this pad Mainsail, moonraker and klipper....

My webcam is connected to the speeder pad and I have access to the video into the URL Mainsail....
How does I must do for to have the video into Home Assistant ? If it possible

No sensor data available

Version of the moonraker integration

0.8.0

Describe your setup

I am using the moonraker integration with a Sonic Pad.

Describe the bug

I am getting some of the entities, but no sensor entities (no process, no temperature) only the filament sensor is showing up.

Moonraker Logs

Is attached.

home-assistant_2023-04-24T23-55-46.678Z.log

'Retrying setup: None' Error

image

Running into the persistent error when adding a new moonraker device of "Retrying setup: None". I am unable to view any of the devices or sensors after setup.

Running HACS Moonraker version 0.3.1

Here's what I found in the log:

2023-03-05 21:13:27.370 ERROR (MainThread) [custom_components.moonraker] Unexpected error fetching moonraker data: 'thumbnails'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 239, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/moonraker/__init__.py", line 102, in _async_update_data
    thumbnail = await self._async_get_thumbnail(
  File "/config/custom_components/moonraker/__init__.py", line 113, in _async_get_thumbnail
    "thumbnails": gcode["thumbnails"][len(gcode["thumbnails"]) - 1][
KeyError: 'thumbnails'
2023-03-05 21:13:27.372 WARNING (MainThread) [homeassistant.config_entries] Config entry 'mainsailos' for moonraker integration not ready yet: None; Retrying in background
2023-03-05 21:13:33.151 ERROR (MainThread) [custom_components.moonraker] Unexpected error fetching moonraker data: 'thumbnails'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 239, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/moonraker/__init__.py", line 102, in _async_update_data
    thumbnail = await self._async_get_thumbnail(
  File "/config/custom_components/moonraker/__init__.py", line 113, in _async_get_thumbnail
    "thumbnails": gcode["thumbnails"][len(gcode["thumbnails"]) - 1][
KeyError: 'thumbnails'

Cannot rename config entry (within Devices & Services)

image

After a fresh install, every time I try and rename the default config entry of "mainsailos" in the Devices & Services menu, it is reset back to "mainsailos" after I navigate away from the menu.

Small issue but I would like to be able to rename it.

Running release v0.2.0 via HACS. No logging or debugging info needed.

no integration auto restart/recheck when moonraker is not available?

If the 3d printer/moonraker is not online when HA reboots, then the integration goes into error at starting and doesn't recover (aka rechecks) automatically.
But if I'm using the http rest call + manual template sensors derived from the rest call result in the configuration.yaml (my old way), then these come back 'alive' automatically.

I do prefer an integration, as you've built, but the need to manually restart it whenever I need to see the info of the printer (after a restart of HA when the printer was off), is kind of limiting.

Any chance of improving that behaviour?

No camera entity created

Version of the moonraker integration

newest

Describe your setup

RPI with Moonraker & Mainsail in Docker container
HA 2023.6

Describe the bug

Every entity is created within HA except the camera

Moonraker Logs

Local webcam configured in Mainsail /webcam/?action=stream

HA:

Logger: py.warnings
Source: components/camera/img_util.py:64
First occurred: 09:37:10 (30 occurrences)
Last logged: 09:51:20

/usr/local/lib/python3.11/site-packages/turbojpeg.py:880: UserWarning: Corrupt JPEG data: 7149 extraneous bytes before marker 0xd9 warnings.warn(self.__get_error_string(handle))
/usr/local/lib/python3.11/site-packages/turbojpeg.py:880: UserWarning: Corrupt JPEG data: 7122 extraneous bytes before marker 0xd9 warnings.warn(self.__get_error_string(handle))
/usr/local/lib/python3.11/site-packages/turbojpeg.py:880: UserWarning: Corrupt JPEG data: 6604 extraneous bytes before marker 0xd9 warnings.warn(self.__get_error_string(handle))
/usr/local/lib/python3.11/site-packages/turbojpeg.py:880: UserWarning: Corrupt JPEG data: 6536 extraneous bytes before marker 0xd9 warnings.warn(self.__get_error_string(handle))
/usr/local/lib/python3.11/site-packages/turbojpeg.py:880: UserWarning: Corrupt JPEG data: 6602 extraneous bytes before marker 0xd9 warnings.warn(self.__get_error_string(handle))

Sensor for display messages

I'm looking for a way see the display messages in Home Assistant. Maybe there's a way to use the m117 gcode messages as text sensor in home assistant?
Thx!

Home Assistant device class warning

Version of the moonraker integration

0.8.0

Describe your setup

Klipper, Moonraker, Mainsail, Pi 4.

Describe the bug

There's a warning regarding device classes shown in the Home Assistant log, suggesting it should be reported to the integration author.

Moonraker Logs

 Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:597
Integration: Sensor (documentation, issues)
First occurred: 10 April 2023 at 13:25:58 (7 occurrences)
Last logged: 10 April 2023 at 13:25:59

    Sensor sensor.ender_3_s1_print_projected_total_duration has device class duration, state class None and unit s thus indicating it has a numeric value; however, it has the non-numeric value: (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
    Sensor sensor.ender_3_s1_print_time_left has device class duration, state class None and unit s thus indicating it has a numeric value; however, it has the non-numeric value: (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
    Sensor sensor.ender_3_s1_print_duration has device class duration, state class None and unit s thus indicating it has a numeric value; however, it has the non-numeric value: (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
    Sensor sensor.ender_3_s1_filament_used has device class None, state class None and unit m thus indicating it has a numeric value; however, it has the non-numeric value: (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
    Sensor sensor.ender_3_s1_progress has device class None, state class None and unit % thus indicating it has a numeric value; however, it has the non-numeric value: (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.

Add new dashboard template

@greendog99 built a great dashboard exposing this integration, we should add it in our doc:

https://gist.github.com/greendog99/b379b2aa558639d657212f88e0749607

cards:
  - type: custom:mushroom-title-card
    title: Moonraker โ€“ {{ states('sensor.moonraker_current_display_message') }}
    subtitle: '{{ states(''sensor.moonraker_filename'') }}'
    alignment: center
    title_tap_action:
      action: url
      url_path: http://moonraker.local/
  - square: false
    type: grid
    cards:
      - type: tile
        entity: sensor.moonraker_current_print_state
        name: Status
        show_entity_picture: false
        vertical: false
        color: primary
      - type: tile
        entity: sensor.moonraker_print_duration
        name: Elapsed
        color: accent
      - type: tile
        entity: sensor.moonraker_print_eta
        name: Completion
        color: green
        show_entity_picture: false
        vertical: false
    columns: 3
  - type: custom:bar-card
    entity: sensor.moonraker_progress
    name: Print Progress...
    icon: mdi:clock-end
    color: green
    positions:
      indicator: inside
      name: inside
  - square: false
    type: grid
    columns: 4
    cards:
      - type: custom:button-card
        entity: button.moonraker_pause_print
        color_type: icon
        tap_action:
          action: toggle
        name: Pause
      - type: custom:button-card
        entity: button.moonraker_resume_print
        color_type: icon
        tap_action:
          action: toggle
        name: Resume
      - type: custom:button-card
        entity: button.moonraker_cancel_print
        color_type: icon
        tap_action:
          action: toggle
        name: Cancel
        lock:
          enabled: false
        confirmation:
          text: This will CANCEL the print. Are you sure?
      - type: custom:button-card
        entity: button.moonraker_emergency_stop
        color_type: icon
        color: red
        tap_action:
          action: toggle
        name: Emergency
        lock:
          enabled: false
        confirmation:
          text: This will REBOOT the printer. Are you sure?
  - type: custom:apexcharts-card
    graph_span: 1h
    header:
      show: true
      title: Printer Temperatures
      show_states: true
      colorize_states: true
    apex_config:
      chart:
        height: 200px
      legend:
        show: false
      grid:
        xaxis:
          lines:
            show: true
        borderColor: '#555'
    yaxis:
      - opposite: true
        decimals: 0
        apex_config:
          tickAmount: 2
    all_series_config:
      stroke_width: 2
      float_precision: 0
      show:
        name_in_header: true
    series:
      - entity: sensor.moonraker_extruder_temperature
        name: Hotend
      - entity: sensor.moonraker_bed_temperature
        name: Bed
      - entity: sensor.moonraker_raspberry_pi
        name: RPi3
      - entity: sensor.moonraker_mcu
        name: Octopus
      - entity: sensor.atc_3d_temperature
        name: Chamber
  - type: custom:apexcharts-card
    graph_span: 1h
    header:
      show: true
      title: Fan Speeds
      show_states: true
      colorize_states: true
    apex_config:
      chart:
        height: 200px
      legend:
        show: false
      grid:
        xaxis:
          lines:
            show: true
        borderColor: '#555'
    yaxis:
      - opposite: true
        decimals: 0
        apex_config:
          tickAmount: 2
    all_series_config:
      stroke_width: 2
      show:
        name_in_header: true
    series:
      - entity: sensor.moonraker_hotend_fan
        name: Hotend
      - entity: sensor.moonraker_fan_speed
        name: Parts
      - entity: sensor.moonraker_controller_fan_front
        name: Skirt Front
      - entity: sensor.moonraker_controller_fan_rear
        name: Skirt Rear
  - type: conditional
    conditions:
      - entity: sensor.moonraker_current_print_state
        state_not: unavailable
    card:
      type: picture-entity
      entity: camera.moonraker_cam
      camera_view: live
      show_name: false
      show_state: false
      aspect_ratio: 4x3
  - type: conditional
    conditions:
      - entity: sensor.moonraker_current_print_state
        state_not: unavailable
    card:
      type: picture-entity
      entity: camera.moonraker_thumbnail
      camera_view: auto
      show_name: false
      show_state: false

GCODE/Macro output to "Printer Message" Sensor

Great work on this. I'm curious about the "Printer Message" entity that's created in Home Assistant. It appears to work correctly and dispalys errors perfectly, but I wondered if there was a way to utilise custom GCODE/Macros in the Console/printer.cfg to send custom messages to this sensor.. or another sensor.

Screenshot 2023-03-05 191803

For example, if I was to enter the following in the terminal/console, it shows in the console, but not push to the "Printer Message" sensor.

RESPOND TYPE=ECHO MSG='M600 - Change the Fillament'

I hope that I'm just doing something wrong and this is more of a silly plea for help, but if it's not avaialble, the use case for this would be to include such messages into GCODE Macros and get Home Assistant to send push notifications to my phone to display on errors/requests/completion of prints.

Kind regards

Better ETA calculation

Right now, we do ETA based on % of GCode, Mainsail does the average of this and % of filament used.

We should addapt the same calculation

ETA should also move to a specific time (not a timer )

Using macros

Good afternoon! Is it possible to add control via a macro? For example, it would be useful to disable the 3D printer via the HA interface.

No sensors being created (buttons, macros, and camera created)

Version of the moonraker integration

0.8

Describe your setup

Voron 2.4R2 with Klipper 0.11.0, Moonraker 0.8.0, Mainsail, RPi3, PrusaSlicer, Home Assistant 2023.4.2.

Describe the bug

Home Assistant only creates printer controls (buttons and macros) and the Crow's Nest camera. No sensor entities are created (printer status, fan speed, etc.).

From the Traceback in the log below, it looks like data["first_layer_height"] and data["layer_height"] don't exist (NoneType), which causes all sensor setup to fail.

The full log is below, but the relevant error excerpt is:

  File "/config/custom_components/moonraker/sensor.py", line 531, in calculate_current_layer
    (data["status"]["toolhead"]["position"][2] - data["first_layer_height"])
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

which relates to:

round(
(data["status"]["toolhead"]["position"][2] - data["first_layer_height"])
/ data["layer_height"],
0,
)

I've recently switched from SuperSlicer to PrusaSlicer, so perhaps these variables are coded differently in PS? The debug log shows the Query Object gcode output does show the layer heights, but I'm not sure how the integration reads those:

2023-04-12 11:46:57.447 DEBUG (MainThread) [custom_components.moonraker] {'size': 8285384, 'modified': 1681308929.4305804, 'uuid': 'c1886d73-8bb0-4680-9c51-ff101a593169', 'slicer': 'PrusaSlicer', 'slicer_version': '2.6.0-alpha6+MacOS-arm64', 'gcode_start_byte': 43153, 'gcode_end_byte': 8275420, 'object_height': 31.8, 'estimated_time': 9457, 'nozzle_diameter': 0.4, 'layer_height': 0.3, 'first_layer_height': 0.3, 'first_layer_extr_temp': 200.0, 'first_layer_bed_temp': 60.0, 'filament_name': 'MDF PLA Voron', 'filament_type': 'PLA', 'filament_total': 26609.82, 'filament_weight_total': 65.92, 'thumbnails': [{'width': 32, 'height': 32, 'size': 1773, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-32x32.png'}, {'width': 300, 'height': 300, 'size': 28910, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-300x300.png'}], 'print_start_time': 1681308929.7732337, 'job_id': '00006C', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode'}

Love the integration, thanks for putting it together! Let me know if I can provide any additional data or do any testing.

Moonraker Logs

2023-04-12 11:46:55.616 DEBUG (MainThread) [custom_components.moonraker] loading moonraker init
2023-04-12 11:46:55.634 DEBUG (MainThread) [custom_components.moonraker.api] Stated changed to {ws_connecting}
2023-04-12 11:46:55.965 DEBUG (MainThread) [custom_components.moonraker.api] Stated changed to {ws_connected}
2023-04-12 11:46:56.199 DEBUG (MainThread) [custom_components.moonraker] {'state': 'ready', 'state_message': 'Printer is ready', 'hostname': 'clu', 'klipper_path': '/home/pi/klipper', 'python_path': '/home/pi/klippy-env/bin/python', 'log_file': '/home/pi/printer_data/logs/klippy.log', 'config_file': '/home/pi/printer_data/config/printer.cfg', 'software_version': 'v0.11.0-169-g83308a10', 'cpu_info': '4 core ARMv7 Processor rev 4 (v7l)'}
2023-04-12 11:46:56.433 DEBUG (MainThread) [custom_components.moonraker] {'eventtime': 12233.790432886, 'status': {'print_stats': {'state': 'printing', 'message': '', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode', 'total_duration': 5486.823872803, 'print_duration': 5356.775327488001, 'filament_used': 15173.301239999078, 'info': {'total_layer': None, 'current_layer': None}}, 'display_status': {'message': 'Layer 47/106', 'progress': 0.58}, 'extruder': {'temperature': 199.87, 'target': 200.0, 'power': 0.8092012130691596}, 'heater_bed': {'target': 55.0, 'temperature': 55.1, 'power': 0.1088560624133767}, 'toolhead': {'position': [146.434, 208.972, 14.11, 29018.09514999929]}}}
2023-04-12 11:46:57.059 DEBUG (MainThread) [custom_components.moonraker] {'state': 'ready', 'state_message': 'Printer is ready', 'hostname': 'clu', 'klipper_path': '/home/pi/klipper', 'python_path': '/home/pi/klippy-env/bin/python', 'log_file': '/home/pi/printer_data/logs/klippy.log', 'config_file': '/home/pi/printer_data/config/printer.cfg', 'software_version': 'v0.11.0-169-g83308a10', 'cpu_info': '4 core ARMv7 Processor rev 4 (v7l)'}
2023-04-12 11:46:57.321 DEBUG (MainThread) [custom_components.moonraker] {'eventtime': 12234.542200489, 'status': {'print_stats': {'state': 'printing', 'message': '', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode', 'total_duration': 5487.575640406, 'print_duration': 5357.527095091001, 'filament_used': 15175.185999999083, 'info': {'total_layer': None, 'current_layer': None}}, 'display_status': {'message': 'Layer 47/106', 'progress': 0.58}, 'extruder': {'temperature': 199.89, 'target': 200.0, 'power': 0.8092012130691596}, 'heater_bed': {'target': 55.0, 'temperature': 55.09, 'power': 0.1088560624133767}, 'toolhead': {'position': [139.883, 189.337, 14.11, 29019.979909999296]}}}
2023-04-12 11:46:57.447 DEBUG (MainThread) [custom_components.moonraker] {'size': 8285384, 'modified': 1681308929.4305804, 'uuid': 'c1886d73-8bb0-4680-9c51-ff101a593169', 'slicer': 'PrusaSlicer', 'slicer_version': '2.6.0-alpha6+MacOS-arm64', 'gcode_start_byte': 43153, 'gcode_end_byte': 8275420, 'object_height': 31.8, 'estimated_time': 9457, 'nozzle_diameter': 0.4, 'layer_height': 0.3, 'first_layer_height': 0.3, 'first_layer_extr_temp': 200.0, 'first_layer_bed_temp': 60.0, 'filament_name': 'MDF PLA Voron', 'filament_type': 'PLA', 'filament_total': 26609.82, 'filament_weight_total': 65.92, 'thumbnails': [{'width': 32, 'height': 32, 'size': 1773, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-32x32.png'}, {'width': 300, 'height': 300, 'size': 28910, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-300x300.png'}], 'print_start_time': 1681308929.7732337, 'job_id': '00006C', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode'}
2023-04-12 11:46:57.447 ERROR (MainThread) [custom_components.moonraker] failed to get thumbnails  {'layer_count'}
2023-04-12 11:46:57.449 ERROR (MainThread) [custom_components.moonraker] Query Object {{'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode'}}
2023-04-12 11:46:57.449 ERROR (MainThread) [custom_components.moonraker] gcode {{'size': 8285384, 'modified': 1681308929.4305804, 'uuid': 'c1886d73-8bb0-4680-9c51-ff101a593169', 'slicer': 'PrusaSlicer', 'slicer_version': '2.6.0-alpha6+MacOS-arm64', 'gcode_start_byte': 43153, 'gcode_end_byte': 8275420, 'object_height': 31.8, 'estimated_time': 9457, 'nozzle_diameter': 0.4, 'layer_height': 0.3, 'first_layer_height': 0.3, 'first_layer_extr_temp': 200.0, 'first_layer_bed_temp': 60.0, 'filament_name': 'MDF PLA Voron', 'filament_type': 'PLA', 'filament_total': 26609.82, 'filament_weight_total': 65.92, 'thumbnails': [{'width': 32, 'height': 32, 'size': 1773, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-32x32.png'}, {'width': 300, 'height': 300, 'size': 28910, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-300x300.png'}], 'print_start_time': 1681308929.7732337, 'job_id': '00006C', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode'}}
2023-04-12 11:46:57.450 DEBUG (MainThread) [custom_components.moonraker] Finished fetching moonraker data in 1.251 seconds (success: True)
2023-04-12 11:46:57.555 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up moonraker platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/moonraker/sensor.py", line 316, in async_setup_entry
    await async_setup_basic_sensor(coordinator, entry, async_add_entities)
  File "/config/custom_components/moonraker/sensor.py", line 324, in async_setup_basic_sensor
    async_add_entities([MoonrakerSensor(coordinator, entry, desc) for desc in SENSORS])
  File "/config/custom_components/moonraker/sensor.py", line 324, in <listcomp>
    async_add_entities([MoonrakerSensor(coordinator, entry, desc) for desc in SENSORS])
  File "/config/custom_components/moonraker/sensor.py", line 462, in __init__
    self._attr_native_value = description.value_fn(self)
  File "/config/custom_components/moonraker/sensor.py", line 275, in <lambda>
    value_fn=lambda sensor: calculate_current_layer(sensor.coordinator.data),
  File "/config/custom_components/moonraker/sensor.py", line 531, in calculate_current_layer
    (data["status"]["toolhead"]["position"][2] - data["first_layer_height"])
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
2023-04-12 11:46:57.597 DEBUG (MainThread) [custom_components.moonraker] {'webcams': [{'name': 'CluCam', 'location': 'printer', 'service': 'mjpegstreamer-adaptive', 'target_fps': '10', 'stream_url': '/webcam/?action=stream', 'snapshot_url': '/webcam/?action=snapshot', 'flip_horizontal': False, 'flip_vertical': False, 'rotation': 0, 'source': 'database'}]}
2023-04-12 11:46:57.603 DEBUG (MainThread) [custom_components.moonraker] {'RESTART': 'Reload config file and restart host software', 'FIRMWARE_RESTART': 'Restart firmware, host, and reload config', 'STATUS': 'Report the printer status', 'HELP': 'Report the list of available extended G-Code commands', 'SAVE_CONFIG': 'Overwrite config file and restart', 'SET_GCODE_OFFSET': 'Set a virtual offset to g-code positions', 'SAVE_GCODE_STATE': 'Save G-Code coordinate state', 'RESTORE_GCODE_STATE': 'Restore a previously saved G-Code state', 'GET_POSITION': 'Return information on the current location of the toolhead', 'SET_PRINT_STATS_INFO': 'Overwrite, to get pause_next_layer and pause_at_layer feature', 'SDCARD_RESET_FILE': 'Clears a loaded SD File. Stops the print if necessary', 'SDCARD_PRINT_FILE': 'Loads a SD file and starts the print.  May include files in subdirectories.', 'PAUSE': 'Pause the actual running print', 'RESUME': 'Resume the actual running print', 'CLEAR_PAUSE': 'Clears the current paused state without resuming the print', 'CANCEL_PRINT': 'Cancel the actual running print', 'SET_DISPLAY_TEXT': 'Set or clear the display message', 'SET_GCODE_VARIABLE': 'Set the value of a G-Code macro variable', 'SET_PAUSE_NEXT_LAYER': 'Enable a pause if the next layer is reached', 'SET_PAUSE_AT_LAYER': 'Enable/disable a pause if a given layer number is reached', '_TOOLHEAD_PARK_PAUSE_CANCEL': 'Helper: park toolhead used in PAUSE and CANCEL_PRINT', '_CLIENT_EXTRUDE': 'Extrudes, if the extruder is hot enough', '_CLIENT_RETRACT': 'Retracts, if the extruder is hot enough', 'SET_LED_TEMPLATE': 'Assign a display_template to an LED', 'SET_LED': 'Set the color of an LED', '_SB_VARS': 'G-Code macro', '_SET_SB_LEDS': 'G-Code macro', '_SET_SB_LEDS_BY_NAME': 'G-Code macro', '_SET_LOGO_LEDS': 'G-Code macro', '_SET_NOZZLE_LEDS': 'G-Code macro', 'SET_LOGO_LEDS_OFF': 'G-Code macro', 'SET_NOZZLE_LEDS_ON': 'G-Code macro', 'SET_NOZZLE_LEDS_OFF': 'G-Code macro', 'STATUS_OFF': 'G-Code macro', 'STATUS_READY': 'G-Code macro', 'STATUS_BUSY': 'G-Code macro', 'STATUS_HEATING': 'G-Code macro', 'STATUS_LEVELING': 'G-Code macro', 'STATUS_HOMING': 'G-Code macro', 'STATUS_CLEANING': 'G-Code macro', 'STATUS_MESHING': 'G-Code macro', 'STATUS_CALIBRATING_Z': 'G-Code macro', 'STATUS_PRINTING': 'G-Code macro', 'SETUP_KAMP_MESHING': 'G-Code macro', 'RUN_SHELL_COMMAND': 'Run a linux shell command', 'BACKUP_CONFIG': 'Backs up config directory to GitHub', 'COND_G28': 'Home XYZ if not already homed', 'COND_QGL': 'QGL (including G28) if not already done', 'QGL': 'Home axes and then quad gantry level', 'OFF': 'G-Code macro', 'SHUTDOWN': 'G-Code macro', 'DUMP_VARIABLES': 'G-Code macro', 'GET_VARIABLE': 'G-Code macro', 'PARK': 'G-Code macro', 'PARK_CENTER': 'G-Code macro', 'PARK_BED': 'G-Code macro', 'PARK_FRONT': 'G-Code macro', 'PARK_REAR': 'G-Code macro', 'M600': 'Filament change', 'PRIME_NOZZLE': 'G-Code macro', 'PRINT_START': 'G-Code macro', 'PRINT_END': 'G-Code macro', 'EXCLUDE_OBJECT_START': 'Marks the beginning the current object as labeled', 'EXCLUDE_OBJECT_END': 'Marks the end the current object', 'EXCLUDE_OBJECT': 'Cancel moves inside a specified objects', 'EXCLUDE_OBJECT_DEFINE': 'Provides a summary of an object', 'RESPOND': 'Echo the message prepended with a prefix', 'SET_STEPPER_ENABLE': 'Enable/disable individual stepper by name', 'SET_TMC_FIELD': 'Set a register field of a TMC driver', 'INIT_TMC': 'Initialize TMC stepper driver registers', 'SET_TMC_CURRENT': 'Set the current of a TMC driver', 'DUMP_TMC': 'Read and display TMC stepper driver registers', 'TURN_OFF_HEATERS': 'Turn off all heaters', 'TEMPERATURE_WAIT': 'Wait for a temperature on a sensor', 'QUERY_ADC': 'Report the last value of an analog pin', 'PID_CALIBRATE': 'Run PID calibration test', 'SET_HEATER_TEMPERATURE': 'Sets a heater temperature', 'PROBE': 'Probe Z-height at current XY position', 'QUERY_PROBE': 'Return the status of the z-probe', 'PROBE_CALIBRATE': "Calibrate the probe's z_offset", 'PROBE_ACCURACY': 'Probe Z-height accuracy at current XY position', 'Z_OFFSET_APPLY_PROBE': "Adjust the probe's z_offset", 'SET_IDLE_TIMEOUT': 'Set the idle timeout in seconds', 'QUAD_GANTRY_LEVEL': 'Conform a moving, twistable gantry to the shape of a stationary bed', 'BED_MESH_CALIBRATE': 'G-Code macro', 'BED_MESH_PROFILE': 'Bed Mesh Persistent Storage management', 'BED_MESH_OUTPUT': 'Retrieve interpolated grid of probed z-points', 'BED_MESH_MAP': 'Serialize mesh and output to terminal', 'BED_MESH_CLEAR': 'Clear the Mesh so no z-adjustment is made', 'BED_MESH_OFFSET': 'Add X/Y offsets to the mesh lookup', '_CLIENT_VARIABLE': 'G-Code macro', 'STEPPER_BUZZ': 'Oscillate a given stepper to help id it', 'QUERY_ENDSTOPS': 'Report on the status of each endstop', 'SET_VELOCITY_LIMIT': 'Set printer velocity limits', 'MANUAL_PROBE': 'Start manual probe helper script', 'Z_ENDSTOP_CALIBRATE': 'Calibrate a Z endstop', 'Z_OFFSET_APPLY_ENDSTOP': 'Adjust the z endstop_position', 'TUNING_TOWER': 'Tool to adjust a parameter at each Z height', 'SET_PRESSURE_ADVANCE': 'Set pressure advance parameters', 'SET_EXTRUDER_ROTATION_DISTANCE': 'Set extruder rotation distance', 'SYNC_EXTRUDER_MOTION': 'Set extruder stepper motion queue', 'SET_EXTRUDER_STEP_DISTANCE': 'Set extruder step distance', 'SYNC_STEPPER_TO_EXTRUDER': 'Set extruder stepper', 'ACTIVATE_EXTRUDER': 'Change the active extruder', 'BASE_CANCEL_PRINT': "Renamed builtin of 'CANCEL_PRINT'", 'BASE_PAUSE': "Renamed builtin of 'PAUSE'", 'BASE_RESUME': "Renamed builtin of 'RESUME'", 'SET_PRINT_STATS_INFO_BASE': "Renamed builtin of 'SET_PRINT_STATS_INFO'", '_BED_MESH_CALIBRATE': "Renamed builtin of 'BED_MESH_CALIBRATE'", 'M99109': "Renamed builtin of 'M109'", 'M109': 'G-Code macro', 'M99190': "Renamed builtin of 'M190'", 'M190': 'G-Code macro', 'M117.1': "Renamed builtin of 'M117'", 'M117': 'G-Code macro'}
2023-04-12 11:46:57.620 DEBUG (MainThread) [custom_components.moonraker] {'error': {'code': -32601, 'message': 'Method not found'}}
2023-04-12 11:46:57.620 DEBUG (MainThread) [custom_components.moonraker] {'objects': ['webhooks', 'configfile', 'mcu', 'gcode_move', 'print_stats', 'virtual_sdcard', 'pause_resume', 'display_status', 'gcode_macro CANCEL_PRINT', 'gcode_macro PAUSE', 'gcode_macro RESUME', 'gcode_macro SET_PAUSE_NEXT_LAYER', 'gcode_macro SET_PAUSE_AT_LAYER', 'gcode_macro SET_PRINT_STATS_INFO', 'gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL', 'gcode_macro _CLIENT_EXTRUDE', 'gcode_macro _CLIENT_RETRACT', 'neopixel sb_leds', 'gcode_macro _sb_vars', 'gcode_macro _set_sb_leds', 'gcode_macro _set_sb_leds_by_name', 'gcode_macro _set_logo_leds', 'gcode_macro _set_nozzle_leds', 'gcode_macro set_logo_leds_off', 'gcode_macro set_nozzle_leds_on', 'gcode_macro set_nozzle_leds_off', 'gcode_macro status_off', 'gcode_macro status_ready', 'gcode_macro status_busy', 'gcode_macro status_heating', 'gcode_macro status_leveling', 'gcode_macro status_homing', 'gcode_macro status_cleaning', 'gcode_macro status_meshing', 'gcode_macro status_calibrating_z', 'gcode_macro status_printing', 'gcode_macro BED_MESH_CALIBRATE', 'gcode_macro SETUP_KAMP_MESHING', 'gcode_macro M109', 'gcode_macro M190', 'gcode_macro M117', 'gcode_macro BACKUP_CONFIG', 'gcode_macro COND_G28', 'gcode_macro COND_QGL', 'gcode_macro QGL', 'gcode_macro OFF', 'gcode_macro SHUTDOWN', 'gcode_macro DUMP_VARIABLES', 'gcode_macro GET_VARIABLE', 'gcode_macro PARK', 'gcode_macro PARK_CENTER', 'gcode_macro PARK_BED', 'gcode_macro PARK_FRONT', 'gcode_macro PARK_REAR', 'gcode_macro M600', 'gcode_macro PRIME_NOZZLE', 'gcode_macro PRINT_START', 'gcode_macro PRINT_END', 'exclude_object', 'stepper_enable', 'tmc2209 stepper_x', 'tmc2209 stepper_y', 'tmc2209 stepper_z', 'tmc2209 stepper_z1', 'tmc2209 stepper_z2', 'tmc2209 stepper_z3', 'tmc2209 extruder', 'heaters', 'heater_bed', 'probe', 'temperature_host raspberry_pi', 'temperature_sensor raspberry_pi', 'temperature_sensor mcu_temp', 'fan', 'heater_fan hotend_fan', 'controller_fan controller_fan_rear', 'controller_fan controller_fan_front', 'idle_timeout', 'quad_gantry_level', 'bed_mesh', 'gcode_macro _CLIENT_VARIABLE', 'motion_report', 'query_endstops', 'system_stats', 'manual_probe', 'toolhead', 'extruder']}
2023-04-12 11:46:57.669 DEBUG (MainThread) [custom_components.moonraker] {'eventtime': 12235.043007833, 'status': {'print_stats': {'state': 'printing', 'message': '', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode', 'total_duration': 5488.076447749999, 'print_duration': 5358.027902434999, 'filament_used': 15175.185999999083, 'info': {'total_layer': None, 'current_layer': None}}, 'display_status': {'message': 'Layer 47/106', 'progress': 0.58}, 'extruder': {'temperature': 199.91, 'target': 200.0, 'power': 0.8092012130691596}, 'heater_bed': {'target': 55.0, 'temperature': 55.08, 'power': 0.1088560624133767}, 'toolhead': {'position': [139.883, 189.337, 14.11, 29019.979909999296]}}}
2023-04-12 11:46:57.696 DEBUG (MainThread) [custom_components.moonraker] {'state': 'ready', 'state_message': 'Printer is ready', 'hostname': 'clu', 'klipper_path': '/home/pi/klipper', 'python_path': '/home/pi/klippy-env/bin/python', 'log_file': '/home/pi/printer_data/logs/klippy.log', 'config_file': '/home/pi/printer_data/config/printer.cfg', 'software_version': 'v0.11.0-169-g83308a10', 'cpu_info': '4 core ARMv7 Processor rev 4 (v7l)'}
2023-04-12 11:46:57.907 DEBUG (MainThread) [custom_components.moonraker] {'eventtime': 12235.293415072, 'status': {'print_stats': {'state': 'printing', 'message': '', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode', 'total_duration': 5488.326854988999, 'print_duration': 5358.2783096739995, 'filament_used': 15175.185999999083, 'info': {'total_layer': None, 'current_layer': None}}, 'display_status': {'message': 'Layer 47/106', 'progress': 0.58}, 'extruder': {'temperature': 199.93, 'target': 200.0, 'power': 0.8092012130691596}, 'heater_bed': {'target': 55.0, 'temperature': 55.08, 'power': 0.1088560624133767}, 'toolhead': {'position': [139.883, 189.337, 14.11, 29019.979909999296]}}}
2023-04-12 11:46:57.918 DEBUG (MainThread) [custom_components.moonraker] {'size': 8285384, 'modified': 1681308929.4305804, 'uuid': 'c1886d73-8bb0-4680-9c51-ff101a593169', 'slicer': 'PrusaSlicer', 'slicer_version': '2.6.0-alpha6+MacOS-arm64', 'gcode_start_byte': 43153, 'gcode_end_byte': 8275420, 'object_height': 31.8, 'estimated_time': 9457, 'nozzle_diameter': 0.4, 'layer_height': 0.3, 'first_layer_height': 0.3, 'first_layer_extr_temp': 200.0, 'first_layer_bed_temp': 60.0, 'filament_name': 'MDF PLA Voron', 'filament_type': 'PLA', 'filament_total': 26609.82, 'filament_weight_total': 65.92, 'thumbnails': [{'width': 32, 'height': 32, 'size': 1773, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-32x32.png'}, {'width': 300, 'height': 300, 'size': 28910, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-300x300.png'}], 'print_start_time': 1681308929.7732337, 'job_id': '00006C', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode'}
2023-04-12 11:46:57.918 ERROR (MainThread) [custom_components.moonraker] failed to get thumbnails  {'layer_count'}
2023-04-12 11:46:57.920 ERROR (MainThread) [custom_components.moonraker] Query Object {{'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode'}}
2023-04-12 11:46:57.921 ERROR (MainThread) [custom_components.moonraker] gcode {{'size': 8285384, 'modified': 1681308929.4305804, 'uuid': 'c1886d73-8bb0-4680-9c51-ff101a593169', 'slicer': 'PrusaSlicer', 'slicer_version': '2.6.0-alpha6+MacOS-arm64', 'gcode_start_byte': 43153, 'gcode_end_byte': 8275420, 'object_height': 31.8, 'estimated_time': 9457, 'nozzle_diameter': 0.4, 'layer_height': 0.3, 'first_layer_height': 0.3, 'first_layer_extr_temp': 200.0, 'first_layer_bed_temp': 60.0, 'filament_name': 'MDF PLA Voron', 'filament_type': 'PLA', 'filament_total': 26609.82, 'filament_weight_total': 65.92, 'thumbnails': [{'width': 32, 'height': 32, 'size': 1773, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-32x32.png'}, {'width': 300, 'height': 300, 'size': 28910, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-300x300.png'}], 'print_start_time': 1681308929.7732337, 'job_id': '00006C', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode'}}
2023-04-12 11:46:57.922 DEBUG (MainThread) [custom_components.moonraker] Finished fetching moonraker data in 0.301 seconds (success: True)
2023-04-12 11:47:27.398 DEBUG (MainThread) [custom_components.moonraker] {'eventtime': 12264.75280402, 'status': {'print_stats': {'state': 'printing', 'message': '', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode', 'total_duration': 5517.786243936999, 'print_duration': 5387.737698622, 'filament_used': 15261.139209999126, 'info': {'total_layer': None, 'current_layer': None}}, 'display_status': {'message': 'Layer 48/106', 'progress': 0.58}, 'extruder': {'temperature': 199.86, 'target': 200.0, 'power': 0.8587185197524144}, 'heater_bed': {'target': 55.0, 'temperature': 55.1, 'power': 0.07240271901182006}, 'toolhead': {'position': [153.631, 174.311, 14.41, 29105.93311999934]}}}
2023-04-12 11:47:27.435 DEBUG (MainThread) [custom_components.moonraker] {'state': 'ready', 'state_message': 'Printer is ready', 'hostname': 'clu', 'klipper_path': '/home/pi/klipper', 'python_path': '/home/pi/klippy-env/bin/python', 'log_file': '/home/pi/printer_data/logs/klippy.log', 'config_file': '/home/pi/printer_data/config/printer.cfg', 'software_version': 'v0.11.0-169-g83308a10', 'cpu_info': '4 core ARMv7 Processor rev 4 (v7l)'}
2023-04-12 11:47:27.619 DEBUG (MainThread) [custom_components.moonraker] {'eventtime': 12265.003623447, 'status': {'print_stats': {'state': 'printing', 'message': '', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode', 'total_duration': 5518.0370633640005, 'print_duration': 5387.988518049001, 'filament_used': 15262.589789999123, 'info': {'total_layer': None, 'current_layer': None}}, 'display_status': {'message': 'Layer 48/106', 'progress': 0.58}, 'extruder': {'temperature': 199.84, 'target': 200.0, 'power': 0.8587185197524144}, 'heater_bed': {'target': 55.0, 'temperature': 55.1, 'power': 0.07240271901182006}, 'toolhead': {'position': [183.937, 170.971, 14.41, 29107.383699999336]}}}
2023-04-12 11:47:27.632 DEBUG (MainThread) [custom_components.moonraker] {'size': 8285384, 'modified': 1681308929.4305804, 'uuid': 'c1886d73-8bb0-4680-9c51-ff101a593169', 'slicer': 'PrusaSlicer', 'slicer_version': '2.6.0-alpha6+MacOS-arm64', 'gcode_start_byte': 43153, 'gcode_end_byte': 8275420, 'object_height': 31.8, 'estimated_time': 9457, 'nozzle_diameter': 0.4, 'layer_height': 0.3, 'first_layer_height': 0.3, 'first_layer_extr_temp': 200.0, 'first_layer_bed_temp': 60.0, 'filament_name': 'MDF PLA Voron', 'filament_type': 'PLA', 'filament_total': 26609.82, 'filament_weight_total': 65.92, 'thumbnails': [{'width': 32, 'height': 32, 'size': 1773, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-32x32.png'}, {'width': 300, 'height': 300, 'size': 28910, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-300x300.png'}], 'print_start_time': 1681308929.7732337, 'job_id': '00006C', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode'}
2023-04-12 11:47:27.632 ERROR (MainThread) [custom_components.moonraker] failed to get thumbnails  {'layer_count'}
2023-04-12 11:47:27.635 ERROR (MainThread) [custom_components.moonraker] Query Object {{'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode'}}
2023-04-12 11:47:27.637 ERROR (MainThread) [custom_components.moonraker] gcode {{'size': 8285384, 'modified': 1681308929.4305804, 'uuid': 'c1886d73-8bb0-4680-9c51-ff101a593169', 'slicer': 'PrusaSlicer', 'slicer_version': '2.6.0-alpha6+MacOS-arm64', 'gcode_start_byte': 43153, 'gcode_end_byte': 8275420, 'object_height': 31.8, 'estimated_time': 9457, 'nozzle_diameter': 0.4, 'layer_height': 0.3, 'first_layer_height': 0.3, 'first_layer_extr_temp': 200.0, 'first_layer_bed_temp': 60.0, 'filament_name': 'MDF PLA Voron', 'filament_type': 'PLA', 'filament_total': 26609.82, 'filament_weight_total': 65.92, 'thumbnails': [{'width': 32, 'height': 32, 'size': 1773, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-32x32.png'}, {'width': 300, 'height': 300, 'size': 28910, 'relative_path': '.thumbs/Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm-300x300.png'}], 'print_start_time': 1681308929.7732337, 'job_id': '00006C', 'filename': 'Gridfinity bin 1x3x3-MDF PLA Voron-MDF Voron 0.4mm.gcode'}}
2023-04-12 11:47:27.639 DEBUG (MainThread) [custom_components.moonraker] Finished fetching moonraker data in 0.420 seconds (success: True)

Dark mode 'Moonraker' icon

Super nitpicky detail, but the Moonraker integration icon on the 'Device info' screen is very hard to read in dark mode in HA.

image

Can we either:

  1. Add a dark and light iteration of the icon and change them out based on light or dark mode in HA (is this even possible?)
  2. Add a solid background behind the word 'Moonraker' to work on either mode.

Thumbnail entity not automatically renamed

After renaming a device (printer), HA asks if you want to rename the associated entities to reflect the new device name. From what I can tell, all of the entities are renamed other than the thumbnail entity.

Can we also automatically rename the thumbnail entity when prompted?

Rotation parameters for webcam

Hi,

I love the integration, thank you so much for your extension! Lets me manage my printer farm efficiently.

I was just wondering, since on one of my machines the webcam is mounted upside down, what would I need to do to pull the webcam parameters from mainsail regarding rotation or flip of the image?

Or, maybe simpler, adding a property allowing the flip in horizontal or vertical modes just as the mainsail interface allows?

I'm happy to contribute the code needed for it, I'm just short on time to dig through and digest the whole code at the moment, so any pointers to get me started quickly would be great.

[Sonic Pad] Error connecting

When trying to connect to printer with ip address at set up, moonraker returned with "error connecting to"

Address I'm using is http://192.168.1.5 with standard port 7125 and set up all on sonic pad.

Help?

Add sensors for History - Totals

Is your feature request related to a problem? Please describe.

Add some additional sensors for the History totals on the machine

Describe the solution you'd like

Have individual sensors for these bigger history items.

Additional context

GET /server/history/totals

image

Improve testing

Some notes on testing improvement.

For funkier scenarios, (I think parsing input, or first, vs second vs third call) check side_effect capabilities.

For a good example of fixture usage check awair component

current_layer is wrong

Version of the moonraker integration

0.9.0

Describe the bug

Current layer says 6 when moonraker says 1.

I have done a light reading on the code and it is calculating the layer, I have that information being correctly set with SET_PRINT_STATS_INFO that sets the information on the print_stats.info object exposed by mooraker.
partial example below

{
   "result":{
      "status":{
         "print_stats":{
            "info":{
               "total_layer":132,
               "current_layer":1
            }
         },
         "eventtime":1057200.052048971
      }
   }
}

cannot access thumbnail of print in HA

hello,

thank you for the integration on moonraker in home assistant.

My purpose is I cannot access to the thumbnail of my print in home assistant, I don't see any option.

Is this option exist? And where can I found them?

Sorry for my bad English ;).

Seb

No thumbnails when porinting from a sub folder

Version of the moonraker integration

last

Describe your setup

RPI
Klipper, Moonraker, Mainsail

Describe the bug

when printing from a subfolder the thumbnail will not show

First of all, thanks for this integration, I wich I could have done the same, instead, I've used a rest integration in the config.yaml

I had the same issue with my integration and I solved it by picking the parent_folder of the print and add it to the path if needed
Something like this:

       vcore400_parent_file_path:
        friendly_name: "File Parent Path"
        value_template: '{{ states.sensor.vcore400_sensor.attributes["print_stats"]["filename"].split("/")[:-1] |join("/")}}'
       vcore400_url_thumbnail:
         friendly_name: "URL thumbnail Path"
         value_template: '{% if is_state("sensor.vcore400_parent_file_path", "") %}{{ states("sensor.vcore400_object_thumbnails") }}{% else %}{{ states("sensor.vcore400_parent_file_path") }}/{{ states("sensor.vcore400_object_thumbnails") }}{% endif %}'
       vcore400_object_thumbnails:
         friendly_name: "Object Thumbnails"
         value_template: '{{ states.sensor.vcore400_file_metadata.attributes["thumbnails"][1]["relative_path"] }}'

maybe this can help you fix this.
I don't know python, but as I see here, I should learn it ๐Ÿ˜„

Pull sensor data for use in Automations

With the newest addition of macros into HA (this is awesome addition btw) I am wanting to create automations to trigger macros based on the integrations sensor data.

When I tried to create a trigger using conditions, my only options are "Unavailable" and "Unknown". If I view the printer in the Devices panel, I can view the history of the sensor (ex. printing, complete, standby). See the screenshot below.

Is there anyway of making this data available for automations?

image

[Feature Request] Host MCU Option for sensors etc

Hi

I'm using the following part in my config to get values from a DS18b20 sensor. It is attached to the GPIO Pins of a RPi 3.
The Pi itself is a secondary MCU Host for klipper. https://www.klipper3d.org/RPi_microcontroller.html

The config part is:

[mcu host]
serial: /tmp/klipper_host_mcu

[temperature_sensor enclosure]
sensor_type: DS18B20
serial_no: 28-00000c8b776e
sensor_mcu: host

Would it be possible to get that data aswell?
Maybe like an option field where variables can be defined.

At the moment, im using the moonraker url query, and add a "&temperature_sensor%20enclosure" at the end.
(The whole thing is: resource: "http://192.168.1.10:7125/printer/objects/query?heater_bed&extruder&print_stats&toolhead&display_status&virtual_sdcard&temperature_sensor%20enclosure")

Thanks :D

Add ability to pull data from any temp sensor or fan speed that exists in klipper

Is your feature request related to a problem? Please describe.

Strictly a feature request for additional sensors being monitored, but I gotta be honest, its gonna be big one that might not be entirely feasible due to possible different naming conventions that can happen in klipper.

I would like to see sensors for other temp sensors and various fan speeds if they exist in the klipper config, regardless of what they are named.

Describe your setup

Depends on the printer for if they are running a pi or a cb1 or something else. Stack is debian, kiauh for managing the installs, klipper, moonraker, fluidd or mainsail, dealers choice depending on the printer or my mood. Printers are mostly different Vorons and a V400. Typical "I hate enders" deployment.

Describe the solution you'd like

As stated above, having some additional sensor data coming into home assistant to match what I can do with a simple rest sensor would be nice.

Being that these can have any naming convention and isn't standard like heater_bed it can create an interesting problem for implementing this. Maybe grab the list of all enabled heaters per printer and then have it create sensors per entry... Not sure how that would look on the implementation side.

Same concept but for fan speeds as well would be good as well. I'm happy to split this into a separate feature request.

Additional context

Here is a snippet from the list objects API call from one of my machines to give you an example of the types of objects/sensors I'm looking for. These names could be anything machine to machine, hence the possible challenge with this part.

            "fan_generic BedFans",
            "heater_fan filter_fan",
            "heater_fan controller_fan",
            "temperature_sensor enclosure_temp",
            "temperature_sensor frame",
            "temperature_sensor bed_top",

Webcam does not work in HA

Version of the moonraker integration

0.9.0

Describe your setup

MJPEG-Streamer, Klipper, Moonraker and Mainsail all running on containers, Home Assistant as well but with host network.
Webcam works in Mainsail.

The hostname resolves inside the home-assistant container and on the host.

Describe the bug

Everything works properly in the integration except the webcam

I get the following error on HomeAssistant when trying to view the webcam
ERROR (MainThread) [homeassistant.components.mjpeg] Error getting new camera image from Flow Main: Cannot connect to host HOSTNAME_REDACTED http:80 ssl:default [Name does not resolve]

Moonraker Logs

See message above

More Buttons and Layerinfos

Is your feature request related to a problem? Please describe.

No

Describe your setup

RPi 4 with Moonraker + Mainsail
Anycubic Vyper with Klipper

Describe the solution you'd like

It would be nice to have Buttons for:
Klipper Control:

  • Restart
  • Firmware Restart

Print Control:

  • Pause
  • Resume
  • Cancel

Host Control:

  • Restart

Layer Infos (If possible):

  • Current Layer
  • Total Layers

Additional context

Add any other context or screenshots about the feature request here.

Change Port Number

Hi, i use my printer at port 7127, but the extension only accepts 7125, how can i change?

camera entity state "idle" when printer is off

Version of the moonraker integration

0.9.0

Describe your setup

Klipper+Mainsail running on RPIZero with CR10S-Pro

Describe the bug

The camera entity in the integration is always reporting "idle" status even if the printer (and the RPIZero) is off.

Moonraker Logs

Add extra sensor for slicer estimate.

Is your feature request related to a problem? Please describe.

I currently have my slicer very dialed in and the times I get there are usually accurate to within 5 minutes or so. Currently the calculate eta seems to be doing a bunch of estimates using the fillament. This doesn't seem to produce very accurate results for me. For example here's a print I'm running now:
image
image

The estimate provided by home assistant is around 40 minutes off.

Describe the solution you'd like

I'd like a sensor that exposes the raw slicer time estimate so that I can simply calculate slicer_estimate - time_elapsed to get a more accurate print time.

How to get started?

Hey!
I'm just getting started with HA so I'm kinda lost on how to proceed.

I installed the Plugin via HACS and did multiple reboots of HA and the whole system but as far as I understood there should be some button in "Devices & Services" but there is nothing for me. I already read all Issues and the Wiki but didn't find any example config.

Is there anything I have to add to my configuration.yaml? I also tried to include "custom_components: !include_dir_named custom_components" but this doesn't work..

Thanks for the Plugin though. I was very happy to find it!

Integration sync question

Not a bug ticket but a question. For your integration, now that you have support for macros and fans, etc, if I add a new macro or fan, etc, to my Klipper instance, will your integration automatically detect and add it to HA as an entity? Or do we need to re-sync/re-setup our Klipper instance in HA?

Total duration sensor is being calculated in minutes instead of seconds

Version of the moonraker integration

0.8.0

Describe your setup

Voron 2.4R2 with Klipper 0.11.0, Moonraker 0.8.0, Mainsail, RPi3, PrusaSlicer, Home Assistant 2023.4.2.

Describe the bug

The Print Duration sensor is being stored in minutes, but with a seconds unit. For example, the Moonraker API returns a print_duration of 3327, but the Integration reports it as 55.96, which is 3327 / 60, so apparently the time returned by the API is being divided by 60 somewhere. See screenshots below for an example). This print has been running for around 55 minutes, so the time is correct.

ss-20230414-142220

ss-20230414-142240

ss-20230414-142303

Moonraker Logs

Logs like this every 30 seconds (note, this is a new print after the one above, but the same issue is happening):

2023-04-14 14:47:28.433 DEBUG (MainThread) [custom_components.moonraker] {'eventtime': 24104.630201951, 'status': {'print_stats': {'state': 'printing', 'message': '', 'filename': 'CW2 Cable Bridge-MDF-V 0.4N-ABS-V.gcode', 'total_duration': 309.5543529550014, 'print_duration': 126.41261088900137, 'filament_used': 175.77710999998635, 'info': {'total_layer': None, 'current_layer': None}}, 'display_status': {'message': 'Layer 3/108', 'progress': 0.05}, 'extruder': {'temperature': 239.18, 'target': 240.0, 'power': 0.7024570311815719}, 'heater_bed': {'target': 105.0, 'temperature': 105.18, 'power': 0.30368122260095887}, 'toolhead': {'position': [163.713, 165.995, 0.644976403299572, 13762.347349997544]}, 'temperature_sensor raspberry_pi': {'temperature': 50.46}, 'temperature_sensor mcu_temp': {'temperature': 39.31}, 'fan': {'speed': 0.5}, 'heater_fan hotend_fan': {'speed': 1.0}, 'controller_fan controller_fan_rear': {'speed': 0.5}, 'controller_fan controller_fan_front': {'speed': 0.5}}}
2023-04-14 14:47:28.446 DEBUG (MainThread) [custom_components.moonraker] {'state': 'ready', 'state_message': 'Printer is ready', 'hostname': 'clu', 'klipper_path': '/home/pi/klipper', 'python_path': '/home/pi/klippy-env/bin/python', 'log_file': '/home/pi/printer_data/logs/klippy.log', 'config_file': '/home/pi/printer_data/config/printer.cfg', 'software_version': 'v0.11.0-173-ga8b1b0ef', 'cpu_info': '4 core ARMv7 Processor rev 4 (v7l)'}
2023-04-14 14:47:28.677 DEBUG (MainThread) [custom_components.moonraker] {'eventtime': 24104.881174399, 'status': {'print_stats': {'state': 'printing', 'message': '', 'filename': 'CW2 Cable Bridge-MDF-V 0.4N-ABS-V.gcode', 'total_duration': 309.8053254030019, 'print_duration': 126.66358333700191, 'filament_used': 175.77710999998635, 'info': {'total_layer': None, 'current_layer': None}}, 'display_status': {'message': 'Layer 3/108', 'progress': 0.05}, 'extruder': {'temperature': 239.17, 'target': 240.0, 'power': 0.7627290667770684}, 'heater_bed': {'target': 105.0, 'temperature': 105.18, 'power': 0.2815939268374592}, 'toolhead': {'position': [163.713, 165.995, 0.644976403299572, 13762.347349997544]}, 'temperature_sensor raspberry_pi': {'temperature': 50.46}, 'temperature_sensor mcu_temp': {'temperature': 39.31}, 'fan': {'speed': 0.5}, 'heater_fan hotend_fan': {'speed': 1.0}, 'controller_fan controller_fan_rear': {'speed': 0.5}, 'controller_fan controller_fan_front': {'speed': 0.5}}}
2023-04-14 14:47:28.700 DEBUG (MainThread) [custom_components.moonraker] {'size': 1869591, 'modified': 1681497606.2104528, 'uuid': '36b8f2f1-ecff-4f08-9d1b-4a9ba4552868', 'slicer': 'PrusaSlicer', 'slicer_version': '2.6.0-alpha6+MacOS-arm64', 'gcode_start_byte': 27116, 'gcode_end_byte': 1859635, 'layer_count': 108, 'object_height': 21.65, 'estimated_time': 2167, 'nozzle_diameter': 0.4, 'layer_height': 0.2, 'first_layer_height': 0.25, 'first_layer_extr_temp': 240.0, 'first_layer_bed_temp': 105.0, 'filament_name': 'ABS-V', 'filament_type': 'ABS', 'filament_total': 2544.95, 'filament_weight_total': 6.3, 'thumbnails': [{'width': 32, 'height': 32, 'size': 1616, 'relative_path': '.thumbs/CW2 Cable Bridge-MDF-V 0.4N-ABS-V-32x32.png'}, {'width': 300, 'height': 300, 'size': 17684, 'relative_path': '.thumbs/CW2 Cable Bridge-MDF-V 0.4N-ABS-V-300x300.png'}], 'print_start_time': 1681497738.9483876, 'job_id': '000088', 'filename': 'CW2 Cable Bridge-MDF-V 0.4N-ABS-V.gcode'}
2023-04-14 14:47:28.707 DEBUG (MainThread) [custom_components.moonraker] {'job_totals': {'total_jobs': 136, 'total_time': 391834.54219230224, 'total_print_time': 348835.0499120859, 'total_filament_used': 590165.8108600149, 'longest_job': 17049.709180267, 'longest_print': 16607.541572310998}}
2023-04-14 14:47:28.707 DEBUG (MainThread) [custom_components.moonraker] Finished fetching moonraker data in 0.372 seconds (success: True)

Fix fixture

Right now we have a lot of fixture making the work hard to move tests,
I want to unify the fixture setup

api key

Can you add api key auth or is it possible already?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.