https://github.com/m-pavel/go-tion
Tion Breazer golang API
https://github.com/m-pavel/go-tion
mqtt tion-breazer
Last synced: 2 months ago
JSON representation
Tion Breazer golang API
- Host: GitHub
- URL: https://github.com/m-pavel/go-tion
- Owner: m-pavel
- License: apache-2.0
- Created: 2019-09-18T15:42:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-31T19:29:22.000Z (over 4 years ago)
- Last Synced: 2024-11-16T13:12:53.184Z (6 months ago)
- Topics: mqtt, tion-breazer
- Language: Go
- Homepage:
- Size: 121 KB
- Stars: 22
- Watchers: 8
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tion Breazer 3S Go API and Clients
There are thee backend available:
- https://github.com/m-pavel/go-gattlib
- https://github.com/paypal/gatt
- https://github.com/muka/go-bluetooth <- Preferable
## Pairing
Device must be paired. E.g. using bluetoothctrl
## Reading state
```
t = tionm.New("MAC")
ts.t.Connect(timeout)
defer ts.t.Disconnect()
s, err := ts.t.ReadState(timeout)
fmt.Println(s)
```
# Tion Breazer Home Assistant MQTT integration
## Sensors
```
- platform: mqtt
name: "Temperature Inside (Tion)"
state_topic: "nn/tion"
value_template: "{{ value_json.temp_out }}"
availability_topic: "nn/tion-aval"
icon: "mdi:thermometer"
unit_of_measurement: '°C'- platform: mqtt
name: "Temperature Outside (Tion)"
state_topic: "nn/tion"
value_template: "{{ value_json.temp_in }}"
availability_topic: "nn/tion-aval"
icon: "mdi:thermometer"
unit_of_measurement: '°C'- platform: mqtt
name: "Temperature Target (Tion)"
state_topic: "nn/tion"
value_template: "{{ value_json.temp_target }}"
availability_topic: "nn/tion-aval"
icon: "mdi:thermometer"
unit_of_measurement: '°C'- platform: mqtt
name: "Speed (Tion)"
state_topic: "nn/tion"
value_template: "{{ value_json.speed }}"
availability_topic: "nn/tion-aval"
icon: "mdi:fan"```
## Control channel
Turn on/off
```
{
"payload_template": "{% if is_state('binary_sensor.tion' , 'off') %} \n { \"on\": true }\n{% else %}\n { \"on\": false }\n{% endif %}\n",
"qos": 1,
"topic": "nn/tion-control"
}
```
## Building
```
make GOARCH= IMPL=
```
GOARCH - https://golang.org/doc/install/source#environmentIMPL - one of below
- muka https://github.com/muka/go-bluetooth backend implementation, default
- ppal
- gatt
- fake
- mqtt
## Magic
When getting 'Unexpected response length' with muka driver, run once with ppal driver
In fact it performs adaptor reset like below
```
sudo hciconfig hci0 up
sudo hciconfig hci0 reset
sudo hciconfig hci0 down
sudo hciconfig hci0 up
```