Hi, I’m a newbie with little coding experience.
I have a ring doorbell, with poor battery life, and I would like on of my Hue bulbs to light up red when the Ring battery drops below 20%.
I’m using a Gauge Card in HA.
I asked ChatGPT and got the following code
type: gauge
entity: sensor.front_door_battery
needle: true
min: 20
severity:
green: 75
yellow: 45
red: 20
name: Ring Doorbell Battery
alias: Battery Low - Turn Hue Red
description: Turns a Philips Hue bulb red when a battery drops below 20%.
trigger:
- platform: numeric_state
entity_id: sensor.front_door_battery
below: 20
action:
- service: light.turn_on
target:
entity_id: light.hue_lightstrip_plus_1
data:
brightness: 125
color_name: red
mode: single
Shockingly, it doesn’t work. I would very much like some advice on how I might resolve the issue.
As I’m sure you will know, it’s only the code below red:20 that came from ChatGPT.
What’s the current state value of sensor.front_door_battery?
If it’s already below 20 then it’s too late to trigger the Numeric State Trigger (which only triggers at the moment when the sensor’s value decreases and crosses the threshold value of 20).
Hi,
Thanks for responding.
The actual value is currently 84 and I set the code to that. Ultimately I want it to trigger at 20%.
The battery does drain quite quickly. So, I’ve now changed the trigger value to 83.
Now I’ll have to wait.
That will trigger the automation every minute on the minute. That’s a faster way to at least test whether the problem is somehow with the action: block or whether it’s with the numeric_state trigger.
Maybe a more basic question… where is the code for the automation, specifically? Did you pull what you pasted out of a file or the GUI (and which file or which part of the GUI)? Does that code, including the gauge code and the uatomation code, all come from the same place?
Yep, what @d921 said just above me. Your first post contains two separate pieces of code - the first bit goes in the gauge card config in your dashboard, while the rest is an automation you need to set up in Settings > Automations.
If you’re pasting that entire code in one place, then nothing will work.