2 automations just seemed to stop working

I’m very new to HA. I’ve run across a problem and I’m not sure how to figure out the issue. I’d appreciate any guidance.

I have 2 automations. They both use the current temperature from an indoor thermometer to turn on a plug to keep a bathroom in the range of 74 degree F. The yaml’s for both are near the bottom of this.

It was working fine for several days. You can see the temp chart here.

Then around 6pm jan 9th neither of the automations would trigger anymore. I rebooted my HA yellow, Unplugged the plug to reboot that. This thing just no longer triggers from the automations it seems.

I can use HA to manually turn the switch on and off so I know HA can control the plug. I know HA can see the temp because it shows the chart,. But the automation does nothing. I tried looking at the traces but since its not triggering there really isn’t anything there that I can use to figure this out. Being a noob its much easier to try and see when something triggers when it should not then why it doesn’t trigger. There’s seems to be fewer places to give clues.
Anyone have any ideas?

alias: Bathroom Krape heater off
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.bathroom_krape_thermometer_sonoff_snzb_02d_temperature
    for:
      hours: 0
      minutes: 2
      seconds: 0
    above: 74
conditions: []
actions:
  - type: turn_off
    device_id: 4680243b99fa1dd27cfc16a67f5c5350
    entity_id: 22f5a847a6423516bc1dd2ff4e051264
    domain: switch
mode: single
alias: Bathroom Krape heater on
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.bathroom_krape_thermometer_sonoff_snzb_02d_temperature
    for:
      hours: 0
      minutes: 2
      seconds: 0
    below: 73.7
conditions: []
actions:
  - type: turn_on
    device_id: 4680243b99fa1dd27cfc16a67f5c5350
    entity_id: 22f5a847a6423516bc1dd2ff4e051264
    domain: switch
mode: single

Why aren’t you using a generic thermostat instead?

From your chart, it looks as if the temperature has been consistently above 75 for the last 24 hours, so neither automation would trigger anyway.

Not sure about earlier on - is it possible that it has always been above your threshold of 74? A trigger is an event, not a state. To fire your first automation, the temperature would have to rise from below 74 to above 74 and stay there for 2 minutes. It would then have to drop below 74 and rise a second time before it fired again.

Being new it’s more about building my ha skills then just getting an automation in place. I’m still trying to learn how to ride the bike in the parking lot :slightly_smiling_face:.

Once my skill is a bit better I’ll start looking at blueprints etc and use and learn how they work from a development point of view.

1 Like

Don’t reinvent the wheel. A generic thermostat is not a blueprint but a built-in function in Home Assistant, that will be infinitely more reliable than any automation you could cobble together. Even if you already had tons of experience writing them.

1 Like

Thanks but my ha journey is about learning to master this. I already have a home automation system at home based on the universal devices universe that I’ve mastered, it’s ruining the house and I’ve outgrown.

So my ha is about learning and mastering, results are secondary at this stage.

Mastering usually means using the best tools and not sticking to one.
YMMV

Fair enough.

There are several ways to do most things. An alternative to the generic thermostat might be an automation triggered by a threshold helper. If you define upper and lower limits, it will be “on” when the temperature is between them, otherwise off.

Your action section could then be: “if temperature >74 do this, else do that”.

triggers:
  - trigger: state
    entity_id:
      - binary_sensor.bathroom_temperature_threshold
    to: "off"
actions:
  - if:
      - condition: numeric_state
        entity_id: sensor.bathroom_krape_thermometer_sonoff_snzb_02d_temperature
        above: 74
    then:
      - action: switch.turn_off
        target:
          entity_id: switch.your_plug
    else:
      - action: switch.turn_on
        target:
          entity_id: switch.your_plug

Thanks so much for this. I get the concept, pretty easy to understand when its laid out the way you just did. This helps my understanding of the “natural” HA landscape a bit more.

It looks ;like I need to learn and try working with helpers more to “own” thier use scope.

Thanks again.

You’re welcome. :smile:

Incidentally, you might get a better feel for how HA works if you work with entities rather than devices. Most devices contain several entities, so it gives you a better focus on what’s happening.

Thanks, I’ll take that to heart.

One more question if you dont mind,

I’m trying to look under the covers at the code of this helper and I’m not finding how to look at that. In the UI I dont see any yaml edit option to see how its constructed.

What’s the best way to see the moving parts of a helper, not just the human facing settings?

In most cases things that are configured via the UI do not have corresponding YAML configuration, the configuration is stored as json within a hidden folder in the config folder.

then the question that comes to mind is how do those that build helpers edit the function/bugs after they are finished building it?

Currently, they don’t if the option isn’t built into the helper settings already…

image

It has been asked for…

Interesting development design chose. Thanks