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

Dimmer Lights: Can't toggle light on if no previous brightness. FW & CC issue #212

Closed
3 tasks done
Stupco opened this issue Sep 14, 2021 · 6 comments
Closed
3 tasks done
Labels
bug Something isn't working done The underlying issue has been fixed
Milestone

Comments

@Stupco
Copy link

Stupco commented Sep 14, 2021

Perform all steps below and tick them with [x]

  • Check the related part of the Documentation
  • Update openHASP to the latest version
  • Reproduce the issue and describe all steps

Describe the bug

IF turning on light for first time since restart, HA will not turn on light on as there was no previous brightness known.

Occurs after resetting both HA and Plate.

To Reproduce

Debug log

HA Log:

2021-08-31 16:01:46 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'mappingproxy object' has no attribute 'brightness' when rendering '{{ states.light.b3_lights.attributes.brightness }}'

Telnet Log:

[08:03:13.770][96656/99960  3][35304/35520  1] MQTT RCV: hasp/b3/command/output12 = {"state": true, "brightness": 0}
[08:03:13.776][96656/98308  1][35304/35520  1] GPIO: Dimmer => ef 02 00 ed
[08:03:13.781][95104/96376  1][35304/35520  1] MSGR: GROUP 1 value 0 (0-255)
[08:03:13.791][93552/94636  1][35304/35520  1] MQTT PUB: output12 => {"state":"off","brightness":0}

### Expected behavior
Light can turn on with no previous brightness state with simple toggle command, recommend maybe setting brightness value to 255 if no previous state found?

Would still prefer to have previous brightness passed when known as provided in https://github.com/HASwitchPlate/openHASP/commit/75c87665bc29c84f49bca9e7d5f3a0de085e5b2b

### Custom Component
Linked to https://github.com/HASwitchPlate/openHASP-custom-component/issues/71
@Stupco Stupco added the bug Something isn't working label Sep 14, 2021
@Stupco Stupco changed the title Cannot turn on Dimmer if no previous brightness Dimmer Lights: Can't toggle light on if no previous brightness. FW & CC issue Sep 14, 2021
fvanroie added a commit that referenced this issue Sep 17, 2021
@fvanroie
Copy link
Collaborator

@Stupco Can you test this again now?

@Stupco
Copy link
Author

Stupco commented Sep 21, 2021

Seems to be working much better! But I don't think it exposes the Brightness using this method.

Found the following in the Home Assistant logs to show that, even though I've turned it off/on and set brightness values too, it is not being exposed when toggling (note: this might be a CC issue):
2021-09-21 11:12:50 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'mappingproxy object' has no attribute 'brightness' when rendering '{{ states.light.b3_lights.attributes.brightness }}'

@nagyrobi
Copy link
Collaborator

That's by design in HA. A light when turned off, doesn's expose such attributes.

@Stupco
Copy link
Author

Stupco commented Sep 21, 2021

That's by design in HA. A light when turned off, doesn's expose such attributes.

I know this was already mentioned before, just curious as this error does not show up for my Zigbee lights? I know it's a different protocol, just as example.

Anyway, noting that the HA Error Log does not affect actual functionality as the Brightness value is not necessary when the light is off, we could likely close this issue as it seems to be functioning well?

@fvanroie
Copy link
Collaborator

IMHO Since you can change the brightness when the light is off, it's useful to also report the brightness when the light is off.
openHASP can also be used by other automation systems like OpenHAB or NodeRED that do not have this quirk.

It should be possible for HA to treat this attribute as optional instead... but that's another discussion.
BTW, it is a warning and not an error, so everything should be fine. Just ignore that annoying message :)

@fvanroie fvanroie added the done The underlying issue has been fixed label Sep 22, 2021
@fvanroie fvanroie added this to the 0.6.x milestone Sep 22, 2021
@fvanroie
Copy link
Collaborator

I'm closing this issue as it is working as expected.
In case of issues, feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working done The underlying issue has been fixed
Projects
None yet
Development

No branches or pull requests

3 participants