Hi,
I have setup 3 automations to handle kitchen lighting throughout the day using a Treatlife smart dimmer switch flashed with Tasmota. I’ve successfully configured it as a light
but have a question. My configuration.yaml and automation.yaml are also attached.
- The brightness I have configured according to the time of day, however, when there is motion detected, the light goes to full brightness for a second, then settles on the appropriate brightness. So if we are walking around our kitchen, the light is always strobing, because it goes full brightness then dims soon after when our motion is detected.
Can someone suggest a fix for this?
Thanks for your time.
configuration:
light:
- platform: mqtt
name: "Kitchen Light"
state_topic: "stat/kitchen_light/POWER"
command_topic: "cmnd/kitchen_light/POWER"
availability_topic: "tele/kitchen_light/LWT"
brightness_state_topic: "stat/kitchen_light/RESULT"
brightness_command_topic: "cmnd/kitchen_light/Dimmer"
brightness_scale: 100
brightness_value_template: "{{ value_json.Dimmer }}"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: true
automations:
# Kitchen Light On Between Sunrise or Sunset and Lux < 140
- initial_state: true
alias: Kitchen Light On Between Sunrise or Sunset and Lux < 140
trigger:
platform: state
entity_id: binary_sensor.kitchen
to: 'on'
condition:
condition: and
conditions:
- condition: numeric_state
entity_id: sensor.kitchen
below: 140
- condition: or
conditions:
- condition: sun
after: sunrise
- condition: sun
before: sunset
action:
- service: mqtt.publish
data:
topic: cmnd/kitchen_light/POWER
payload: ON
- service: mqtt.publish
data:
topic: cmnd/kitchen_light/Dimmer
payload: 100
# Kitchen Light On Before Sunrise
- initial_state: true
alias: Kitchen Light On Before Sunrise
trigger:
platform: state
entity_id: binary_sensor.kitchen
to: 'on'
condition:
- condition: sun
before: sunrise
action:
- service: mqtt.publish
data:
topic: cmnd/kitchen_light/POWER
payload: ON
- service: mqtt.publish
data:
topic: cmnd/kitchen_light/Dimmer
payload: 25
# Kitchen Light On Between Sunset and Midnight
- initial_state: true
alias: Kitchen Light On Between Sunset and Midnight
trigger:
platform: state
entity_id: binary_sensor.kitchen
to: 'on'
condition:
- condition: sun
after: sunset
action:
- service: mqtt.publish
data:
topic: cmnd/kitchen_light/POWER
payload: ON
- service: mqtt.publish
data_template:
topic: cmnd/kitchen_light/Dimmer
payload_template: >-
{%- if now().hour >= 18 and now().hour < 20 -%}
100
{%- elif now().hour >= 20 and now().hour < 22 -%}
75
{%- elif now().hour >= 22 and now().hour < 24 -%}
50
{%- else -%}
25
{%- endif %}
- initial_state: true
alias: Turn off kitchen light 2 minutes after last movement
trigger:
platform: state
entity_id: binary_sensor.kitchen
to: 'off'
for:
minutes: 5
action:
- service: mqtt.publish
data:
topic: cmnd/kitchen_light/POWER
payload: OFF