rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.81k stars 543 forks source link

Mirabella Genio Wi-Fi Nebula & Star Projector uses an unsupported ("manual") color mode #699

Open joshuaspence opened 2 years ago

joshuaspence commented 2 years ago

The problem

I have the Mirabella Genio Wi-Fi Nebula & Star Projector but it doesn't quite work with localtuya. The problem seems to be https://github.com/rospogrigio/localtuya/blob/master/custom_components/localtuya/light.py#L351 and https://github.com/rospogrigio/localtuya/blob/master/custom_components/localtuya/light.py#L378. This light seems to be different than other Tuya lights in how color_mode is handled. It doesn't seem to have a white or color mode but rather has manual, music and scene.

Environment

Steps to reproduce

  1. Turn on the light via Home Assistant.
  2. Change the colour or brightness to any value.
  3. Observe that the light turns off.

Configuration configuration.yaml or config_flow

  - host: 'REDACTED'
    device_id: 'REDACTED'
    local_key: 'REDACTED'
    friendly_name: 'Bedroom 1 Ceiling Projector'
    entities:
      - platform: 'switch'
        friendly_name: 'Bedroom 1 Ceiling Projector'
        id: 20

      - platform: 'light'
        friendly_name: 'Bedroom 1 Ceiling Projector Light'
        id: 52
        color: 24
        color_mode: 51

      - platform: 'light'
        friendly_name: 'Bedroom 1 Ceiling Projector Laser'
        id: 53
        brightness: 54
        brightness_lower: 10

      - platform: 'light'
        friendly_name: 'Bedroom 1 Ceiling Projector Motor'
        id: 60
        brightness: 62
        brightness_lower: 0
        brightness_upper: 100

DP dump

{ dps:
   { '20': true,
     '24': '003c000003e8',
     '26': 0,
     '51': 'manual',
     '52': true,
     '53': true,
     '54': 1000,
     '60': true,
     '62': 100 } }

Provide Home Assistant taceback/logs

2022-01-11 11:03:21 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Sending command set (device type: type_0a)
2022-01-11 11:03:21 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Send payload: b'{"devId":"bf9d82cb56aab14569usnf","uid":"bf9d82cb56aab14569usnf","t":"1641859401","dps":{"24":"016803e803e8","51":"colour"}}'
2022-01-11 11:03:21 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Waiting for sequence number 6
2022-01-11 11:03:21 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Dispatching message TuyaMessage(seqno=6, cmd=7, retcode=0, payload=b'', crc=3631656780)
2022-01-11 11:03:21 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Dispatching sequence number 6
2022-01-11 11:03:21 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Decrypted payload: {}
2022-01-11 11:03:21 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Dispatching message TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00\xa6\\\x00\x00\x00\x01\xcf}z\x03P\x0b\xc7\xc44K&\xaf\x08!7\xe9Bv\xde//\xe6\xea1\x99EliV\xa3$\x0e9\xf3\xaf\xf3\x00Z[\xd7\xad#\x8c\xba\x1f\xf3Y\xb5', crc=3404962886)
2022-01-11 11:03:21 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Got status update
2022-01-11 11:03:21 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Decrypted payload: {"dps":{"24":"016803e803e8"},"t":1641859400}
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...mc1] Sending command heartbeat (device type: type_0a)
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...mc1] Send payload: b'{}'
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...mc1] Waiting for sequence number -100
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...mc1] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...mc1] Got heartbeat response
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf2...mc1] Decrypted payload: {}
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf4...oj1] Sending command heartbeat (device type: type_0a)
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf4...oj1] Send payload: b'{}'
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf4...oj1] Waiting for sequence number -100
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf5...42n] Sending command heartbeat (device type: type_0a)
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf5...42n] Send payload: b'{}'
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf5...42n] Waiting for sequence number -100
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Sending command heartbeat (device type: type_0a)
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Send payload: b'{}'
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Waiting for sequence number -100
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Got heartbeat response
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf9...snf] Decrypted payload: {}
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf5...42n] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf5...42n] Got heartbeat response
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf5...42n] Decrypted payload: {}
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf4...oj1] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf4...oj1] Got heartbeat response
2022-01-11 11:03:24 DEBUG (MainThread) [custom_components.localtuya.pytuya] [bf4...oj1] Decrypted payload: {}

Additional information

It's obviously not the proper solution, but I commented out https://github.com/rospogrigio/localtuya/blob/master/custom_components/localtuya/light.py#L351 and https://github.com/rospogrigio/localtuya/blob/master/custom_components/localtuya/light.py#L378 and it fixed my problem.

Lethal83 commented 2 years ago

Hi @joshuaspence were you able to toggle the laser independantly of the light?

joshuaspence commented 2 years ago

@Lethal83 Yes, with the configuration posted above I can turn the laser on/off independently. The switch entity must be turned on though, but this doesn't directly control the light.

joshuaspence commented 2 years ago

@rospogrigio Would you accept a PR to make MODE_COLOR configurable? If not, do you have an alternative suggestion?

pergolafabio commented 1 year ago

i have the same issues, i have the laser setup as a seperate light, works good The nebula itself is also a different light, works with HA but it turns off, and cant turn it on anymore... i need to use the smartlife app again to make it work....

Is there already some progress on this?

seems my DP are different tough, i use this setup: https://github.com/rospogrigio/localtuya/issues/297#issuecomment-995222641

thnx