Terrarium heating automation

I have spent the last few days setting up a new bioactive terrarium and automating it for my son’s Leopard Gecko.
I first thought that a generic. thermostat in HA would be sufficient but discovered that the chosen heat source ( a deep heat projector) preferred dimming instead of an on-off function. I don’t know much about coding but was able to piece together the following auotmations.
My concern is that the automations do not have the intended effects of getting the terrarium to the desired temps and then maintaining it.
Any input would be much appreciated.

The first Automation turns the heat on full at sunrise

alias: Terrarium Day
description: ""
trigger:
  - platform: sun
    event: sunrise
    offset: 0
condition: []
action:
  - service: switch.turn_on
    target:
      device_id: 37ed8637275e9b5cb6ee288cd94e3805
    data: {}
  - service: light.turn_on
    target:
      entity_id: light.terrarium_heater_dimmer
    data:
      brightness: 255
mode: single

Then once the Hot end of the terrarium rises above 36 C, the heat gets turned down.
Right now I have it turned down to brightness: 190 but am thinking

{{  (states.light.terrarium_heater_dimmer.attributes.brightness) / 2 }} 

might be more appropriate?

alias: "Terrarium turn down heat "
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.terrarium_terrarium_hot_end_floor
    for:
      hours: 0
      minutes: 2
      seconds: 0
    above: 36
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.terrarium_heater_dimmer
    data:
      brightness: 190
mode: single

The next automation then attempts to gradually turn up the brightness to achieve a temp between 34-36

alias: Terrarium turn up heat
description: ""
trigger:
  - platform: template
    value_template: " {{ (as_timestamp(states.sensor.time.last_changed) - as_timestamp(states.sensor.terrarium_heater_brightness.last_changed)) > 300 }} "
condition:
  - condition: sun
    before: sunset
    after: sunrise
  - condition: numeric_state
    entity_id: sensor.terrarium_terrarium_hot_end_floor
    below: 34
  - condition: numeric_state
    entity_id: sensor.terrarium_heater_brightness
    below: 255
action:
  - service: light.turn_on
    target:
      entity_id: light.terrarium_heater_dimmer
    data:
      brightness: " {{ ((255 - (states.light.terrarium_heater_dimmer.attributes.brightness)) * 0.1 + (states.light.terrarium_heater_dimmer.attributes.brightness)) }} "
mode: single
  • edited to articulate the underlying concern properly

Can you elaborate on what you mean by the light prefers to be dimmed?

If the temperature sensor failed (or simply lost connection with Home Assistant), it would cease to report the terrarium’s temperature. That could negatively impact the Numeric State Trigger.

I would create an automation to monitor the health of the temperature sensor. For example, check if it’s state becomes unavailable and if it hasn’t reported a new value in more than 15 minutes.

The heating source is https://www.arcadiareptile.com/heating/deep-heat-projector/

According to their website
" As with all lamps, should be used with a thermostat. A dimming thermostat will provide accurate control of your thermogradient. You should check the temperature with a suitable quality non-contact laser thermometer. If used correctly this high quality, handmade heating lamp should provide you with years of stable heat provision. "

According to various other sites “correctly” means to reduce heat cycles

What kind of temperature sensor is sensor.terrarium_terrarium_hot_end_floor?


EDIT

I don’t know enough about the care of a gecko to determine if the automations you have created are sufficient, and reliable, to ensure its health. However, given that an animal’s life is involved, what I suggest is to assume the worst can happen and make contingencies. Plan for the temperature sensor and the light to fail; monitor them and report when they’re misbehaving (no temperature reported, light is on but no temperature increase is detected, etc).

I have four sensors on an esp32 with ESPHome

sensor:
  - platform: dht
    pin: GPIO26
    model: dht22
    temperature:
      name: "Terrarium Hot End Temperature"
    humidity:
      name: "Terrarium Hot End Humidity"
    update_interval: 60s
  - platform: dht
    pin: GPIO27
    model: dht22
    temperature:
      name: "Terrarium Cool End Temperature"
    humidity:
      name: "Terrarium Cool End Humidity"
    update_interval: 60s      
  - platform: dallas
    address: 0xd63ce1d458546228
    name: "Terrarium Cool End Floor"
  - platform: dallas
    address: 0x903ce1d443d97b28
    name: "Terrarium Hot End Floor"

The “Terrarium Hot End Floor” DS18B20 sits on the basking rock which is directly under the heating source.

I will be cycling this terrarium for the next week or so before introducing life.
Part of this cycling will be adjusting the total wattage/ distance of the heater so it is impossible to heat this unit above the tolerable temperature of the life housed in it and the ambient temp of the room the terrarium is in is above the minimum temp the life can tolerate.

Did you ever figure this out?

You’re missing one very important aspect of this. You MUST have a dimming thermostat or dimming power regulator connected to a micro-controller (like an Arduino) for you to be able to actually adjust the amount of power going to the DHP. No amount of coding will substitute a dimming power supply since all you will be able to do is turn it on and off.

Spyder Robotics makes something called a HerpStat which can run pretty expensive depending on how many sensors or power connections you want to control. But, it does exactly what you’re wanting H.A. to do.

I’m actually in the process of building my own version of the HerpStat in a different way from them and so that it natively works with H.A.

Habitonix,

Yes this has been working well for the last few month. Our Gecko is very happy these days.

I have the following two automations running. Paired with a dimmable zigbee plug keeps the temps perfect and the fixtures powered. No on and off.
the first automation increase the power output of the plug if the temp falls below 34 during the day.

alias: Terrarium turn up heat
description: ""
trigger:
  - platform: template
    value_template: " {{ (as_timestamp(states.sensor.time.last_changed) - as_timestamp(states.sensor.terrarium_heater_brightness.last_changed)) > 300 }} "
  - platform: numeric_state
    entity_id:
      - sensor.terrarium_terrarium_hot_end_floor
    below: 34
condition:
  - condition: sun
    before: sunset
    after: sunrise
  - condition: numeric_state
    entity_id: sensor.terrarium_terrarium_hot_end_floor
    below: 34
  - condition: numeric_state
    entity_id: sensor.terrarium_heater_brightness
    below: 255
action:
  - service: light.turn_on
    target:
      entity_id: light.terrarium_heater_dimmer
    data:
      brightness: " {{ ((255 - (states.light.terrarium_heater_dimmer.attributes.brightness)) * 0.1 + (states.light.terrarium_heater_dimmer.attributes.brightness)) }} "
mode: single

This second automation dims the power if temps rise above 36

alias: "Terrarium turn down heat "
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.terrarium_terrarium_hot_end_floor
    for:
      hours: 0
      minutes: 2
      seconds: 0
    above: 36
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.terrarium_heater_dimmer
    data:
      brightness: " {{  (states.light.terrarium_heater_dimmer.attributes.brightness) / 2 }} "
mode: single

The end result is the temps and power settle around 35 at about a 70% power setting

1 Like