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

T1013 connects to device but does not turn power on #4

Open
ah100101 opened this issue Mar 7, 2019 · 5 comments
Open

T1013 connects to device but does not turn power on #4

ah100101 opened this issue Mar 7, 2019 · 5 comments

Comments

@ah100101
Copy link

ah100101 commented Mar 7, 2019

Hey @sebmos

Thanks for putting this api together!
I have used it for automating the T1011 lightbulb with success and recently tried it on a T1013 but have ran into an issue getting the bulb to successfully power on.

Below is the output when I connect via cli (verbose logging on) there are no obvious issues that I see:

(AbstractDevice.connect) Connecting
(TcpSocket.connect) Connecting to 10.100.5.79
(AbstractDevice.new) TCP Socket connected
(AbstractDevice.connect) Connected to device T Rex (Model: T1013, Code: 62F5EF8E50C24B4E, IP Address: 10.100.5.79)
(AbstractDevice.connect) Loading current device state
(LightBulb.loadCurrentState) Loading current device state
(LightBulb.getState) Loading current device state
(AbstractDevice.getSequence) Loading current sequence number
(AbstractDevice.sendPacketWithResponse) 2673901,62F5EF8E50C24B4E,0
(AbstractDevice.encryptPacket) 2673901,62F5EF8E50C24B4E,0
(AbstractDevice.sendPacketWithResponse) Sending encrypted packet
(AbstractDevice.sendPacketWithResponse) Response received: {"type":"Buffer","data":[12,17,205,105,99,127,124,61,212,144,142,228,165,206,74,135]}
(AbstractDevice.sendPacketWithResponse) Response decrypted: {"type":"Buffer","data":[11,0,8,249,182,246,32,18,0,26,2,8,1,0,0,0]}
(AbstractDevice.sendPacketWithResponse) Deserializing response as T1013Packet
(AbstractDevice.getSequence) Current sequence number: 69049209
(LightBulb.getState) Sending request to device
(AbstractDevice.sendPacketWithResponse) 69049210,62F5EF8E50C24B4E,,,1
(AbstractDevice.encryptPacket) 69049210,62F5EF8E50C24B4E,,,1
(AbstractDevice.sendPacketWithResponse) Sending encrypted packet
(AbstractDevice.sendPacketWithResponse) Response received: {"type":"Buffer","data":[115,212,165,30,24,178,101,127,164,56,51,251,57,214,57,253,171,1,76,31,211,116,3,217,92,130,180,237,55,71,26,144,16,11,229,219,228,192,187,235,22,100,95,57,203,81,21,20,62,35,221,10,210,69,84,3,100,81,236,159,186,150,201,209]}
(AbstractDevice.sendPacketWithResponse) Response decrypted: {"type":"Buffer","data":[58,0,8,251,182,246,32,18,0,42,49,8,2,18,45,8,255,255,255,255,255,255,255,255,255,1,18,32,8,6,16,1,24,0,42,11,8,171,1,16,205,1,24,239,1,32,10,56,0,64,221,255,255,255,255,255,255,255,255,1,0,0,0,0]}
(AbstractDevice.sendPacketWithResponse) Deserializing response as T1013Packet
(LightBulb.loadCurrentState) Parsing current state as color light bulb
(LightBulb.loadCurrentState) Current power state: false
(LightBulb.loadCurrentState) Current state: {"brightness":10,"temperature":50,"colors":{"red":171,"green":205,"blue":239}}
(AbstractDevice.isPowerOn) Checking power state
(AbstractDevice.isPowerOn) Checking power state
(AbstractDevice.isPowerOn) Checking power state
(AbstractDevice.isPowerOn) Checking power state

and below is the output when I try to power on which is unsuccessful but again, nothing jumps out as an obvious issue. Perhaps you might find some useful information from the output.

? Options Turn on
(AbstractDevice.isPowerOn) Checking power state
(LightBulb.setPowerOn) Change to: true
LightBulb.setPowerOn
(LightBulb.setState) Change to: [object Object]
(LightBulb.setState) Treat as color bulb (T1013Packet)
Treat as color bulb (T1013Packet)
packet:
{ wrappers_:
   { '5':
      { wrappers_: [Object],
        messageId_: undefined,
        arrayIndexOffset_: -1,
        array: [Array],
        pivot_: 1.7976931348623157e+308,
        convertedFloatingPointFields_: {} } },
  messageId_: undefined,
  arrayIndexOffset_: -1,
  array: [ <4 empty items>, [ 1, [Array] ] ],
  pivot_: 1.7976931348623157e+308,
  convertedFloatingPointFields_: {} }
Set power
(LightBulb.setState) Set power
(LightBulb.setState) No colors
state:
{ brightness: 10,
  temperature: 50,
  colors: { red: 171, green: 205, blue: 239 } }
set brightness to this.state.brightness
set temp to this.state.temperature
(AbstractDevice.getSequence) Loading current sequence number
(AbstractDevice.sendPacketWithResponse) 1906194,62F5EF8E50C24B4E,0
(AbstractDevice.encryptPacket) 1906194,62F5EF8E50C24B4E,0
(AbstractDevice.sendPacketWithResponse) Sending encrypted packet
(AbstractDevice.sendPacketWithResponse) Response received: {"type":"Buffer","data":[94,194,252,160,171,188,250,110,248,27,44,66,215,161,93,209]}
(AbstractDevice.sendPacketWithResponse) Response decrypted: {"type":"Buffer","data":[11,0,8,185,177,229,32,18,0,26,2,8,1,0,0,0]}
(AbstractDevice.sendPacketWithResponse) Deserializing response as T1013Packet
(AbstractDevice.getSequence) Current sequence number: 68769977
sending packet
(LightBulb.setState) Sending packet
(AbstractDevice.sendPacket) 68769978,62F5EF8E50C24B4E,,,1,10,,7,0,10,50,,1
(AbstractDevice.encryptPacket) 68769978,62F5EF8E50C24B4E,,,1,10,,7,0,10,50,,1
(AbstractDevice.sendPacket) Sending encrypted packet
reloading state
(LightBulb.setState) Reloading state
(LightBulb.getState) Loading current device state
(AbstractDevice.getSequence) Loading current sequence number
(AbstractDevice.sendPacketWithResponse) 1979946,62F5EF8E50C24B4E,0
(AbstractDevice.encryptPacket) 1979946,62F5EF8E50C24B4E,0
(AbstractDevice.sendPacketWithResponse) Sending encrypted packet
(AbstractDevice.sendPacketWithResponse) Response received: {"type":"Buffer","data":[148,132,142,102,195,104,17,91,74,162,110,185,224,149,185,80]}
(AbstractDevice.sendPacketWithResponse) Response decrypted: {"type":"Buffer","data":[11,0,8,241,241,233,32,18,0,26,2,8,1,0,0,0]}
(AbstractDevice.sendPacketWithResponse) Deserializing response as T1013Packet
(AbstractDevice.getSequence) Current sequence number: 68843761
(LightBulb.getState) Sending request to device
(AbstractDevice.sendPacketWithResponse) 68843762,62F5EF8E50C24B4E,,,1
(AbstractDevice.encryptPacket) 68843762,62F5EF8E50C24B4E,,,1
(AbstractDevice.sendPacketWithResponse) Sending encrypted packet
(AbstractDevice.sendPacketWithResponse) Response received: {"type":"Buffer","data":[226,146,4,87,77,214,183,123,164,51,154,61,5,236,105,95,69,51,43,236,134,122,128,174,120,27,232,202,91,75,232,185,99,21,247,13,10,237,211,9,195,144,191,159,116,182,224,246,19,38,194,100,221,13,119,169,144,75,145,255,144,54,241,22]}
(AbstractDevice.sendPacketWithResponse) Response decrypted: {"type":"Buffer","data":[58,0,8,243,241,233,32,18,0,42,49,8,2,18,45,8,255,255,255,255,255,255,255,255,255,1,18,32,8,6,16,1,24,0,42,11,8,171,1,16,205,1,24,239,1,32,10,56,0,64,218,255,255,255,255,255,255,255,255,1,0,0,0,0]}
(AbstractDevice.sendPacketWithResponse) Deserializing response as T1013Packet
(LightBulb.setPowerOn) New power state: false
New power state:
Power is now off
(AbstractDevice.isPowerOn) Checking power state
(AbstractDevice.isPowerOn) Checking power state
(AbstractDevice.isPowerOn) Checking power state
(AbstractDevice.isPowerOn) Checking power state

Wanted to pass along this info in case it helps with any troubleshooting.
Thanks again for putting this project together!

@sebmos
Copy link
Owner

sebmos commented Mar 7, 2019

Hey @ah100101,

I think I may have found the problem. I pushed an update to this repo - could you try again?

@ah100101
Copy link
Author

ah100101 commented Mar 7, 2019

Just confirmed that it is working on the latest.
Thanks for the quick response!

@sebmos
Copy link
Owner

sebmos commented Mar 8, 2019

Glad - I'll package it up soon!

Did you also test changing the light temperature, brightness & color? If not, could you do me a favour and try that? I want to make sure it all works properly!

@ah100101
Copy link
Author

ah100101 commented Mar 8, 2019

Turning on, changing color, and changing brightness works. But changing the temperature does not:

? Enter color temperature (between 0 and 100) 100
(LightBulb.setBrightness) Change to: 100
(LightBulb.setState) Change to: {"brightness":100}
(LightBulb.parseValueAsNumber) Input: "100" (Max Value: 100)
(LightBulb.parseValueAsNumber) Result: 100
(LightBulb.setState) Brightness: 100
(LightBulb.setState) Treat as color bulb (T1013Packet)
(LightBulb.setState) No colors
(LightBulb.setState) Change brightness to 100
(LightBulb.setState) Keep temperature at 50
(AbstractDevice.getSequence) Loading current sequence number
(AbstractDevice.sendPacketWithResponse) 2994039,62F5EF8E50C24B4E,0
(AbstractDevice.encryptPacket) 2994039,62F5EF8E50C24B4E,0
(AbstractDevice.sendPacketWithResponse) Sending encrypted packet
(AbstractDevice.sendPacketWithResponse) Response received: {"type":"Buffer","data":[223,123,158,34,74,116,151,86,139,197,217,173,135,155,31,80]}
(AbstractDevice.sendPacketWithResponse) Response decrypted: {"type":"Buffer","data":[11,0,8,135,177,183,81,18,0,26,2,8,1,0,0,0]}
(AbstractDevice.sendPacketWithResponse) Deserializing response as T1013Packet
(AbstractDevice.getSequence) Current sequence number: 170776711
(LightBulb.setState) Sending packet
(AbstractDevice.sendPacket) 170776712,62F5EF8E50C24B4E,,,0,10,,7,0,100,50
(AbstractDevice.encryptPacket) 170776712,62F5EF8E50C24B4E,,,0,10,,7,0,100,50
(AbstractDevice.sendPacket) Sending encrypted packet
(LightBulb.setState) Reloading state
(LightBulb.loadCurrentState) Loading current device state
(LightBulb.getState) Loading current device state
(AbstractDevice.getSequence) Loading current sequence number
(AbstractDevice.sendPacketWithResponse) 2588311,62F5EF8E50C24B4E,0
(AbstractDevice.encryptPacket) 2588311,62F5EF8E50C24B4E,0
(AbstractDevice.sendPacketWithResponse) Sending encrypted packet
(AbstractDevice.sendPacketWithResponse) Response received: {"type":"Buffer","data":[218,113,190,60,253,97,163,137,171,121,0,230,63,50,222,201]}
(AbstractDevice.sendPacketWithResponse) Response decrypted: {"type":"Buffer","data":[11,0,8,182,208,158,81,18,0,26,2,8,1,0,0,0]}
(AbstractDevice.sendPacketWithResponse) Deserializing response as T1013Packet
(AbstractDevice.getSequence) Current sequence number: 170371126
(LightBulb.getState) Sending request to device
(AbstractDevice.sendPacketWithResponse) 170371127,62F5EF8E50C24B4E,,,1
(AbstractDevice.encryptPacket) 170371127,62F5EF8E50C24B4E,,,1
(AbstractDevice.sendPacketWithResponse) Sending encrypted packet
(AbstractDevice.sendPacketWithResponse) Response received: {"type":"Buffer","data":[155,169,232,8,60,234,231,193,202,117,204,4,199,244,21,190,219,183,172,128,161,124,94,124,96,164,142,225,192,4,131,189,139,100,21,98,65,190,29,242,148,222,215,142,207,47,11,60,107,160,4,18,188,193,147,236,205,9,109,229,63,156,245,15]}
(AbstractDevice.sendPacketWithResponse) Response decrypted: {"type":"Buffer","data":[51,0,8,184,208,158,81,18,0,42,42,8,2,18,38,8,255,255,255,255,255,255,255,255,255,1,18,25,8,6,16,0,24,1,34,4,8,100,16,50,56,0,64,219,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0]}
(AbstractDevice.sendPacketWithResponse) Deserializing response as T1013Packet
(LightBulb.loadCurrentState) Parsing current state as color light bulb
(LightBulb.loadCurrentState) Current power state: true
(LightBulb.loadCurrentState) No color information returned
(LightBulb.loadCurrentState) Current state: {"brightness":100,"temperature":50}
(LightBulb.setBrightness) New brightness: 100
Color temperature is now 100
(AbstractDevice.isPowerOn) Checking power state
(AbstractDevice.isPowerOn) Checking power state
(AbstractDevice.isPowerOn) Checking power state
(AbstractDevice.isPowerOn) Checking power state

On the 8th line above: (LightBulb.setState) No colors seems incorrect since we are able to change colors through the cli and api.

@sebmos
Copy link
Owner

sebmos commented Mar 8, 2019

Hey @ah100101,

Thanks for that update. I noticed that the CLI, when changing the color temperature, actually changes the brightness setting. I pushed a fix for that. Could you try again?

As for that log - this is actually correct - the protocol defines slightly different behaviour for changing colours and changing temperature, brightness & power state. This just helps identify the code path triggered.

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

2 participants