Philips Hue bulb deconz brightness control. Why this doesn’t work?

I have this post on hassio.io but nobody responded so maybe here someone can help me please.

I have deconz installed on my raspbee and all is working good so far, buld (Hue and switches (xiaomi)recognized, I can on/off them. But when it comes to changing brightness in hue bulbs, I can do than on HA panel, on phoscan app, but in automation not, why? What am I doing wrong?
alias: Hallway light dark mode
trigger:
- at: ‘21:25’
platform: time
condition:
- condition: state
entity_id: light.hallway_light
state: ‘on’
action:
- data:
brightness: 15
entity_id: light.hallway_light
service: light.turn_on
Above code can change brightness from let say 80 to 15 on set time, so all good.
But next day when I turn it on with code:
alias: Hallway light bright mode
trigger:
- at: ‘15:25’
platform: time
condition:
- condition: state
entity_id: light.hallway_light
state: ‘on’
action:
- data:
brightness: 80
entity_id: light.hallway_light
service: light.turn_on
Above code only turn on bulb to random low brightness like 36, 27 etc.
Any suggestion please?

It is weird that you can turn on the lights with that automation since it has a condition that the light should already be on

Yeah agree, but even if I removed that condition lights behave the same. How to change properly those brightness? What code to use?

Have you checked the cookbooks? https://www.home-assistant.io/cookbook/

You could also enable debug for deconz and automations to see what happens in the logs

Yes I looked at cookbook, that’s is why I do not understand why it is not working ;-). First code when I dim light to 15 is working so why second code is not? Probably as you mentioned debug mode it is. I will try to enable them and post logs if I do now work out what is going on.

Thanks mate.

Just logs from hassio when event was triggered. It looks ok to myself but maybe you find some errors. I do not know how to access deconz logs from hassio or maybe other way?

   2018-06-14 15:36:24 INFO (MainThread) [homeassistant.components.automation] Executing Floor lamp on
    2018-06-14 15:36:24 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: name=Floor lamp on, message=has been triggered, domain=automation, entity_id=automation.floor_lamp_on>
    2018-06-14 15:36:24 INFO (MainThread) [homeassistant.helpers.script] Script Floor lamp on: Running script
    2018-06-14 15:36:24 INFO (MainThread) [homeassistant.helpers.script] Script Floor lamp on: Executing step call service
    2018-06-14 15:36:24 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.floor__lamp, service_call_id=1971691152-17>
    2018-06-14 15:36:24 INFO (MainThread) [homeassistant.components.automation] Executing Hallway light on
    2018-06-14 15:36:24 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: name=Hallway light on, message=has been triggered, domain=automation, entity_id=automation.hallway_light_on>
    2018-06-14 15:36:24 INFO (MainThread) [homeassistant.helpers.script] Script Hallway light on: Running script
    2018-06-14 15:36:24 INFO (MainThread) [homeassistant.helpers.script] Script Hallway light on: Executing step call service
    2018-06-14 15:36:24 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=homeassistant, service=turn_on, service_data=brightness=80, entity_id=light.hallway_light, service_call_id=1971691152-18>
    2018-06-14 15:36:24 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=brightness=80, entity_id=['light.hallway_light'], service_call_id=1971691152-19>
    2018-06-14 15:36:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1971691152-17>
    2018-06-14 15:36:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.floor__lamp, old_state=<state light.floor__lamp=off; friendly_name=Floor lamp, supported_features=41 @ 2018-06-13T22:34:57.380932+10:00>, new_state=<state light.floor__lamp=on; min_mireds=153, max_mireds=500, effect_list=['colorloop'], friendly_name=Floor lamp, supported_features=41 @ 2018-06-14T15:36:25.022757+10:00>>
    2018-06-14 15:36:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=group.all_lights, old_state=<state group.all_lights=off; entity_id=('light.corridor', 'light.floor__lamp', 'light.hallway_light', 'light.tv_light'), order=2, auto=True, friendly_name=all lights, hidden=True @ 2018-06-13T22:40:10.924170+10:00>, new_state=<state group.all_lights=on; entity_id=('light.corridor', 'light.floor__lamp', 'light.hallway_light', 'light.tv_light'), order=2, auto=True, friendly_name=all lights, hidden=True @ 2018-06-14T15:36:25.029776+10:00>>
    2018-06-14 15:36:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.floor_lamp_on, old_state=<state automation.floor_lamp_on=on; last_triggered=None, id=1523866137449, friendly_name=Floor lamp on @ 2018-06-13T17:30:04.812180+10:00>, new_state=<state automation.floor_lamp_on=on; last_triggered=2018-06-14T15:36:25.040937+10:00, id=1523866137449, friendly_name=Floor lamp on @ 2018-06-13T17:30:04.812180+10:00>>
    2018-06-14 15:36:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1971691152-19>
    2018-06-14 15:36:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.hallway_light, old_state=<state light.hallway_light=off; friendly_name=Hallway light, supported_features=41 @ 2018-06-13T22:40:10.911516+10:00>, new_state=<state light.hallway_light=on; brightness=80, min_mireds=153, max_mireds=500, effect_list=['colorloop'], friendly_name=Hallway light, supported_features=41 @ 2018-06-14T15:36:25.051775+10:00>>
    2018-06-14 15:36:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.corridor, old_state=<state light.corridor=off; min_mireds=153, max_mireds=500, friendly_name=Corridor, supported_features=63 @ 2018-06-13T22:40:10.918608+10:00>, new_state=<state light.corridor=on; min_mireds=153, max_mireds=500, brightness=127, color_temp=0, effect_list=['colorloop'], friendly_name=Corridor, supported_features=63 @ 2018-06-14T15:36:25.060118+10:00>>
    2018-06-14 15:36:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1971691152-18>
    2018-06-14 15:36:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.hallway_light_on, old_state=<state automation.hallway_light_on=on; last_triggered=None, id=1524735485567, friendly_name=Hallway light on @ 2018-06-13T17:30:04.840637+10:00>, new_state=<state automation.hallway_light_on=on; last_triggered=2018-06-14T15:36:25.072061+10:00, id=1524735485567, friendly_name=Hallway light on @ 2018-06-13T17:30:04.840637+10:00>>
    2018-06-14 15:36:26 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.power_2, old_state=<state sensor.power_2=0; current=None, voltage=None, unit_of_measurement=Watts, friendly_name=Floor lamp power consumption @ 2018-06-13T22:34:57.470579+10:00>, new_state=<state sensor.power_2=23; current=None, voltage=None, unit_of_measurement=Watts, friendly_name=Floor lamp power consumption @ 2018-06-14T15:36:26.536577+10:00>>
    2018-06-14 15:36:30 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sun.sun, old_state=<state sun.sun=above_horizon; next_dawn=2018-06-14T21:04:06+00:00, next_dusk=2018-06-14T07:35:50+00:00, next_midnight=2018-06-14T14:20:01+00:00, next_noon=2018-06-15T02:19:59+00:00, next_rising=2018-06-14T21:33:33+00:00, next_setting=2018-06-14T07:06:24+00:00, elevation=13.56, azimuth=314.6, friendly_name=Day/Night @ 2018-06-14T07:33:10.947405+10:00>, new_state=<state sun.sun=above_horizon; next_dawn=2018-06-14T21:04:06+00:00, next_dusk=2018-06-14T07:35:50+00:00, next_midnight=2018-06-14T14:20:01+00:00, next_noon=2018-06-15T02:19:59+00:00, next_rising=2018-06-14T21:33:33+00:00, next_setting=2018-06-14T07:06:24+00:00, elevation=13.42, azimuth=314.41, friendly_name=Day/Night @ 2018-06-14T07:33:10.947405+10:00>>

Enable debug for deconz so we can see if there are any signals coming to the component as well as what is sent out. Check deconz component documentation for help on enabling debug

Hi mate,

I finally worked out what was wrong hurray. I was wrong that’s it. I assumed that hue bulb takes number from 0-100 in setting up brightness. Oh boy what a stupid idea. It takes 0-255 (one byte) so when I set it up for 80 it is about 1/3 of the brightness so all good. Now when I put 200 to my code it is working as expected.
Thank you for helping me thinking mate, really appreciate that you turned out.

However I encountered another problem ;-). As I turned it off with brightness set to 20 (very dim) when I turned it of manually from hassio it is still at 20. I can turn it on by triggering automation and it is OK as it is at 200. But I want to use it with Alexa and she use hallway light to turn on/off not automation. So still kind of coding puzzle how to make it that default value of brightness for this bulb is let say 200 no last state?

Cheers
Martin

1 Like

You need some other kind of functionality to remember previous brightness I think

What do you mean? Can it be done with code or I need some hardware?

If you want to keep previous brightness, you need to do some kind of mechanic that stores it