The popup is called by bubble-card, here it is
type: vertical-stack
cards:
- type: custom:bubble-card
card_type: pop-up
hash: "#printer"
show_header: false
- square: false
type: grid
columns: 1
cards:
- show_state: false
show_name: false
camera_view: live
type: picture-entity
entity: camera.octoprint_camera
camera_image: camera.octoprint_camera
aspect_ratio: "4:3"
- type: horizontal-stack
cards:
- type: custom:button-card
entity: sensor.stampante_3d_current_state
show_state: true
show_name: false
show_label: false
icon: mdi:printer-3d
tap_action:
action: toggle
state:
- value: Printing
styles:
card:
- background-color: rgba(0, 128, 0, 0.7)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
- value: "off"
styles:
card:
- background-color: rgba(20, 20, 20, 0.5)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
styles:
card:
- border-radius: 5px
- padding: 5px
grid:
- grid-template-areas: |
"i"
"s"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
state:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px
- type: custom:button-card
entity: sensor.stampante_3d_job_percentage
show_state: true
show_name: false
show_label: false
icon: mdi:percent
tap_action:
action: toggle
styles:
card:
- border-radius: 5px
- padding: 5px
- background: |
[[[
const percentage = entity.state ? parseInt(entity.state, 10) : 0;
const progress = Math.min(Math.max(percentage, 0), 100);
// Gestione dello sfondo con due sezioni ben definite
return `linear-gradient(to right, rgba(0, 255, 0, 0.7) ${progress}%, rgba(38, 50, 56, 0.7) ${progress}%, rgba(38, 50, 56, 0.7) 100%)`;
]]]
grid:
- grid-template-areas: |
"i"
"s"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
state:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px
- type: custom:button-card
entity: sensor.octoprint_bed_temperature
show_state: true
show_name: false
show_label: false
icon: mdi:bed-empty
tap_action:
action: toggle
styles:
card:
- border-radius: 5px
- padding: 5px
- background-color: |
[[[
// Ottieni il valore della temperatura
const temp = entity.state ? parseFloat(entity.state) : 0;
// Sotto i 30 gradi: colore di base
if (temp < 30) return 'rgba(20, 20, 20, 0.5)';
// Da 30 a 110 gradi: calcolo del gradiente
const gradient = Math.min((temp - 30) / 80, 1); // Normalizza il valore tra 0 e 1
const red = Math.round(38 + gradient * (255 - 38)); // Da blu scuro a rosso
const green = Math.round(50 + gradient * (0 - 50)); // Da blu scuro a 0
const blue = Math.round(56 + gradient * (0 - 56)); // Da blu scuro a 0
return `rgba(${red}, ${green}, ${blue}, 0.7)`;
]]]
grid:
- grid-template-areas: |
"i"
"s"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
state:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px
- type: custom:button-card
entity: sensor.octoprint_tool_0_temperature
show_state: true
show_name: false
show_label: false
icon: mdi:printer-3d-nozzle-heat
tap_action:
action: toggle
styles:
card:
- border-radius: 5px
- padding: 5px
- background-color: |
[[[
// Ottieni il valore della temperatura
const temp = entity.state ? parseFloat(entity.state) : 0;
// Sotto i 30 gradi: colore di base
if (temp < 30) return 'rgba(20, 20, 20, 0.5)';
// Da 30 a 250 gradi: calcolo del gradiente
const gradient = Math.min((temp - 30) / 220, 1); // Normalizza il valore tra 0 e 1
const red = Math.round(38 + gradient * (255 - 38)); // Da blu scuro a rosso
const green = Math.round(50 + gradient * (0 - 50)); // Da blu scuro a 0
const blue = Math.round(56 + gradient * (0 - 56)); // Da blu scuro a 0
return `rgba(${red}, ${green}, ${blue}, 0.7)`;
]]]
grid:
- grid-template-areas: |
"i"
"s"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
state:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px
- type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: custom:button-card
entity: sensor.octoprint_print_file
show_state: true
show_name: true
show_label: false
show_icon: false
name: "File in stampa:"
styles:
card:
- border-radius: 5px
- padding: 5px
- margin: 0
grid:
- grid-template-areas: |
"n s"
- grid-template-columns: auto 1fr
- grid-template-rows: auto
name:
- justify-self: start
- align-self: center
- font-size: 14px
state:
- justify-self: center
- align-self: center
- font-size: 14px
- type: horizontal-stack
cards:
- type: custom:button-card
entity: sensor.octoprint_print_time
show_state: true
show_name: true
show_label: false
show_icon: false
name: "Trascorso:"
styles:
card:
- border-radius: 5px
- padding: 5px
- margin: 0
grid:
- grid-template-areas: |
"n s"
- grid-template-columns: auto 1fr
- grid-template-rows: auto
name:
- justify-self: start
- align-self: center
- font-size: 14px
state:
- justify-self: center
- align-self: center
- font-size: 14px
- type: custom:button-card
entity: sensor.octoprint_print_time_left
show_state: true
show_name: true
show_label: false
show_icon: false
name: "Restante:"
styles:
card:
- border-radius: 5px
- padding: 5px
- margin: 0
grid:
- grid-template-areas: |
"n s"
- grid-template-columns: auto 1fr
- grid-template-rows: auto
name:
- justify-self: start
- align-self: center
- font-size: 14px
state:
- justify-self: center
- align-self: center
- font-size: 14px
- type: custom:button-card
entity: sensor.octoprint_thumbnail_url
tap_action:
action: toggle
show_state: false
show_name: false
show_label: false
styles:
card:
- border-radius: 10px
- padding: 0
- background-image: >
[[[ return
`url("${states['sensor.octoprint_thumbnail_url'].state}")`;
]]]
- background-size: cover
- background-position: center
- height: 80px
- width: 80px
grid:
- grid-template-areas: "\"i\""
- grid-template-rows: 1fr
- grid-template-columns: 1fr
icon:
- display: none
state:
- display: none
- type: horizontal-stack
cards:
- type: custom:button-card
entity: switch.presa_stampante_3d
show_state: false
show_name: false
show_label: false
icon: mdi:power
tap_action:
action: toggle
state:
- value: "on"
styles:
card:
- background-color: rgba(0, 128, 0, 0.7)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
icon:
- color: white
- value: "off"
styles:
card:
- background-color: rgba(20, 20, 20, 0.5)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
styles:
card:
- border-radius: 5px
- padding: 5px
grid:
- grid-template-areas: |
"i"
"s"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
state:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px
- type: custom:button-card
entity: switch.octoprint_connect_to_printer
show_state: false
show_name: false
show_label: false
icon: mdi:toggle-switch-off
tap_action:
action: toggle
state:
- value: "on"
styles:
card:
- background-color: rgba(0, 128, 0, 0.7)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
icon:
- color: white
- value: "off"
styles:
card:
- background-color: rgba(20, 20, 20, 0.5)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
styles:
card:
- border-radius: 5px
- padding: 5px
grid:
- grid-template-areas: |
"i"
"s"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
state:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px
- type: custom:button-card
entity: button.stampante_3d_stop_job
show_state: false
show_name: false
show_label: false
icon: mdi:stop
tap_action:
action: toggle
state:
- value: "on"
styles:
card:
- background-color: rgba(38, 50, 56, 0.7)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
- value: "off"
styles:
card:
- background-color: rgba(20, 20, 20, 0.5)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
styles:
card:
- border-radius: 5px
- padding: 5px
grid:
- grid-template-areas: |
"i"
"s"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
state:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px
- type: custom:button-card
entity: button.stampante_3d_pause_job
show_state: false
show_name: false
show_label: false
icon: mdi:pause
tap_action:
action: toggle
state:
- value: "on"
styles:
card:
- background-color: rgba(38, 50, 56, 0.7)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
- value: "off"
styles:
card:
- background-color: rgba(20, 20, 20, 0.5)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
styles:
card:
- border-radius: 5px
- padding: 5px
grid:
- grid-template-areas: |
"i"
"s"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
state:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px
- type: custom:button-card
entity: button.stampante_3d_resume_job
show_state: false
show_name: false
show_label: false
icon: mdi:play
tap_action:
action: toggle
state:
- value: "on"
styles:
card:
- background-color: rgba(38, 50, 56, 0.7)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
- value: "off"
styles:
card:
- background-color: rgba(20, 20, 20, 0.5)
img_cell:
- align-self: center
- justify-self: center
state:
- font-size: 12px
- text-align: center
styles:
card:
- border-radius: 5px
- padding: 5px
grid:
- grid-template-areas: |
"i"
"s"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
state:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px
- type: horizontal-stack
cards:
- type: custom:button-card
entity: script.stampante3d_home_axis
show_state: false
show_name: true
show_label: false
name: Home Axis
icon: mdi:home
tap_action:
action: call-service
service: script.turn_on
service_data:
entity_id: script.stampante3d_home_axis
styles:
card:
- border-radius: 5px
- padding: 5px
grid:
- grid-template-areas: |
"i"
"n"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
name:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px
- type: custom:button-card
entity: script.stampante3d_retract
show_state: false
show_name: true
show_label: false
name: Retract
icon: phu:3d-filament
tap_action:
action: call-service
service: script.turn_on
service_data:
entity_id: script.stampante3d_retract
styles:
card:
- border-radius: 5px
- padding: 5px
grid:
- grid-template-areas: |
"i"
"n"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
name:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px
- type: custom:button-card
entity: script.stampante3d_extrude
show_state: false
show_name: true
show_label: false
name: Extrude
icon: phu:3d-filament
tap_action:
action: call-service
service: script.turn_on
service_data:
entity_id: script.stampante3d_extrude
styles:
card:
- border-radius: 5px
- padding: 5px
grid:
- grid-template-areas: |
"i"
"n"
- grid-template-columns: auto
- grid-template-rows: auto auto
icon:
- justify-self: center
- align-self: center
- width: 30px
- height: 30px
name:
- justify-self: center
- align-self: center
- font-size: 12px
- padding-top: 2px
- padding-bottom: 2px