-
Notifications
You must be signed in to change notification settings - Fork 195
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
Music mode #118
Comments
The Bulbs itself does not have a microphone. Maybe its an idea to setup a mitm proxy for capturing traffic and try to decrypt messages in music mode with smarthome app or maybe jasonacox has an better idea. Would be glad to hear something about :-) |
Hi @panic2k and @frodeheg . According to Tuya (see here), it seems that the app is the one that is sending color changes to the bulb. I'm sure you figured that part out by now. What we don't know is what the app is sending to the bulb. It appears that DPS 27 is reserved for this (see here). If I use the async method, I can use this DPS to change the color in some random way, and the string I send seems to change (higher values have slower fades). I'm sure there is other combinations or string that drive more specialization. Perhaps the Phone app is just sending packets to indicate a beat which would cause the bulb to change to what appears to be the "beat of the music". In any case, here is a working script you can play with. See what you can figure out: import tinytuya
import time
#tinytuya.set_debug() # uncomment if you want to see all packets
d = tinytuya.BulbDevice(DEVICEID, DEVICEIP, DEVICEKEY)
d.set_version(3.3)
d.set_socketPersistent(True)
# Show status of device
data = d.status()
print('\nCurrent Status of Bulb: %r' % data)
# Music Test
print('Setting to Music')
d.set_mode('music')
data = d.status()
# Send some music data to bulb
x = 0
while (x<20):
value = "%02d01" % x
print (" > Sending %s" % value)
payload = d.generate_payload(tinytuya.CONTROL, {"27": value})
d.send(payload)
if (x % 3):
time.sleep(1) # extend every 3 beat
time.sleep(0.2)
x = x + 1
# Done
print('\nDone')
d.set_white() |
Thank you, that's maybe great for some bulbs. I've tried with my GU10 bulbs, but they are stay just red. If i use Android App, the next color is displayed on phone - there must be an command to set the bulbs. I've no Idea how cloud messages could be decrypted, but maybe a deeper look at TuyaOS IDE could give an idea. In spare time i take a look this. For sure, that's no easy task. But maybe there's something useful there. :-) |
Thanks @panic2k ! I can't help but wonder if this sequence is similar to sending IR commands for IR Tuya devices. You might check these out:
|
How is the music mode supposed to work?
If I have this python script:
I get the following output
{'dps': {'20': True, '21': 'music', '22': 1000, '23': 750, '24': '007803e803e8', '25': '07464602000003e803e800000000464602007803e803e80000000046460200f003e803e800000000464602003d03e803e80000000046460200ae03e803e800000000464602011303e803e800000000', '26': 0, '41': True}}
The light only turn red but does not respond to sound. Should it?
I have no idea whether or not there is a microphone in the lightbulb but at least it did change to music mode.
The text was updated successfully, but these errors were encountered: