https://github.com/peterhellberg/go-tdtool-api
A simple API in front of the TellStick tdtool written in Go (List and turn devices on/off)
https://github.com/peterhellberg/go-tdtool-api
Last synced: 5 months ago
JSON representation
A simple API in front of the TellStick tdtool written in Go (List and turn devices on/off)
- Host: GitHub
- URL: https://github.com/peterhellberg/go-tdtool-api
- Owner: peterhellberg
- Created: 2012-12-28T18:27:53.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2015-01-25T11:42:18.000Z (about 11 years ago)
- Last Synced: 2025-03-04T02:39:26.301Z (12 months ago)
- Language: Go
- Size: 168 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
go-tdtool-api
=============
A simple API in front of the TellStick tdtool. (Written in [Go](http://golang.org/))
## tdtool
The tdtool binary is installed when installing the [TelldusCenter](http://www.telldus.se/products/nativesoftware).
You can also find it in the [telldus-core](https://github.com/telldus/telldus/tree/master/telldus-core) package.
_(You probably don’t need to install the GUI)_
## TellStick
You will also need one of these:
[](http://www.telldus.se/products/tellstick)
And probably one or two controllable devices. (I’ve got the [Nexa PB-3](http://www.nexa.se/PB3Ny3packsjalvlarande.htm))
## Running in the background
nohup ./tdtool-api &
This will try to start a web server on port **8080**
## Using the API
### Listing available devices
```ruby
curl http://localhost:8080/
```
#### This should output something along these lines:
Number of devices: 4
1 Lights ON
3 Hörnlampa ON
2 Skrivbordslampa OFF
4 Sovrumslampa ON
### Turning a device _ON_
```ruby
curl -X PUT http://localhost:8080/2/on
```
This should output:
Turning on device 2, Skrivbordslampa - Success
### Turning a device _OFF_
```ruby
curl -X PUT http://localhost:8080/4/off
```
This should output:
Turning off device 4, Sovrumslampa - Success
### Sync calls
You can also make synchronous requests by adding `/sync` to the end of the path:
```
curl -X PUT http://localhost:8080/3/off/sync
```