Created
September 23, 2022 13:34
-
-
Save rufinus/3cbbdbff008762a7841bc674ab7d4758 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- platform: rest | |
name: voron24_sensor | |
resource: "http://192.168.8.25:7125/printer/objects/query?heater_bed&extruder&print_stats&toolhead&display_status&virtual_sdcard&temperature_sensor%20raspberry_pi&temperature_sensor%20MCU&temperature_sensor%20chamber_temp" | |
json_attributes_path: "$.result.status" | |
json_attributes: | |
- heater_bed | |
- extruder | |
- print_stats | |
- toolhead | |
- display_status | |
- virtual_sdcard | |
- "output_pin caselight" | |
- "temperature_sensor raspberry_pi" | |
- "temperature_sensor MCU" | |
- "temperature_sensor chamber_temp" | |
value_template: >- | |
{{ 'OK' if ('result' in value_json) else None }} | |
- platform: template | |
sensors: | |
voron24_print_preview: | |
friendly_name: 'Print Preview' | |
value_template: "{{ ['http://192.168.8.25:7125/server/files/gcodes/.thumbs/', (states.sensor.voron24_sensor.attributes['print_stats'].filename | replace('.gcode', '-400x300.png') | replace(' ', '%20') | string)] | join if is_state('sensor.voron24_sensor', 'OK') else None }}" | |
voron24_hotend_target: | |
friendly_name: 'voron24 Hotend Target' | |
device_class: temperature | |
unit_of_measurement: '°C' | |
value_template: >- | |
{{ states.sensor.voron24_sensor.attributes['extruder']['target'] | float | round(1) if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_hotend_actual: | |
device_class: temperature | |
unit_of_measurement: '°C' | |
value_template: >- | |
{{ states.sensor.voron24_sensor.attributes['extruder']['temperature'] | float | round(1) if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_bed_target: | |
device_class: temperature | |
unit_of_measurement: '°C' | |
value_template: >- | |
{{ states.sensor.voron24_sensor.attributes['heater_bed']['target'] | float | round(1) if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_bed_actual: | |
device_class: temperature | |
unit_of_measurement: '°C' | |
value_template: >- | |
{{ states.sensor.voron24_sensor.attributes['heater_bed']['temperature'] | float | round(1) if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_raspberry_actual: | |
device_class: temperature | |
unit_of_measurement: '°C' | |
value_template: >- | |
{{ states.sensor.voron24_sensor.attributes['temperature_sensor raspberry_pi']['temperature'] | float | round(1) if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_mcu_actual: | |
device_class: temperature | |
unit_of_measurement: '°C' | |
value_template: >- | |
{{ states.sensor.voron24_sensor.attributes['temperature_sensor MCU']['temperature'] | float | round(1) if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_chamber_actual: | |
device_class: temperature | |
unit_of_measurement: '°C' | |
value_template: >- | |
{{ states.sensor.voron24_sensor.attributes['temperature_sensor chamber_temp']['temperature'] | float | round(1) if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_state: | |
icon_template: mdi:printer-3d | |
value_template: >- | |
{{ states.sensor.voron24_sensor.attributes['print_stats']['state'] if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_current_print: | |
value_template: >- | |
{{ states.sensor.voron24_sensor.attributes['print_stats']['filename'] if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_current_progress: | |
unit_of_measurement: '%' | |
icon_template: mdi:file-percent | |
value_template: >- | |
{{ (states.sensor.voron24_sensor.attributes['display_status']['progress'] * 100) | round(1) if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_message: | |
icon_template: mdi:message-alert | |
value_template: >- | |
{{ states.sensor.voron24_sensor.attributes['display_status']['message'] if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_print_time: | |
icon_template: mdi:clock-start | |
value_template: >- | |
{{ states.sensor.voron24_sensor.attributes['print_stats']['print_duration'] | timestamp_custom("%H:%M:%S", 0) if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_time_remaining: | |
icon_template: mdi:clock-end | |
value_template: >- | |
{{ (((states.sensor.voron24_sensor.attributes['print_stats']['print_duration'] / states.sensor.voron24_sensor.attributes['display_status']['progress'] - states.sensor.voron24_sensor.attributes['print_stats']['print_duration']) if states.sensor.voron24_sensor.attributes['display_status']['progress'] > 0 else 0) | timestamp_custom('%H:%M:%S', 0)) if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_eta: | |
icon_template: mdi:clock-outline | |
value_template: >- | |
{{ (as_timestamp(now()) + 2 * 60 * 60 + ((states.sensor.voron24_sensor.attributes['print_stats']['print_duration'] / states.sensor.voron24_sensor.attributes['display_status']['progress'] - states.sensor.voron24_sensor.attributes['print_stats']['print_duration']) if states.sensor.voron24_sensor.attributes['display_status']['progress'] > 0 else 0)) | timestamp_custom("%H:%M:%S", 0) if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_nozzletemp: | |
icon_template: mdi:thermometer | |
value_template: >- | |
{{ [(states.sensor.voron24_sensor.attributes['extruder']['temperature'] | float | round(1) | string), " / ", (states.sensor.voron24_sensor.attributes['extruder']['target'] | float | round(1) | string)] | join if is_state('sensor.voron24_sensor', 'OK') else None }} | |
voron24_bedtemp: | |
icon_template: mdi:thermometer | |
value_template: >- | |
{{ [(states.sensor.voron24_sensor.attributes['heater_bed']['temperature'] | float | round(1) | string), " / ", (states.sensor.voron24_sensor.attributes['heater_bed']['target'] | float | round(1) | string)] | join if is_state('sensor.voron24_sensor', 'OK') else None }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment