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

Light brightness trait not exposed to Google #413

Open
yschen5812 opened this issue Aug 26, 2023 · 8 comments
Open

Light brightness trait not exposed to Google #413

yschen5812 opened this issue Aug 26, 2023 · 8 comments

Comments

@yschen5812
Copy link

I noticed that the light device I created with 'brightness' does not show the dimmer trait in Google Home app. All I can do there is toggling the light. The color trait does work though if I check it in the device node. I can see the color temperature value being passed to node-red if I make any changes in the app. Can anyone take a look at the dimmer trait, thanks!

@FireWizard52
Copy link
Contributor

Hi, @yschen5812

I tested my configuration and didn't notice any issue.
Can you show a screenshot of your device configuration?

Regards

@Caprico85
Copy link
Collaborator

I can reproduce this.

image

The "Bettlampe" is connected using SmartNora and has the brigthness controls. The "Testlampe" is connected using node-red-contrib-google-smarthome and it does not have any brigthness controls.

{
        "type": "action.devices.types.LIGHT",
        "traits": [
          "action.devices.traits.Brightness",
          "action.devices.traits.OnOff"
        ],
        "name": {
          "defaultNames": [
            "Node-RED Light"
          ],
          "name": "Testlampe",
          "nicknames": []
        },
        "roomHint": "Wohnzimmer",
        "willReportState": true,
        "notificationSupportedByAgent": false,
        "attributes": {
          "commandOnlyBrightness": false,
          "commandOnlyOnOff": false,
          "queryOnlyOnOff": false
        },
        "deviceInfo": {
          "manufacturer": "Node-RED",
          "model": "nr-device-light-v1",
          "swVersion": "1.0",
          "hwVersion": "1.0"
        },
        "otherDeviceIds": [
          {
            "deviceId": "1bbb378b69bd4748"
          }
        ],
        "customData": {},
        "id": "1bbb378b69bd4748"
      }

This seems to happen when the device has not received any brightness values yet. After I injected a on and a brightness value, the brightness controls started working.

I see if I can automatically inject default values on restart. In the meantime, you can try an inject node to automatically inject values.

image

The second value is msg.payload.brightness. Set the injection time high enough to give it some time before sending.

@yschen5812
Copy link
Author

@FireWizard52 For my case I'm only using this node as a subscriber that syncs whatever dimmer value in Google Home to my node-red flow so I was not sending any command to the node. @Caprico85's simple workaround solves my problem. Thanks both of you for taking your time looking into this issue.

I'm good with closing this issue without a fix to make the injection happen on restart, but I'll leave it to you.

@Caprico85
Copy link
Collaborator

I'll leave it open until I (or somebody else) has implemented a fix to automatically inject default values at boot. Might also fix some other problems where devices behave "strange" after a restart.

@Caprico85 Caprico85 added the Fix planned Problem is found, fix is planned or in progress label Sep 21, 2023
@FireWizard52
Copy link
Contributor

Hello @Caprico85 and @yschen5812,

I now really understand, what your issue was.

  1. I use the manual controls in the Google Home app very seldom.
  2. I use Shelly Dimmer 2 and I have also the Shelly apps and the default wall switch available.
  3. I use also Domoticz.
  4. I have always the input of the device connected to other nodes and after a restart I always request the actual status of the lights, either from Domoticz or (preferred) directly from the Shelly device and inject the actual value into the device.

I would not be happy if @Caprico85 creates a fix in such a way that by default always an On/Off value and a brightness of 0 is injected and that that overrides my Inject of the actual status. My "default at boot" is always the actual status!

Thanks for your work on this application.

Regards

@yschen5812
Copy link
Author

I think I agree with @FireWizard52 to avoid injecting fixed default values on every restart. It seems like the only goal is to make Google Home to notice the "brightness" attribute of the device so it would be better to leave the values along if possible. If the only way to flag the attribute to Google Home is via setting values then maybe better to serve with values from previous state.

@ckhmer1
Copy link
Contributor

ckhmer1 commented Nov 16, 2023

Hi All,
it is possible to store to permanent storage the node status and inject the last status back on the node.
You need to add some login in input and output to the management node.

@Caprico85 Caprico85 removed the Fix planned Problem is found, fix is planned or in progress label Jan 7, 2024
@Caprico85
Copy link
Collaborator

On a second thought, I have to agree. Setting new default values on every restart is not good. Especially since every deployment in Node-RED means the service is restarted so you're constantly losing your states.

A better solution would probably be to query the HomeGraph for the current values and set only the states that are not already set. This would also provide an easier way to restore the current values on startup.

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

4 participants