Replies: 2 comments 4 replies
-
|
Most devices don't accept more than 1 or 2 connections, so make sure HA is stopped and the SmartLife app is closed before doing the scan. If you are running HA and TinyTuya on the same machine then they will fight over who gets to receive the device broadcasts as well. That said, what are you expecting music mode to do? Most bulbs do not have built-in microphones and so the light show is generated by the app using the phone's microphone and sent to the bulb via a sequence of DP 28 updates. The bulbs/strips which do have a microphone usually activate it by switching to a special scene (the strip controller I have sets DP 25 to "000e0d0000000000000000c80000"). |
Beta Was this translation helpful? Give feedback.
-
|
I've managed to solve the issue by closing the SmartLife app, stopping HA, and running the following script (after a scan, since devices.json is needed for the local keys): import json
import tinytuya
IP = "192.168.178.69" # the IP of your device
VERSIONS = [3.3, 3.4, 3.5]
with open("devices.json","r") as f:
devs = json.load(f)
if isinstance(devs, dict) and "devices" in devs:
devs = devs["devices"]
def try_one(dev_id, key, name, ver):
d = tinytuya.Device(dev_id, IP, key)
d.set_socketPersistent(False)
d.set_socketTimeout(3)
d.set_version(ver)
r = d.status()
ok = isinstance(r, dict) and "dps" in r
return ok, r
for ver in VERSIONS:
print(f"\n=== Testing IP {IP} with version {ver} ===")
for dev in devs:
dev_id = dev.get("id")
key = dev.get("key")
name = dev.get("name", "")
if not dev_id or not key:
continue
ok, r = try_one(dev_id, key, name, ver)
if ok:
print("\nMATCH FOUND")
print("name:", name)
print("id:", dev_id)
print("key:", key)
print("version:", ver)
print("status:", r)
raise SystemExit(0)
print("\nNo match found.")Thanks to this script I found out that my devices use protocol version 3.5 instead of what TinyTuya reported during the scan. From that point on it was straightforward to send commands to the devices, since all properties are available in the Tuya Cloud API Explorer, and mapping them in HA is trivial thanks to the integration xZetsubou/hass-localtuya. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm having trouble trying to use the music mode from Home Assistant on two lamps.
I have two ambient lamp, they acts like a led strip and it works fine in Home Assistant, but I can't use the music mode in HA, but in the Smart Life app yes.
I imagined that I can use tinytuya to make a script and/or an integration for HA, but given that I have all the infos of the devices, I can't use it, am I doing something wrong?
Scanning doesn't get me any device, but force scanning does, the problem is that for my two devices the result is:
Logs of the force scan
Having all the infos, makes a difference?
Here's the snippet I'm trying to use:
Tried with classes
DeviceandBulbDevicebut receiving this with version 3.4+:{'Error': 'Check device key or version', 'Err': '914', 'Payload': None}and this with version <3.4:
{'Error': 'Unexpected Payload from Device', 'Err': '904', 'Payload': None}There's a way I can try to send the command to set the music mode?
Beta Was this translation helpful? Give feedback.
All reactions