Zigbee lamp turn on event

I want to change the brightness of my lamps depending on the time. My goal is to avoid the use of smart light switches. Is there a way where the light can generate an event in HA when it receives electricity, and HA would in turn set the brightness to the desired level.

Or is there another alternative method that you would recommend?

Presumably you have zigbee bulbs in your lamps?

If so, their state will be reflected in HA when they are powered on - going from unknown to either on or off depending on their power on settings. That can be used as a tgrigger to set brightness.

You should bear in mind that they will be marked unavailable if the are powered off for more than about two hours. Better to leave them powered on permanently and use HA to turn them on and off and change their brightness.

Also, if you keep powering them off your zigbee network will be weakened substantially.

Hi,

Like @szebenisz said, an automation is one way to achieve this. This is my automation to set a default brightness everytime these bulbs are turned on.

alias: "lights: set default brightness"
description: set the default brightness of zigbee bulbs
trigger:
  - platform: state
    entity_id: light.tv_room_lamp
    id: tv_room
    to: "on"
  - platform: state
    entity_id:
      - light.hue_bulb_01
    id: nicks_lamp
    to: "on"
  - platform: device
    type: turned_on
    device_id: c5d2d22a0c1311eb974feba13a3cf2ca
    entity_id: light.ikea_bulb_01
    domain: light
    id: spencer
  - platform: state
    entity_id:
      - light.hue_bulb_02
    id: petas_lamp
    to: "on"
  - platform: device
    type: turned_on
    device_id: 519166f6b1cce25dc8f229282a33d227
    entity_id: light.ikea_bulb_02
    domain: light
    id: bed4
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: tv_room
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 40
            target:
              entity_id: light.tv_room_lamp
      - conditions:
          - condition: trigger
            id: nicks_lamp
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 35
            target:
              entity_id:
                - light.hue_bulb_01
      - conditions:
          - condition: trigger
            id: petas_lamp
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 35
            target:
              entity_id:
                - light.hue_bulb_02
      - conditions:
          - condition: trigger
            id: spencer
        sequence:
          - service: light.turn_on
            target:
              device_id: c5d2d22a0c1311eb974feba13a3cf2ca
            data:
              brightness_pct: 20
      - conditions:
          - condition: trigger
            id: bed4
        sequence:
          - service: light.turn_on
            target:
              device_id: 519166f6b1cce25dc8f229282a33d227
            data:
              brightness_pct: 20
    default: []
mode: parallel
max: 6

Thanks, for me the event only fires when the device is turned on using another event such as an automation via a smart switch or turning it on via software.

My goal is that my house still works even if my server is not running and the lights would turn on an off via a normal switch. So they would either get power or not get power. When the light receives power, unfortunately this event is not triggered for me. (I would be setting the brightness/color depending on the time of day)