New to home assistant and missing knowledge

Hello, i recently started my home assistant experience and i am running into an issue that google cannot solve for me. i am experienced in many programming languagues but not yaml and since supervisor mode is not possible on my synology nas, i am force to use home assistant instead of node red for this problem.

the situation is quite simple. i have 3 lights controlled with 3 times the dimmer 2 from shelly.
i want to use 1 of the inputs of the switch inputs of 1 of the shelly dimmers to dim all the brightnesses of all 3 lights at once and 1 of the switch inputs to make all 3 of them brighter.

i was thinking of using an automation for this but i cannot make any variables to store the state state of the current light in.

the prefferd situation would look like this:

if btn 1 is pressed:
case (status)
0: set status to 20 // meaning set brightness from 0 to 20%
20: set status to 40
40: set status to 60
60: set status to 80
80: set status to 100
100: set status to 100

if btn 2 is pressed:
case (status)
100:set status to 80
80:set status to 60
60:set status to 40
40:set status to 20
20:set status to 0
0:set status to 0

of course this isn’t yaml but i hope someone can give me a start on how to approach this.
the main problem i run in is not being able to read the brightness state so i can copy it over and being able to set the brightness state.

please let me know if there is any information missing or if there is already a similar post somewhere that i missed. thanks in advance.

entity ID of dimmers:
1: light.shellydimmer2_3c6105e4a3c7
2: light.shellydimmer2_e8db84d6e0cb
3: light.shellydimmer2_e8db84d6a003

Should be pretty easy, what are the button entity ids for the first dimmer?

Also you know you can change those light numeric entity id’s to be something meaningful?

Click on the entity in the Configuration / Entities list and change it - if you have not used it in a script or automation yet. Otherwise you have to update all those too.

hello,

I tried to change those to something meaningful and it shows up in the Lovelace view as a completely different name. but for some reason the entity id’s have not changed their name. i have no clue yet how to change this at this point but will try to figure that out.

after some searching, i found that i have no entity ID’s for the buttons attached to the dimmer. in the shelly app i can use it but in home assistant i cannot see them unfortunately. if anyone has any experience with this how i can make this visible i would appreciate that really much.

but in case the entity id would be xyz1 and xyz2, how would i approach this problem? should this be made in automations or as a script or how?

Go to the Integration and click on the device, then show the disabled entities:

You can then enable the button binary sensors and rename them.

I’m sorry i am lacking alot of knowledge i see.
indeed now i found the correct entitties! thankyou for pointing that out.

shellydimmer2-E8DB84D6E0CB channel 1 Input
shellydimmer2-E8DB84D6E0CB channel 2 Input

number 1 is the “go brighter switch”
number 2 is the “make less bright switch”

friendly_name: shellydimmer2-E8DB84D6E0CB channel 1 Input
device_class: power

friendly_name: shellydimmer2-E8DB84D6E0CB channel 2 Input
device_class: power

What are the actual entity ids though, binary_sensor.something

these are the 2 actual inputs:

binary_sensor.shellydimmer2_e8db84d6e0cb_channel_1_input
binary_sensor.shellydimmer2_e8db84d6e0cb_channel_2_input

note: i did just change the names to a bit more friendly name as you can see in the picture below:

Ok, try this. It is untested so make sure to do a configuration check before reloading automations or restarting.

- alias: light dimmer
  trigger:
    - platform: state
      entity_id: binary_sensor.shellydimmer2_e8db84d6e0cb_channel_1_input
      from: 'off'
      to: 'on'
      id: 'up'
    - platform: state
      entity_id: binary_sensor.shellydimmer2_e8db84d6e0cb_channel_2_input
      from: 'off'
      to: 'on'
      id: 'down'
  action:
    - choose:
        - conditions:
            - condition: trigger
              id: 'up'
          sequence:
            - service: light.turn_on
              target:
                entity_id: light.shellydimmer2_3c6105e4a3c7
              data:
                brightness_pct: "{{ [state_attr('light.shellydimmer2_3c6105e4a3c7', 'brightness_pct')|int + 20, 100]|min }}"
            - service: light.turn_on
              target:
                entity_id: light.shellydimmer2_e8db84d6e0cb
              data:
                brightness_pct: "{{ [state_attr('light.shellydimmer2_e8db84d6e0cb', 'brightness_pct')|int + 20, 100]|min }}"
            - service: light.turn_on
              target:
                entity_id:  light.shellydimmer2_e8db84d6a003
              data:
                brightness_pct: "{{ [state_attr(' light.shellydimmer2_e8db84d6a003', 'brightness_pct')|int + 20, 100]|min }}"
        - conditions:
            - condition: trigger
              id: 'down'
          sequence:
            - service: light.turn_on
              target:
                entity_id: light.shellydimmer2_3c6105e4a3c7
              data:
                brightness_pct: "{{ [state_attr('light.shellydimmer2_3c6105e4a3c7', 'brightness_pct')|int - 20, 0]|max }}"
            - service: light.turn_on
              target:
                entity_id: light.shellydimmer2_e8db84d6e0cb
              data:
                brightness_pct: "{{ [state_attr('light.shellydimmer2_e8db84d6e0cb', 'brightness_pct')|int - 20, 0]|max }}"
            - service: light.turn_on
              target:
                entity_id:  light.shellydimmer2_e8db84d6a003
              data:
                brightness_pct: "{{ [state_attr(' light.shellydimmer2_e8db84d6a003', 'brightness_pct')|int - 20, 0]|max }}"

Note: you will have to run dimmer 1 in detached mode, or the buttons will alter the brightness directly in the shelly dimmer.

wow, i did not expect to get the full code out of this! this is really appreciated! however i get the error that a dictionary is needed. i am not sure if this is any plugin that i need to download, or if this is just a bracket issue like it is in python.

I don’t use the automation editor but I suspect you may need to do it like this:

alias: light dimmer
trigger:
  - platform: state
    entity_id: binary_sensor.shellydimmer2_e8db84d6e0cb_channel_1_input
    from: 'off'
    to: 'on'
    id: 'up'
  - platform: state
    entity_id: binary_sensor.shellydimmer2_e8db84d6e0cb_channel_2_input
    from: 'off'
    to: 'on'
    id: 'down'
action:
  - choose:
      - conditions:
          - condition: trigger
            id: 'up'
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.shellydimmer2_3c6105e4a3c7
            data:
              brightness_pct: "{{ [state_attr('light.shellydimmer2_3c6105e4a3c7', 'brightness_pct')|int + 20, 100]|min }}"
          - service: light.turn_on
            target:
              entity_id: light.shellydimmer2_e8db84d6e0cb
            data:
              brightness_pct: "{{ [state_attr('light.shellydimmer2_e8db84d6e0cb', 'brightness_pct')|int + 20, 100]|min }}"
          - service: light.turn_on
            target:
              entity_id:  light.shellydimmer2_e8db84d6a003
            data:
              brightness_pct: "{{ [state_attr(' light.shellydimmer2_e8db84d6a003', 'brightness_pct')|int + 20, 100]|min }}"
      - conditions:
          - condition: trigger
            id: 'down'
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.shellydimmer2_3c6105e4a3c7
            data:
              brightness_pct: "{{ [state_attr('light.shellydimmer2_3c6105e4a3c7', 'brightness_pct')|int - 20, 0]|max }}"
          - service: light.turn_on
            target:
              entity_id: light.shellydimmer2_e8db84d6e0cb
            data:
              brightness_pct: "{{ [state_attr('light.shellydimmer2_e8db84d6e0cb', 'brightness_pct')|int - 20, 0]|max }}"
          - service: light.turn_on
            target:
              entity_id:  light.shellydimmer2_e8db84d6a003
            data:
              brightness_pct: "{{ [state_attr(' light.shellydimmer2_e8db84d6a003', 'brightness_pct')|int - 20, 0]|max }}"

Also to set the buttons in detached mode go to the ip address of dimmer 1 in your web browser and do this (this is a shelly 1 but you get the idea):

after checking the configuration and making sure it is valid,
i tested the code and it does turn on all 3 lights by clicking the switch.
however it only happens after 12 seconds holding switch 1, and after that i cannot make it more brighter or set it back to zero.

if i check the logbook, also only after 12 seconds holding the button, it pops up in the logbook.

Check Configuration / Logs for errors.

Go to Configuration / Automations, find the dimmer automation, look at the automation trace for the last time it triggered by clicking on the clock icon to the right of the automation name.

You did detach the switches didn’t you?

i checked the switches and for all 3 dimmers they are detached.

if i check the clock icon and this gives a really good insight.

the on version gets triggered once, the off one doesn’t get triggered at all.

is there a way to see live if a button is pressed ?
cause if i check the history of the entities as shown below, it displays that the 2nd channel input was never pressed.


and here is the added picture, missed it in the previous reply