Suggestion on part time template sensors usage

I have several template sensors to monitor the status of my 3d printer. my printer however isn’t on all the time, so the logs show a bunch of errors because it’s off much of the time.
any suggestions how to poll only when the printer is actually on? or another way to deal with it?

Yes you can create availability templates if you use the new template integration rather than the template sensor platform. Share one of your template sensors.

this is why you ask… awesome. didn’t know about that.
here is one

  • platform: template
    sensors:
    head_temp_current:
    friendly_name: “Nozzle Temperature Current”
    value_template: ‘{{ states.sensor.duet_status.attributes.temps.current[1] }}’
    unit_of_measurement: “°C”

Thanks!

When posting config text please use code blocks </>, or this, not the quote option.

So the template integration goes in your configuration.yaml file:

template:
  - sensor:
      - name: "Nozzle Temperature Current"
        unit_of_measurement: "°C"
        state: "{{ state_attr('sensor.duet_status', 'temps').current[1] }}"
        availability: "{{ state_attr('sensor.duet_status', 'temps').current[1]|is_number }}"

noted. thanks for the info and example.