So, i have connection between dynalite home automation devices (through hassio - mqtt - dynalite bridge Troy Kelly made for home assistant).
When it runs it will create following lights:
light.dy_livingroom_off
light.dy_livingroom_on
So, not one but two. It’s the way it works, not perfect, and far from finished. But it helps me big time.
So, if i switch on that light the dynalite-mqtt connection will report:
light.dy_livingroom_on goes ON
light.dy_livingroom_off goes OFF
When i turn that light off, opposite happens:
light.dy_livingroom_on goes OFF
light.dy_livingroom_off goes ON
To make life easier, i connected these two switches to one, called light.livingroom
Earlier, few people helped me to tie them up, and it works.
When dynalite reports:
light.dy_livingroom_on goes OFF
light.dy_livingroom_off goes ON
light.livingroom goes ON, and opposite happens.
Problem happens when i dimm these lights, since there is such cappability.
If i turn light off, it will go of.
If i raise brightness, phisically stuff works, light will go on at asked brightness but the switch in HA will stay off and icon will look off.
There should really be only 1 value_template, not two. They should both give you the same result, but you’ll have to experiment which one is working for you. But just enable one at a time!
It seems perhaps the state of light.dy_livingroom_on & _off is not updated when you set the brightness. What is the state of these entities right after you change the brightness level (so when a) light is off and b) you set a brightness level)? Are they updated properly?
They are all off, since I use rest command to set brightness, it is not possible through Dynalite component, it doesnt change any of them.
Can i make an script?
So i call script when i change brightness via rest command, but also to change brightness of light.livingroom which should than show that light is on ?
Huh, made it work, nor nice not looks good, but works.
Following recommendation for similar issue, i made dummy template light (not sure does it have to be template, since it does not even behave like light…) and two triggers:
To me it look i need to have only variable with intreger numeric value… not sure…
Two triggers are here to change input_boolean.dnevna value when i switch light on/off directly on Dynalite keypads.
alias: Dnevna dummy ON
trigger:
- entity_id: light.dy_dnevna_off
from: 'on'
platform: state
to: 'off'
condition: []
action:
- data:
entity_id: input_number.dnevna_dummy
value: 255
service: input_number.set_value
- id: '1569109156901'
alias: Dnevna dummy OFF
trigger:
- entity_id: light.dy_dnevna_on
from: 'on'
platform: state
to: 'off'
condition: []
action:
- data:
entity_id: input_number.dnevna_dummy
value: 0
service: input_number.set_value
Now, need to find a way to make this in some script which will use variables. I have 10 lights in house, plan some more, and don’t consider making 20+ triggers and 10+ dummy lights.
I have one other idea, but I’m not sure if it’ll work. Summarizing what I believe you are telling us:
For your template lights like ‘light.dnevna_spot’, the on and off state are reported as expected.
But when you set a brightness for your template light, the state does not get updated. So, when the light is off and you set the brightness, the physical light turns on at the correct brightness setting, but the state of your template light remains ‘off’.
First of all, the proper solution would be to fix this in the Dynalite component. So I would strongly recommend raising an issue on the Dynalite Github. The author of the component probably knows a lot more about the inner workings of the Dynalite stuff than we do here.
But for now, my idea was: after sending brightness, you also send a turn-on command. I’m hoping this will trigger an update for the state, so it gets reported properly.
Now that I typed this, I noticed you are also sending a brightness value of 255 when you are turning on the light. So if that really works, you can perhaps also use the light.turn_on command in the set_level part of your light template. That would be: