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

Add support of RGB lights #120

Merged
merged 12 commits into from
Oct 28, 2020
Merged

Conversation

ultratoto14
Copy link
Collaborator

@ultratoto14 ultratoto14 commented Oct 26, 2020

This PR contains:

  • RGB Support
  • Brightness consistency between color and white modes
  • Optional color temperature range
  • Use of single call to update multiple data points, reducing latency

I didn't add an option to configure the color_temp upper value as for all the bulbs i have, they are always in sync with the brightness max values.

Configuration is explained in the README

      - platform: light
        friendly_name: Device Light
        id: 4 # Usually 1 or 20
        color_mode: 21 # Optional, usually 2 or 21, default: "none"
        brightness: 22 # Optional, usually 3 or 22, default: "none"
        color_temp: 23 # Optional, usually 4 or 23, default: "none"
        color: 24 # Optional, usually 5 (RGB_HSV) or 24(HSV), default: "none"
        brightness_lower: 29 # Optional, usually 0 or 29, default: 29
        # for brightness_upper from our current knowledge, 
        # bulb using id (1-5) should be set to 255, bulb using id (1-5) should be set to 1000. 
        brightness_upper: 1000 # Optional, usually 255 or 1000, default: 1000
        color_temp_min_kelvin: 2700 # Optional, default: 2700
        color_temp_max_kelvin: 6500 # Optional, default: 6500

@SmartM-ui
Copy link

SmartM-ui commented Oct 26, 2020

Hi @ultratoto14,
i just installed your version and i am happy with the result!!!
Both color management and color temperature work correctly, respecting the slider of the SmartLife app.
Even the update of the consumption of the sockets is carried out in real time, as I see on the SmartLife app!

Small note:
The only way to switch from color to white is to press the color temperature slider.
This returns the bulb to the white point, but on the Home Assistant color palette it remains set to the previous color.
If you close and then reopen the color palette, the color picker rightly points to white.

Thanks again for developing this component.

@ultratoto14
Copy link
Collaborator Author

@SmartM-ui i need to force the color returned to white if i want the color picker to be updated. Using None only change the bulb icon. Can you check on your side ?

@SmartM-ui
Copy link

@SmartM-ui i need to force the color returned to white if i want the color picker to be updated. Using None only change the bulb icon. Can you check on your side ?

I'll try it now, thanks!

@SmartM-ui
Copy link

SmartM-ui commented Oct 26, 2020

@ultratoto14
Works perfectly. Great!

As soon as the color temperature slider is moved, the pointer returns to white :-)

Can I ask you how I can configure, through the yaml and not the flow, the colors and the color temperature so I carry it back for all my bulbs and not just for the one I am trying?

My current yaml is as follows:
entities:
- platform: light
friendly_name: LocalTuya Entrance Lamp
id: 1
brightness: 3
color_temp: 4
# brightness_lower: 10
# brightness_upper: 1000

@ultratoto14
Copy link
Collaborator Author

You can look in the README i updated it README

@SmartM-ui
Copy link

You can look in the README i updated it README

Thanks

@ultratoto14
Copy link
Collaborator Author

@SmartM-ui do you have a list of the available dps for your bulb ?

@SmartM-ui
Copy link

SmartM-ui commented Oct 26, 2020

@SmartM-ui do you have a list of the available dps for your bulb ?

I have two models of light bulbs, on one I was able to configure it, on these others they are unavailable.

DPS

The bulb, via yaml and without color, was configured like this and worked:

  • platform: light
    friendly_name: LocalTuya Entrance Lamp
    id: 1
    brightness: 3
    color_temp: 4

@SmartM-ui
Copy link

@ultratoto14

ho provato così, ma risulta unavailable

20201026_175821

@SmartM-ui
Copy link

This is the error reported when setting debug the log localtuya.

@postlund , is it the same problem that had arisen in the past?

Exception in _update_handler when dispatching 'localtuya_0xxxxxxxxxxx0': ({'1': False, '2': 'colour', '3': 181, '4': 83, '5': '5b2c00001dff5b', '6': '00ff0000000000', '7': 'ffff500100ff00', '8': 'ffff8003ff000000ff000000ff000000000000000000', '9': 'ffff5001ff0000', '10': 'ffff0505ff000000ff00ffff00ff00ff0000ff000000'},) Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 240, in _update_handler self.status_updated() File "/config/custom_components/localtuya/light.py", line 256, in status_updated hue, sat, value = [int(value, 16) for value in textwrap.wrap(color, 4)] ValueError: too many values to unpack (expected 3)

@ultratoto14
Copy link
Collaborator Author

For the one in snapshot, you should set the max brightness to 255. Usually when DPs starts at 1 => 255, when 20 => 1000.

Also make sur no other integration/application is accessing the bulb. This bulbs only support one connection at a time.

@SmartM-ui
Copy link

SmartM-ui commented Oct 26, 2020

For the one in snapshot, you should set the max brightness to 255. Usually when DPs starts at 1 => 255, when 20 => 1000.

Also make sur no other integration/application is accessing the bulb. This bulbs only support one connection at a time.

I don't think it depends on this, the problem arises when I try to manage the colors:

(NOT WORK)
entities:
- platform: light
friendly_name: LocalTuya Entrance Lamp
id: 1
brightness: 3
color_temp: 4
color_mode: 2
color: 5

(Same bulb works without color management)
entities:
- platform: light
friendly_name: LocalTuya Entrance Lamp
id: 1
brightness: 3
color_temp: 4

This is the error:
Exception in _update_handler when dispatching 'localtuya_0xxx0': ({'1': True, '2': 'colour', '3': 181, '4': 83, '5': '301700001dff30', '6': '00ff0000000000', '7': 'ffff500100ff00', '8': 'ffff8003ff000000ff000000ff000000000000000000', '9': 'ffff5001ff0000', '10': 'ffff0505ff000000ff00ffff00ff00ff0000ff000000'},) Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 240, in _update_handler self.status_updated() File "/config/custom_components/localtuya/light.py", line 256, in status_updated hue, sat, value = [int(value, 16) for value in textwrap.wrap(color, 4)] ValueError: too many values to unpack (expected 3)

Exception in _update_handler when dispatching 'localtuya_0xxx0': ({'1': False, '2': 'colour', '3': 181, '4': 83, '5': '301700001dff30', '6': '00ff0000000000', '7': 'ffff500100ff00', '8': 'ffff8003ff000000ff000000ff000000000000000000', '9': 'ffff5001ff0000', '10': 'ffff0505ff000000ff00ffff00ff00ff0000ff000000'},) Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 240, in _update_handler self.status_updated() File "/config/custom_components/localtuya/light.py", line 256, in status_updated hue, sat, value = [int(value, 16) for value in textwrap.wrap(color, 4)] ValueError: too many values to unpack (expected 3)

All the lamps that instead use these DPS work correctly:
- platform: light
friendly_name: Studio LocalTuya chandelier
id: 20
brightness: 22
color_temp: 23
color_mode: 21
color: 24
brightness_lower: 10
brightness_upper: 1000

@ultratoto14
Copy link
Collaborator Author

ultratoto14 commented Oct 26, 2020

@SmartM-ui as mentioned, the one that is not working is using a 255 range and so another way of handling the color.
Please set and check with :

id: 1
brightness: 3
color_temp: 4
color_mode: 2
color: 5
brightness_upper: 255

@SmartM-ui
Copy link

@SmartM-ui as mentioned, the one that is not working is using a 255 range and so another way of handling the color.
Please set and check with :

id: 1
brightness: 3
color_temp: 4
color_mode: 2
color: 5
brightness_upper: 255

I was doing some tests, but the light bulb went haywire. I try to see if localkey has changed.
See you later

@ultratoto14
Copy link
Collaborator Author

@SmartM-ui just added a different way to detect color mode. Not linked to brightness setting anymore.

But brightness and color_temp max value are linked. You can use tuya app to set color_temp/brightness to max/min and check the values of the corresponding DP using tuyadebug.

)
await self._device.set_dp(color, self._config.get(CONF_COLOR))
if self._is_rgb_mode is None:
self._is_rgb_mode = len(self.dps_conf(CONF_COLOR)) > 12
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I understanding it right that _is_rgb_mode really represents if the bulb supports RGB or not and not current mode of the lamp (which I'm doing something similar for with white color)? It's a bit confusing to have two properties named the opposite of each other and not really representing the same thing. Can we consolidate into one variable?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it also seems strange to assign this variable here, would make more sense to set in status_updated in case the value change. I would however never expect it to do so, so it could possibly be assigned directly in the constructor.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is representing the color coding, RGB_HSV if True, HSV4Bytes if False

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set it originally in status_updated. It seems that it's not called when HA is restarted until something changed. If we have a bulb already On in white and just change color, the coding is not yet defined.

I may try to set it in the constructor but need to ensure data is already there. The problem with bulbs is that they can be powered off and not accessible when the constructor is called. In that case, we do not have the necessary data to update the value.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, i extracted the check in a method without using variable.

if self._is_rgb_mode is None:
self._is_rgb_mode = len(self.dps_conf(CONF_COLOR)) > 12

if self._is_rgb_mode:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can extract this part to a method and re-use it in async_turn_on as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, i extracted the check in a method without using variable.

@SmartM-ui
Copy link

@SmartM-ui just added a different way to detect color mode. Not linked to brightness setting anymore.

But brightness and color_temp max value are linked. You can use tuya app to set color_temp/brightness to max/min and check the values of the corresponding DP using tuyadebug.

Hi @ultratoto14 ,
I think the various tests have sent Home Assistant haywire.
I had to remove the entities from localtuya and restart the Raspberry host. I recreated the various entities through the yaml file and now all the available bulbs are again.

Now the lamps that were previously unavailable also work, using the code:
entities:
- platform: light
friendly_name: LocalTuya Entrance Lamp
id: 1
brightness: 3
color_temp: 4
color_mode: 2
color: 5

for these lamps the brightness slider did not reflect the true value of the bulb and I added, as proposed by you
code: brightness_upper: 255

I noticed that the minimum of the localtuya slider corresponds to 3% of the SmartLife app slider and this sometimes creates some conflict if you use both apps. I tried to set: brightness_lower: 1 but this change makes the bulb unavailable when the brightness is turned down completely

Do I try to update to the latest version released?
What changes should I check for?

@ultratoto14
Copy link
Collaborator Author

Hi @SmartM-ui, thanks for testing, happy that it finally worked.

We already know that some of the bulbs are not able to handle more than one connection at a time, meaning that even using HA and the tuya app at the same time is not possible.
We should try to find a procedure to configure the bulbs within a user friendly way.

I mean, if we use the config flow way, i would recommend first to switch on the light, in white mode, with the brightness at 100%. As the config flow show the values of the DPs, it would be easy to read the value and set up the max brightness value.

If your bulb supports two connections, you can also put localtuya/pytuya in debug mode

logger:
  default: error
  logs:
    #custom_components.localtuya: debug
    custom_components.localtuya.pytuya: debug

, and look for decrypted messages from your bulb. Change the values from the tuya app and read the ranges, adapt your configuration. Using this way i found that tuya app min value is 25 from one of my bulb and 10 for another one

The best would be to have the config flow showing in real time the values of the DPs but it is far from what i can do.

I don't know on which version you are testing, but after the afd938d commit, it's the same behavior, just refactoring. The color coding is deduced from the length of the color data point. Before that, it was based on the brightness range.

@SmartM-ui
Copy link

Hi @SmartM-ui, thanks for testing, happy that it finally worked.

We already know that some of the bulbs are not able to handle more than one connection at a time, meaning that even using HA and the tuya app at the same time is not possible.
We should try to find a procedure to configure the bulbs within a user friendly way.

I mean, if we use the config flow way, i would recommend first to switch on the light, in white mode, with the brightness at 100%. As the config flow show the values of the DPs, it would be easy to read the value and set up the max brightness value.

If your bulb supports two connections, you can also put localtuya/pytuya in debug mode

logger:
  default: error
  logs:
    #custom_components.localtuya: debug
    custom_components.localtuya.pytuya: debug

, and look for decrypted messages from your bulb. Change the values from the tuya app and read the ranges, adapt your configuration. Using this way i found that tuya app min value is 25 from one of my bulb and 10 for another one

The best would be to have the config flow showing in real time the values of the DPs but it is far from what i can do.

I don't know on which version you are testing, but after the afd938d commit, it's the same behavior, just refactoring. The color coding is deduced from the length of the color data point. Before that, it was based on the brightness range.

@ultratoto14
Good morning!
Thanks you for giving me the opportunity to use tuya devices locally!
The 7 bulbs, from 3 different brands, that I tested and configured all support double connection.

I try to enter the code localtuya / pytuya in debug mode so as to discover the minimum and maximum level supported by the bulbs. Definitely 3 of my bulbs are set with 10/1000 level

I think I have version 29f0af7, you solved the problem of the pointer in the color palette when switching from color to white.
How do I check the version I have installed?
However, I also try the latest version so I can help verify that it works correctly before being published.

PS having manually saved the localtuya folder in the custom_components, version 2.0.1 is still installed in HACS and I still have this problem in the logs. Can I do something to fix or still need to fix the problem on the manifest.json?

Logger: custom_components.hacs.repository.integration.rospogrigio.localtuya
Source: custom_components / hacs / repositories / integration.py: 88
Integration: HACS (documentation, issues)
First occurred: 00:58:25 (18 occurrences)
Last logged: 09:28:25
No file found 'manifest.json'

@ultratoto14
Copy link
Collaborator Author

Hi @SmartM-ui, for the code, i just clone the repository, change the branch, create a symlink of the localtuya directory in the custom_component directory, and voila ! I do not use HACS for the moment, and then you can check on which version you are by just doing a git log command.

@SmartM-ui
Copy link

SmartM-ui commented Oct 27, 2020

Hey @ultratoto14
I followed your advice and through the slider from the SmartLife app and the pytuya debugging I was able to verify that some of my bulbs must be set with min = 25 and max = 255
Now I have no more problems on the minimum value of the bulbs and no conflicts :-)

On this occasion I have installed your latest version (72272b4) and it works correctly.

Good job!

@ultratoto14
Copy link
Collaborator Author

@postlund , @rospogrigio this is ready for review and merge if review is ok.

@postlund
Copy link
Collaborator

I can review again later tonight 👍 Great job!

@SmartM-ui
Copy link

@ultratoto14
Hi, I found these errors in the log, even though the bulbs and sockets are still reachable and working:

Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/init.py:206
Integration: LocalTuya integration (documentation, issues)
First occurred: 14:49:13 (16 occurrences)
Last logged: 15:24:06

[65xxxc5] Heartbeat failed (), disconnecting
[bfxxxzr] Heartbeat failed (), disconnecting
[04xxx40] Heartbeat failed (), disconnecting
[04xxx1d] Heartbeat failed (), disconnecting
[65xxx9d] Heartbeat failed (), disconnecting

Traceback (most recent call last):
File "/config/custom_components/localtuya/pytuya/init.py", line 346, in heartbeat_loop
await self.heartbeat()
File "/config/custom_components/localtuya/pytuya/init.py", line 435, in heartbeat
return await self.exchange(HEARTBEAT)
File "/config/custom_components/localtuya/pytuya/init.py", line 407, in exchange
msg = await self.dispatcher.wait_for(seqno)
File "/config/custom_components/localtuya/pytuya/init.py", line 206, in wait_for
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
File "/usr/local/lib/python3.8/asyncio/tasks.py", line 490, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

@ultratoto14
Copy link
Collaborator Author

@SmartM-ui i didn't change the way the connection is used, i only interpreted the data and set the values.
Can you check on your side what is the level of wifi signal ?

@postlund
Copy link
Collaborator

@SmartM-ui Heartbeats are sent every 20s to keep the connection alive. Would be great if you provided a complete log when this happens.

@SmartM-ui
Copy link

@ultratoto14 The WIFI level, at least for a light bulb, is excellent, also because it is located in the same room as the router.

@postlund I try to check the detailed log

@SmartM-ui
Copy link

SmartM-ui commented Oct 27, 2020

@SmartM-ui Heartbeats are sent every 20s to keep the connection alive. Would be great if you provided a complete log when this happens.

@postlund Here is the complete logs:

2020-10-27 15:24:11 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Started heartbeat loop
2020-10-27 15:24:11 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Sending command heartbeat (device type: type_0a)
2020-10-27 15:24:11 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Send payload: b'{}'
2020-10-27 15:24:11 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Waiting for sequence number -100
2020-10-27 15:24:11 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Sending command status (device type: type_0a)
2020-10-27 15:24:11 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Send payload: b'{"gwId":"65xxxc5","devId":"65xxxc5"}'
2020-10-27 15:24:11 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Waiting for sequence number 1
2020-10-27 15:24:11 DEBUG (MainThread) [custom_components.localtuya.pytuya] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2020-10-27 15:24:11 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Got heartbeat response
2020-10-27 15:24:11 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Decrypted payload: {}
2020-10-27 15:24:12 DEBUG (MainThread) [custom_components.localtuya.pytuya] Dispatching message TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'\xb51\xc52\xf0\xc0\xc3\x1d\xbf\x86\xea{\x1a\xb0\x93\xa0\x05B\xde$\xfdz\xf0N;\xd7\xb7\x04\xf1\x98\xaf\x87D\xfc\x9c\x94\x964\x96?^l\xe0\xdbH\x12B\xcc\xd4q+\x9f\x86\xa2\x90.\xaa\x02s~%\xdc\xc0c\t{\xee\xce\n\x1bd\xfc\x03ZvG\x1e\x10\x8b\x91\xd7\xe1\n\xd7\xbe/\x01Y\x16\xb2\xa8\xb2X[\xf2j\xda\x02n\xb7\xde\x86\xdf\xbe\xc45X[\xae2\x0ft\xc1\x91\xb7\x8dC\x84I(\xd8\xa0\xe1\xbb\xd5\xdc\xa5\xe4\xc7$\xf7\xc4{t\xa6N\xa9y\xd5\x08w\x1b\xf3\x83Z\xcd\x9c\x16\x7f\x15\xb0\xc7\xd8,K\x90\xc0\x15L\xea', crc=4283180797)
2020-10-27 15:24:12 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Dispatching sequence number 1
2020-10-27 15:24:12 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Decrypted payload: {"devId":"65xxxc5","dps":{"20":false,"21":"white","22":1000,"23":1000,"24":"000003e803e8","25":"000e0d0000000000000000c80000","26":0}}

or this:

2020-10-27 15:24:06 ERROR (MainThread) [custom_components.localtuya.pytuya] [04xxx40] Heartbeat failed (), disconnecting
Traceback (most recent call last):
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 346, in heartbeat_loop
    await self.heartbeat()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 435, in heartbeat
    return await self.exchange(HEARTBEAT)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 407, in exchange
    msg = await self.dispatcher.wait_for(seqno)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 206, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 490, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
2020-10-27 15:24:06 DEBUG (MainThread) [custom_components.localtuya.pytuya] [04xxx40] Stopped heartbeat loop
2020-10-27 15:24:06 DEBUG (MainThread) [custom_components.localtuya.pytuya] [04xxx40] Closing connection
2020-10-27 15:24:06 DEBUG (MainThread) [custom_components.localtuya.pytuya] [04xxx40] Connection lost: None
2020-10-27 15:24:06 DEBUG (MainThread) [custom_components.localtuya.pytuya] [04xxx40] Closing connection
2020-10-27 15:24:06 ERROR (MainThread) [custom_components.localtuya.pytuya] [0437128268c63aec061d] Heartbeat failed (), disconnecting
Traceback (most recent call last):
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 346, in heartbeat_loop
    await self.heartbeat()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 435, in heartbeat
    return await self.exchange(HEARTBEAT)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 407, in exchange
    msg = await self.dispatcher.wait_for(seqno)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 206, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 490, in 65xxxc5wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

or this

2020-10-27 14:49:13 ERROR (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Heartbeat failed (), disconnecting
Traceback (most recent call last):
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 346, in heartbeat_loop
    await self.heartbeat()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 435, in heartbeat
    return await self.exchange(HEARTBEAT)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 407, in exchange
    msg = await self.dispatcher.wait_for(seqno)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 206, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 490, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Stopped heartbeat loop
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Closing connection
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Connection lost: None
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Closing connection
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Started heartbeat loop
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Sending command heartbeat (device type: type_0a)
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Send payload: b'{}'
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Waiting for sequence number -100
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Sending command status (device type: type_0a)
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Send payload: b'{"gwId":"65xxxc5","devId":"65xxxc5"}'
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Waiting for sequence number 1
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] Dispatching message TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211)
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Got heartbeat response
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Decrypted payload: {}
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] Dispatching message TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'\xb51\xc52\xf0\xc0\xc3\x1d\xbf\x86\xea{\x1a\xb0\x93\xa0\x05B\xde$\xfdz\xf0N;\xd7\xb7\x04\xf1\x98\xaf\x87\xbas\x8c\x96\xcc\xd0\xf7\x84\x8b\xa0\xab\xa1\x9dD\xe2\xbe#\xcd\x1b\xc7\xe7\xc0\x04gG\xb4\x15d\xb2\xf7\x9a\xa7\x86|-\'O6wlG\xe3\xc3\x90\xe5\x96~\xb0r*\xbf\x9ep\xca\x87\x08\xealu>@\xber%\xfei.\x07\x8d\'\x8a\x7f\x1b\x17\xe9\xd0\xb2\x1c\xa0j0\x9a\xfeF#?\x9f\x83\x91ko\x90\xe5}\xc9s\x0e\xec\xc7+\xae\xd0\x98B\xd7\xcbK\xc8\xe1\xc2\xbd\xf7c\x94\x8d"\x15\x14z|7v?\xaf\xcd\xc7\xbb5', crc=281215964)
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Dispatching sequence number 1
2020-10-27 14:49:13 DEBUG (MainThread) [custom_components.localtuya.pytuya] [65xxxc5] Decrypted payload: {"devId":"65xxxc5","dps":{"20":true,"21":"white","22":1000,"23":1000,"24":"000003e803e8","25":"000e0d0000000000000000c80000","26":0}}

Copy link
Collaborator

@postlund postlund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Shall I merge?

@ultratoto14
Copy link
Collaborator Author

For me it's Ok

@postlund
Copy link
Collaborator

Let's merge and take additional matters as new issues.

@postlund postlund merged commit 657850e into rospogrigio:master Oct 28, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants