Skip to content

Instantly share code, notes, and snippets.

let switchId = 0;
let url = 'http://10.10.10.10:8123';
function check(event) {
Shelly.call("HTTP.GET", {url: url, body:{}, timeout: 2 }, function(resp) {
let reachable = (resp && resp.code === 200);
if (!reachable) {
print("override switch behaviour");
Shelly.call("Switch.Set", { id: event.id, on: event.info.state }, function(){});
}
});
@mawmawmawm
mawmawmawm / gist:5a6c65d413cdf822b0d75b26b5e92754
Created February 21, 2026 21:43
3D Print Duration in hours
template:
- sensor:
- name: "Prusa Print Graph Span"
state: >
{% set val = states('sensor.prusamini_print_start') %}
{% if val in ['unknown', 'unavailable', ''] %}
1h
{% else %}
{%- set hours = (now() - as_datetime(val)).total_seconds() / 3600 -%}
{%- set base = hours | int -%}
type: grid
cards:
- type: heading
heading_style: title
heading: 3D-Drucker Nerd-Stats
icon: mdi:printer-3d-nozzle
- type: custom:config-template-card
grid_options:
columns: full
entities:
@mawmawmawm
mawmawmawm / gist:c0848b4f8c3a2e168cb6d5f85e94b708
Created February 21, 2026 21:41
3D Print Overview in HA
type: grid
cards:
- type: heading
heading_style: title
heading: 3D-Drucker Überblick
icon: mdi:printer-3d-nozzle
- type: tile
entity: switch.3d_drucker
icon: carbon:chart-3d
vertical: false