jasonacox / tinytuya

Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).
MIT License
867 stars 157 forks source link

Valve controller #473

Closed fmarzocca closed 3 months ago

fmarzocca commented 3 months ago

Hi,

I have a valve controller which is connected to a Tuya gateway via BT. The valve controller has no IP. How can I handle it with tinytuya?

Thanks

jasonacox commented 3 months ago

Hi @fmarzocca - You control the valve through the gateway. Here is an example:

https://github.com/jasonacox/tinytuya/blob/master/examples/zigbee_gateway.py

gw = tinytuya.Device( 'eb...4', address=None, local_key='aabbccddeeffgghh', persist=True, version=3.3 )

print( 'GW IP found:', gw.address )

# configure one or more children.  Every dev_id must be unique!
#   cid is the "node_id" from devices.json
valve = tinytuya.OutletDevice( 'eb14...w', cid='0011223344556601', parent=gw )

print(valve.status())
fmarzocca commented 3 months ago

Cool! Thank you!