Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xm1k3/go-tuya
Golang Tuya integration
https://github.com/xm1k3/go-tuya
go golang iot tuya tuya-api tuya-cloud
Last synced: 11 days ago
JSON representation
Golang Tuya integration
- Host: GitHub
- URL: https://github.com/xm1k3/go-tuya
- Owner: xm1k3
- License: apache-2.0
- Created: 2023-11-26T11:00:49.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2023-11-27T10:07:29.000Z (11 months ago)
- Last Synced: 2024-07-30T20:56:56.294Z (3 months ago)
- Topics: go, golang, iot, tuya, tuya-api, tuya-cloud
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-tuya
Golang Tuya integration## Installation
To install your tool, you can use the go get command:
```
go install -v github.com/xm1k3/go-tuya@latest
```Make sure you have Go installed on your machine.
## Usage
After installation, you can use your tool from the command line. Here are some example commands:
## Options
Your tool supports the following options:
- **-c, --clientid**: Client ID parameter (required).
- **-s, --secret**: Secret parameter (required).
- **-d, --deviceid**: Device ID parameter (required).### Get a Token
```
go-tuya token -c {CLIENT-ID} -s {SECRET}
```This command will return a token after authenticating the client with the specified parameters.
Example output:
```json
{
"result": {
"access_token": "96268*****************6275e",
"expire_time": 5626,
"refresh_token": "35fe6**********************79bbe",
"uid": "bay169***********04VX4T"
},
"success": true,
"t": 1700995257134,
"tid": "..."
}
```### Get a Device
```
go-tuya device -c {CLIENT-ID} -s {SECRET} -d {DEVICE-ID}
```This command will return device information after authenticating the client with the specified parameters.
Example output:
```json
{
"result": {
"active_time": 1699111647,
"biz_type": 0,
"category": "ms",
"create_time": 1699108124,
"icon": "...",
"id": "{ID}",
"ip": "",
"lat": "...",
"local_key": "...",
"lon": "...",
"model": "...",
"name": "{NAME}",
"node_id": "{NODE-ID}",
"online": false,
"owner_id": "...",
"product_id": "...",
"product_name": "...",
"status": [
{
"code": "unlock_method_create",
"value": "..."
},
{
"code": "unlock_offline_pd",
"value": ""
}
...
],
"sub": true,
"time_zone": "+02:00",
"uid": "...",
"update_time": 1700985606,
"uuid": "..."
},
"success": true,
"t": 1700995312944,
"tid": "..."
}
```# License
go-tuya is distributed under Apache-2.0 License