home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.16k stars 31.13k forks source link

Wrong response in Alexa turning light to any color or brightness #35757

Closed demoniox12 closed 3 years ago

demoniox12 commented 4 years ago

The problem

Hello,

The problem it's when have 2 lights (1 with RGB and other without RGB) in a group and then i change a color or change brightness in this group with alexa voice command, works perfect, but the response of alexa it's "Something went wrong", no happend when turn on, or turn off, the response it's ok

Environment

Problem-relevant configuration.yaml

- platform: group
  name: Light
  entities:
    - light.888567262cf432c821de #not have rgb it's Tuya Light
    - light.light3 #have rgb

Traceback/Error logs

Additional information

1 Light it's Tuya Light Integrated (No RGB) The other it's Magic Home controller (With RGB)

All works perfect separated, but in group have the problem.

Thanks, Regards!

probot-home-assistant[bot] commented 4 years ago

Hey there @home-assistant/cloud, @ochlocracy, mind taking a look at this issue as its been labeled with a integration (alexa) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

demoniox12 commented 4 years ago

Hello,

Any new about that?

Thanks, Regards!

frenck commented 4 years ago

It has been just 4 days... please be patient. As we have currently a 1000 issues open and 250 pull requests, some things can take a while.

Thanks for understanding.

ochlocracy commented 4 years ago

Similar to #32293.

I investigated this previously and If I remember correctly... the problem is how the light color/temperature attributes can be reported differently hs_color, xy_color, rgb_color, white_value etc. across entities. I was unable to duplicate the problem with the devices I have, but will look into it again this weekend.

demoniox12 commented 4 years ago

Hello @ochlocracy!

You can replicate lights (fake) with this code

lights.yaml

- platform: group
  name: Light
  entities:
    - light.govee_strip
    - light.govee_strip2

- platform: template
  lights:
    govee_strip:
      friendly_name: "Fake Light 1"
      turn_on:
        service: input_boolean.turn_on
        entity_id: input_boolean.govee_strip
      turn_off:
        service: input_boolean.turn_off
        entity_id: input_boolean.govee_strip
      set_level:
        service: input_number.set_value
        data_template:
          value: "{{ brightness }}"
          entity_id: input_number.govee_strip
      temperature_template: "{{states('input_number.govee_temperature_input') | int}}"
      set_temperature:
        service: input_number.set_value
        data_template:
          value: "{{ color_temp }}"
          entity_id: input_number.govee_temperature_input
      color_template: "({{states('input_number.govee_h_input') | int}}, {{states('input_number.govee_s_input') | int}})"
      set_color:
        - service: input_number.set_value
          data_template:
            value: "{{ h }}"
            entity_id: input_number.govee_h_input
        - service: input_number.set_value
          data_template:
            value: "{{ s }}"
            entity_id: input_number.govee_s_input
    govee_strip2:
      friendly_name: "Fake Light 2"
      turn_on:
        service: input_boolean.turn_on
        entity_id: input_boolean.govee_strip2
      turn_off:
        service: input_boolean.turn_off
        entity_id: input_boolean.govee_strip2
      set_level:
        service: input_number.set_value
        data_template:
          value: "{{ brightness }}"
          entity_id: input_number.govee_strip2

configuration.yaml

input_boolean:
  govee_strip:
  govee_strip2:

input_number:
  govee_strip:
    min: 0
    max: 255
  govee_strip2:
    min: 0
    max: 255
  govee_temperature_input:
    min: 0
    max: 500
  govee_h_input:
    min: 0
    max: 360
  govee_s_input:
    min: 0
    max: 360

Thanks, Regards!

demoniox12 commented 4 years ago

Hello,

I checked the logs and this log response OK in alexa:

2020-05-26 16:00:56 DEBUG (MainThread) [hass_nabucasa.iot] Received message:
{'handler': 'alexa',
 'msgid': '047be7e8-621a-4e8c-9316-6ad8483cfa89',
 'payload': {'directive': {'endpoint': {'cookie': {},
                                        'endpointId': 'light#luces_pileta',
                                        'scope': {'token': 'x',
                                                  'type': 'BearerToken'}},
                           'header': {'correlationToken': 'x',
                                      'messageId': '316eff6d-42a0-4434-9c27-282bfc61c4e3',
                                      'name': 'SetColor',
                                      'namespace': 'Alexa.ColorController',
                                      'payloadVersion': '3'},
                           'payload': {'color': {'brightness': 1.0,
                                                 'hue': 0.0,
                                                 'saturation': 1.0}}}}}
2020-05-26 16:00:56 DEBUG (MainThread) [hass_nabucasa.iot] Publishing message:
{'msgid': '047be7e8-621a-4e8c-9316-6ad8483cfa89',
 'payload': {'context': {'properties': [{'name': 'powerState',
                                         'namespace': 'Alexa.PowerController',
                                         'timeOfSample': '2020-05-26T19:00:56.0Z',
                                         'uncertaintyInMilliseconds': 0,
                                         'value': 'ON'},
                                        {'name': 'brightness',
                                         'namespace': 'Alexa.BrightnessController',
                                         'timeOfSample': '2020-05-26T19:00:56.0Z',
                                         'uncertaintyInMilliseconds': 0,
                                         'value': 36},
                                        {'name': 'color',
                                         'namespace': 'Alexa.ColorController',
                                         'timeOfSample': '2020-05-26T19:00:56.0Z',
                                         'uncertaintyInMilliseconds': 0,
                                         'value': {'brightness': 0.3607843137254902,
                                                   'hue': 120.0,
                                                   'saturation': 1.0}},
                                        {'name': 'connectivity',
                                         'namespace': 'Alexa.EndpointHealth',
                                         'timeOfSample': '2020-05-26T19:00:56.0Z',
                                         'uncertaintyInMilliseconds': 0,
                                         'value': {'value': 'OK'}}]},
             'event': {'endpoint': {'cookie': {},
                                    'endpointId': 'light#luces_pileta',
                                    'scope': {'token': 'x',
                                              'type': 'BearerToken'}},
                       'header': {'correlationToken': 'x',
                                  'messageId': '20b1c54e-c210-41d3-8812-e0973fb815ce',
                                  'name': 'Response',
                                  'namespace': 'Alexa',
                                  'payloadVersion': '3'},
                       'payload': {}}}}

And this log, response wrong:

2020-05-26 16:00:18 DEBUG (MainThread) [hass_nabucasa.iot] Received message:
{'handler': 'alexa',
 'msgid': '312e015d-0b4f-406f-b8bc-b477c93d4fcf',
 'payload': {'directive': {'endpoint': {'cookie': {},
                                        'endpointId': 'light#foco1',
                                        'scope': {'token': 'x',
                                                  'type': 'BearerToken'}},
                           'header': {'correlationToken': 'x',
                                      'messageId': 'c1f6caeb-18e0-4068-b5e2-8517b9cd46c7',
                                      'name': 'SetColor',
                                      'namespace': 'Alexa.ColorController',
                                      'payloadVersion': '3'},
                           'payload': {'color': {'brightness': 1.0,
                                                 'hue': 0.0,
                                                 'saturation': 1.0}}}}}
2020-05-26 16:00:18 DEBUG (MainThread) [hass_nabucasa.iot] Publishing message:
{'msgid': '312e015d-0b4f-406f-b8bc-b477c93d4fcf',
 'payload': {'context': {'properties': [{'name': 'powerState',
                                         'namespace': 'Alexa.PowerController',
                                         'timeOfSample': '2020-05-26T19:00:18.0Z',
                                         'uncertaintyInMilliseconds': 0,
                                         'value': 'ON'},
                                        {'name': 'brightness',
                                         'namespace': 'Alexa.BrightnessController',
                                         'timeOfSample': '2020-05-26T19:00:18.0Z',
                                         'uncertaintyInMilliseconds': 0,
                                         'value': 392},
                                        {'name': 'color',
                                         'namespace': 'Alexa.ColorController',
                                         'timeOfSample': '2020-05-26T19:00:18.0Z',
                                         'uncertaintyInMilliseconds': 0,
                                         'value': {'brightness': 3.9215686274509802,
                                                   'hue': 0.0,
                                                   'saturation': 1.0}},
                                        {'name': 'colorTemperatureInKelvin',
                                         'namespace': 'Alexa.ColorTemperatureController',
                                         'timeOfSample': '2020-05-26T19:00:18.0Z',
                                         'uncertaintyInMilliseconds': 0,
                                         'value': 6060},
                                        {'name': 'connectivity',
                                         'namespace': 'Alexa.EndpointHealth',
                                         'timeOfSample': '2020-05-26T19:00:18.0Z',
                                         'uncertaintyInMilliseconds': 0,
                                         'value': {'value': 'OK'}}]},
             'event': {'endpoint': {'cookie': {},
                                    'endpointId': 'light#foco1',
                                    'scope': {'token': 'x',
                                              'type': 'BearerToken'}},
                       'header': {'correlationToken': 'x',
                                  'messageId': '6a5a8641-5e01-4229-8327-6e6d66c84e60',
                                  'name': 'Response',
                                  'namespace': 'Alexa',
                                  'payloadVersion': '3'},
                       'payload': {}}}}

The difference it's the petition with:

The value of 'hue': 0.0, in the wrong response

and

                                        {'name': 'colorTemperatureInKelvin',
                                         'namespace': 'Alexa.ColorTemperatureController',
                                         'timeOfSample': '2020-05-26T19:00:18.0Z',
                                         'uncertaintyInMilliseconds': 0,
                                         'value': 6060},
demoniox12 commented 4 years ago

Hello @ochlocracy!

How are you? you checked anything? can help me?

Thanks, Regards!

balloob commented 4 years ago

Please do not tag people.

demoniox12 commented 4 years ago

Hello,

I detected the problem, when brightness it's more high then 100 in Alexa.BrightnessController

Per example in that case i reported have value=392 and max value it's 100

And in Alexa.ColorController 'brightness': 3.9215686274509802

The max value it's 1.0

When i down brightness to 10% all response of alexa are OK, but when have more than 10% says Something wen't wrong.

Please someone can fix that? Thanks, Regards!

EDITED: I detected the problem it's TUYA light, the value of brightness it's 1000 not 255 max, this is the REAL problem

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.