#light decrease by 1% instead of 10%

1 messages ยท Page 1 of 1 (latest)

bitter cairn
#

alias: Einspeisung aus
description: ""
trigger:

  • platform: time_pattern
    seconds: /10
    condition:
  • condition: numeric_state
    entity_id: sensor.strom_dg_aktuell
    below: -20
    action:
  • device_id: 79316d9a5516786bb1b954a8ad0e112a
    domain: light
    entity_id: light.outputmosfet_outputmosfet
    type: brightness_decrease
    mode: single
#

this automation decreases the light by 10%. How do I do 1%?

inner capeBOT
#

To format your text as code, enter three backticks on the first line, press Shift+Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

magic wadi
bitter cairn
#

light.outputmosfet_outputmosfet.default,x,y,0 in the /config/light_profiles.csv what is x,y for?

#
description: ""
trigger:
  - platform: time_pattern
    seconds: /10
condition:
  - condition: numeric_state
    entity_id: sensor.strom_dg_aktuell
    below: -20
action:
  - service: light.turn_off
    target:
      entity_id: light.outputmosfet_outputmosfet
    data:
      brightness_step_pct: -1```
#

like this?

magic wadi
#

Well, almost

#

light.turn_on

magic wadi
bitter cairn
#

okey thx

magic wadi
bitter cairn
#

no need for color

#

i only want to change the "brightness" of the mosfet

#

so can i leave x,y in the header?

#

it seems to be working ๐Ÿ™‚ thx again

magic wadi
#

Ignore that file

#

You only want to edit that file if you want to set defaults

#

I will say that your automation is horrible ๐Ÿ˜‰

#

Every 10 seconds step it down 1%.... until it turns off?

bitter cairn
#

so i have a battery charged by a pv-system

#

the sensor reads the energy consumption

magic wadi
#

If it doesn't turn off it'll keep calling the service every 10 seconds, trying to set it from 1% to 0%

bitter cairn
#

i use two automations to level out the consumption between 0 and -20 Watts

#

the timing is still a bit off

#

i have to test a bit more so the ouputmosfet reacts fast but does not overshoot ๐Ÿ˜„

#

i think it will never go to 0%

#

do you understand what kind of automation i want to create?

#

do you have a better idea?

magic wadi
#

I do understand, and I'd probably trigger based on it going below -20, and use a repeat in the action

bitter cairn
#

i tried that one, but the esp32 with esphome had quiet a had time with so many inputs and crashed ๐Ÿ˜„

#

hard

magic wadi
#
alias: Einspeisung reduzieren
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.strom_dg_aktuell
    below: -20
condition: 
  - condition: state
    entity_id: light.outputmosfet_outputmosfet
    state: 'on'
action:
  - repeat:
      while:
        - condition: state
          entity_id: light.outputmosfet_outputmosfet
          state: "on"
        - condition: numeric_state
          entity_id: sensor.strom_dg_aktuell
          below: -20
      sequence:
        - service: light.turn_on
          target:
            entity_id: light.outputmosfet_outputmosfet
          data:
            brightness_step_pct: -1
        - delay: '00:10:00'
#

That's going to be gentler on the ESP than what you wrote

#
alias: Einspeisung reduzieren
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.strom_dg_aktuell
    below: -20
  - platform: state
    entity_id: light.outputmosfet_outputmosfet
    to: 'on'
condition: 
  - condition: state
    entity_id: light.outputmosfet_outputmosfet
    state: 'on'
  - condition: numeric_state
    entity_id: sensor.strom_dg_aktuell
    below: -20
action:
  - repeat:
      while:
        - condition: state
          entity_id: light.outputmosfet_outputmosfet
          state: "on"
        - condition: numeric_state
          entity_id: sensor.strom_dg_aktuell
          below: -20
      sequence:
        - service: light.turn_on
          target:
            entity_id: light.outputmosfet_outputmosfet
          data:
            brightness_step_pct: -1
        - delay: '00:10:00'
``` optional robustness edit
bitter cairn
#

thx that is more info that i expected ๐Ÿ™‚ I will try that ๐Ÿ™‚

magic wadi
#

That'll run when the sensor falls below -20 and the light is on, and will stop running if the sensor goes above -20 or the light turns off

#

You could add another condition to stop it at 1% brightness

bitter cairn
#

i see what you are doing there ๐Ÿ™‚ quiet elegant

magic wadi
#

Sometimes brute force is the only way, but ... not always

bitter cairn
#

if i try your idea, can i remove the delay, so it is faster ?

#

do I run into a problem if it goes down to 0% ?

magic wadi
#

The delay is the same "delay" you had in yours

#

You can test it and see if it turns off when it goes from 1% to 0%

bitter cairn
#

okey thx i will test now ๐Ÿ™‚

#

the esp32 cant handle no delay ๐Ÿ˜„

#

i had to reset it and the automation wont start again because 0% means off...

#

ยดยดยด trigger:

  • platform: numeric_state
    entity_id: sensor.strom_dg_aktuell
    below: -20
  • platform: state
    entity_id: light.outputmosfet_outputmosfet
    to: 'on' ยดยดยด
magic wadi
#

```
code: here
```

#

Back ticks

bitter cairn
#

the wrong ones

magic wadi
#

I assume you've turned it on?

bitter cairn
#

''' trigger:

  • platform: numeric_state
    entity_id: sensor.strom_dg_aktuell
    below: -20
  • platform: state
    entity_id: light.outputmosfet_outputmosfet
    to: 'on' '''
#

does this trigger turn the mosfet on or does it only check if its on?

magic wadi
#

Still the wrong ones

inner capeBOT
#

There are three sections to an automation:

  • trigger: When any one of these becomes true the automation starts processing. Only one trigger is ever responsible for starting an automation, if you make a condition that checks for more than one having started the automation then the condition can never be true.
  • condition: These are checked after a trigger starts the processing, and must be true for the automation to continue.
  • action: This is the part that does something, and can also include further conditions.
bitter cairn
#

๐Ÿ˜„

magic wadi
#

Triggers and conditions don't do anything

#

Only actions do

bitter cairn
#

okey so i put another action into it

magic wadi
#

If you want it to do anything, yes

bitter cairn
#

it is not working becaus the trigger and condition will block it currently

magic wadi
#

What are you trying to do?

#

If you want the light turned on do it manually, or write another automation to handle that

bitter cairn
#

I want the automation to work all the time even when i turn it of accidently

magic wadi
#

Then you want another automation that turns it on if it's turned off

bitter cairn
#

or i just remove `

#

ยดยดยด - condition: state
entity_id: light.outputmosfet_outputmosfet
state: "on" ยดยดยด

magic wadi
#

One day ... one day you'll find the right quotes

bitter cairn
#

๐Ÿ˜„

#
    entity_id: light.outputmosfet_outputmosfet
    state: "on" ```
#

๐Ÿ˜‰

#

is it possible to generate the steps variable ?

magic wadi
#

"steps variable"?

bitter cairn
#

let me make an example

magic wadi
bitter cairn
#

so i turn on a light an the consumption increase by 100W I want to go in 10% steps but if i plug in a phone (=5w

#

)

#

i want to increase by 1%

#

depending on the gap between current and new consumption

magic wadi
bitter cairn
#

okey i will read the template section ๐Ÿซ 

#

i think we are done here thx for the help again ๐Ÿ™‚ i will close the thread now bye :=