First light control

I want to switch a light device specified as ipad_charger when ipad is fully charged, i have tried with this.

  • action:
    …-.service: light.turn_off
    …entity_id: light.ipad_charger
    …alias: Ipad charged
    …id: ‘1518732328684’
    …trigger:
    …-.entity_id: sensor.ipad_battery_level
    …from: ‘99’
    …platform: state
    …to: ‘100’

What do i do wrong?

Well it’s hard to fault find when you can’t see the correctly formatted code, so make sure there is a blank line above and below the code, then select the code (when in the edit box), and click the </> button at the top of the edit box. This for pasting code in the forum, which is where you are :stuck_out_tongue:

image

I’m using the build in configurator and don’t see that button

Why don’t you use the forum internal functions for pre-formatted text? Thats what @keithh666 asked for :face_with_raised_eyebrow:

Your automation code does look ok (at least to me, but I am not an expert).
So first thing you should try is to trigger the automation manually. If you don’t see the automation on your UI, I think you need to define where the “all_automations” group should be displayed, like:

group:
  default_view:
    view: yes
    entities:
      - group.all_automations

If you can trigger it manually, then I would check the trigger: take a look at the current sensor state and check if it is what you expect.

Greetings

Your code looks OK, to me, do you have a sensor called sensor.ipad_battery_level and a light called light.ipad_charger shown in your states table?

… And presumably the light was on prior to the change from 99 to 100% ?

(edit) sorry @Jojo-A, clicked the wrong reply arrow, was meant for @dk01

I do have a sensor for iPad showing actual battery level and a light called iPad_charger.
If i remove line 4 it turns off all light when pushing the trigger in UI panel

My plan is to make another automation turning the light om when powerlevel is under 15%

Does it matter, that you have a “space” character behind the entity name in line 4?

And if you say:

what does

mean?

It doesn’t make any change to remove the space, my light looks like this

Hi
I found it, i used the entity id from UI panel not the original which had the same name followed by a nr., I found the original entity id in the customize.yaml file
Thanks for helping me.

@dk01
great, well done and have fun :slight_smile: :+1: !

Use this …
image
click the <> to get to the state table to determine what your id’s are :slight_smile:

Get here by clicking the hamburger icon at the top left of the HA screen

1 Like