Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brightness to 100% in sleep mode #216

Open
ansris opened this issue Feb 1, 2023 · 2 comments
Open

Brightness to 100% in sleep mode #216

ansris opened this issue Feb 1, 2023 · 2 comments

Comments

@ansris
Copy link

ansris commented Feb 1, 2023

as the title, in sleep mode my lamps turn into 100% brightness... but the circadian_lighting attribute is right at 1% as i set in the configuration...
why lamps will not take the 1%?
in non sleep mode it works perfectly...

@claytonjn
Copy link
Owner

I don't know. Can you provide some relevant logs? There's some guidance here: https://github.com/claytonjn/hass-circadian_lighting/wiki/Debugging

@marcusboon
Copy link

marcusboon commented May 6, 2023

Not the OP but I too have run into a similar issue.

I’ve set up a toggle button called input_boolean.sleep_mode and linked that as the sleep_entity

However when toggling the button, it makes my lights go to 100% brightness. Here are some logs that looked relevant?

2023-05-07 02:10:59.123 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall light.turn_on (c:01GZRX9AMAQH9SH3YY8RSB2ZEJ): entity_id=['light.nanoleaf_a19_8txh'], params=transition=1.0, brightness=2, color_temp=370, color_temp_kelvin=2702>
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/coap/connection.py", line 118, in _decrypt_response
return self.decrypt(response.payload)
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/coap/connection.py", line 95, in decrypt
dec_data = self.recv_ctx.decrypt(
File "/usr/local/lib/python3.10/site-packages/cryptography/hazmat/primitives/ciphers/aead.py", line 71, in decrypt
return aead._decrypt(
File "/usr/local/lib/python3.10/site-packages/cryptography/hazmat/backends/openssl/aead.py", line 260, in _decrypt
raise InvalidTag
cryptography.exceptions.InvalidTag
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 1867, in catch_exceptions
await coro_or_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1889, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 226, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 981, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 582, in async_handle_light_on_service
await light.async_turn_on(**filter_turn_on_params(light, params))
File "/usr/src/homeassistant/homeassistant/components/homekit_controller/light.py", line 163, in async_turn_on
await self.async_put_characteristics(characteristics)
File "/usr/src/homeassistant/homeassistant/components/homekit_controller/entity.py", line 89, in async_put_characteristics
return await self._accessory.put_characteristics(payload)
File "/usr/src/homeassistant/homeassistant/components/homekit_controller/connection.py", line 781, in put_characteristics
await self.pairing.put_characteristics(characteristics)
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/coap/pairing.py", line 203, in put_characteristics
response_status = await self.connection.write_characteristics(characteristics)
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/coap/connection.py", line 564, in write_characteristics
pdu_results = await self.enc_ctx.post_all(
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/coap/connection.py", line 197, in post_all
res_pdu = await self.post_bytes(req_pdu)
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/coap/connection.py", line 183, in post_bytes
return await self._decrypt_response(response)
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/coap/connection.py", line 162, in _decrypt_response
raise EncryptionError("Decryption of PDU POST response failed")
aiohomekit.exceptions.EncryptionError: Decryption of PDU POST response failed

My config looks like this:

# Circadian lighting
circadian_lighting:
  min_colortemp: 2700
  max_colortemp: 6500

switch:
  - platform: circadian_lighting
    name: "Adaptive Lighting"
    lights_ct:
      - light.nanoleaf_a19_4uk3
      - light.nanoleaf_a19_a6yj
      - light.nanoleaf_a19_8txh
    min_brightness: 1
    max_brightness: 100
    sleep_entity: input_boolean.sleep_mode
    sleep_state: "on"
    sleep_colortemp: 2700
    sleep_brightness: 1

Edit:
It seems like it errors when the sleep_brightness is set to 1. When I set it to something like 5, then it behaves as expected.

Edit 2:
Ok so it looks like the logs that I posted are a red herring and have nothing to do with this issue. However, another observation I've made (and it's not specifically for sleep mode) is that the issue is the brightness setting. More specifically, for whatever reason the actual brightness of the physical lights are brightness setting - 1 according to the lights e.g. if the reported brightness level is 100 in the circadian_lighting switch attribute, the light reports 99.
IMG_6456
vs
IMG_6457

so I'm guessing that when the brightness is set to 1 the actual brightness becomes 0 and that's why it freaks out and goes to 100% brightness

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants