By default HA is not responsible for dimmer brightness after turn on.
The dimmer starts with intensity used previously. If you quickly double-click on the momentary button, it will start with 100%.
If you don’t like this behaviour you can likely create an automation which will be triggered by turning light off and will set brightness of light to 100% without turning it on. I wrote “likely” because I haven’t checked it with a dimmer yet. However this method works with another shelly device: rgbw2.
BTW don’t ask how to do that in HA - I’m not familiar with HA automations. I’m using NodeRed for that.
If you simply want it to always turn on at 100%, use an automation in HA to detect when the light is switched on and then set the brightness. I do this for one of my light bulbs (not shelly):
- alias: Set Office Ceiling Light to 100% when switched on
trigger:
platform: state
entity_id: light.office_ceiling_light
to: 'on'
action:
service: light.turn_on
entity_id: light.office_ceiling_light
data:
brightness_pct: 100
color_temp: 250
Hello!! I have a SHELLY DUO that works for me with this code but I can’t change the temperature. The DUO has warm white and cool white. Can you help me?
Where did you read from that state_template is not supported?
In fact VSC marks it as unsupported. But the attribude exists in documentation. As well as state_topic which is accepted by VSC. Actually how could the HA be informed about on/off state otherwise?
I started over the weekend to move all my Shellies to MQTT. So far no issues, but I definitely have trouble to get my Dimmer to work. The Dimmer itself works fine since month with the integration.
What am I doing wrong? (I’m not a hack in Yaml, btw)
Cheers
mqtt:
switch: # including all other relays such as Shelly25 and Shelly1
light:
- unique_id: mq_kitchen_light_dimmer
name: mq Kitchen Light Dimmer
schema: template
state_topic: "shellies/shellydimmer-<my_ID>/light/0/status"
state_template: '{% if value_json.ison %} on {% else %} off {% endif %}'
command_topic: "shellies/shellydimmer-<my_ID>/light/0/set"
command_on_template: '{"turn": "on"{% if brightness is defined %}, "brightness": {{(brightness | float * 0.3882 + 1) | round(0)}}{% endif %}}'
command_off_template: '{"turn": "off"}'
brightness_template: '{{ value_json.brightness | float | multiply(2.55) | round(0) }}'
I am using the integration for the dimmer and for an RGBWW. However the response time on my shelly25s and Shelly1s was way too long to use them in automations (eg. Switch a Shelly and turn on a light on a smart plug as well). Acc. my understanding the integration is polling (not adjustable) and mqtt is using push. At this point there is no other way as using mqtt for the relays, but in general I would like to have them setup all in the same way if possible.
I can see a few differences. But Cannot say those are crucial
state_template and brightness_template are enclosed with double quotes, while you are using single quotes.
You are using unique_id. Check others entities declaration or logs. Maybe you did copy&paste error, having 2 entities with the same identifier?
Optimistic setting (you are using default which equals true). For devices responding immediately false is better IMO. Also maybe there is a glitch in implementation. Worth to check.
Other than that it looks pretty the same (or differences are not important).
3 keywords: stability, reliability, and transparency.
MQTT is (potentially or not) way better in all those aspects compared to native integration.
Thanks a lot … I will try that and give feedback. One question:
How your topics are linking into the correct device or in other words, how does mqtt know what Shelly ID to “talk” to?
- name: "My Not Working Dimmer"
schema: template
state_topic: "shellies/shellydimmer-3C6105E42C4D/light/0/status"
availability_topic: "shellies/shellydimmer-3C6105E42C4D/online"
command_topic: "shellies/shellydimmer-3C6105E42C4D/light/0/set"
state_template: "{% if value_json.ison %} on {% else %} off {% endif %}"
command_on_template: '{"turn": "on"{% if brightness is defined %}, "brightness": {{(brightness | float * 0.3882 + 1) | round(0)}}{% endif %}}'
command_off_template: '{"turn": "off"}'
brightness_template: "{{ (value_json.brightness | float * 2.55) | round(0) }}"
payload_available: "true"
payload_not_available: "false"
qos: 1
retain: false
optimistic: false
I have changed the name, to make sure to have a new entity (shouldn’t matter but just in case). Still not working. Communication seems to work, so I wouldn’t expect a settings issue?
According to the integration page, it’s local push, not poll.
Can you elaborate? I don’t have any stability or reliability problems with the integration (not entirely sure what you mean by transparency), and I believe that in most cases adding another layer would make these worse, not better.