https://github.com/hoegaarden/go-shellyrpc
Do RPC calls to Shelly BLU devices
https://github.com/hoegaarden/go-shellyrpc
ble bluetooth-low-energy golang iot mongoose-os mongoose-rpc rpc-library shelly
Last synced: 9 months ago
JSON representation
Do RPC calls to Shelly BLU devices
- Host: GitHub
- URL: https://github.com/hoegaarden/go-shellyrpc
- Owner: hoegaarden
- Created: 2024-12-28T11:34:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-18T10:49:53.000Z (over 1 year ago)
- Last Synced: 2025-06-22T06:06:02.851Z (about 1 year ago)
- Topics: ble, bluetooth-low-energy, golang, iot, mongoose-os, mongoose-rpc, rpc-library, shelly
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Shelly RPC over BLE & golang
## What
Allows you to directly, without their gateway, communicate with Shelly BLU
devices, e.g. a [Shelly BLU TRV][trv], via their bluetooth RPC mechanism. It is
implemented according the documentation over
[here](https://kb.shelly.cloud/knowledge-base/communicating-with-shelly-devices-via-bluetooth-lo).
While it is tailored towards my use with Shelly devices, it might be useful to
communicate with other Mongoose OS based devices, too. Some notes about RPC for
Mongoose OS can be found
[here](https://mongoose-os.com/docs/mongoose-os/api/rpc/rpc-gatts.md).
Under the hood [TinyGo]'s [Bluetooth API][bt] is used.
Note: You have to pair the device/sensor before you can use this module, you
can use e.g. `bluetoothctl` for that.
[trv]: https://www.shelly.com/products/shelly-blu-trv-single-pack
[TinyGo]: https://tinygo.org/
[bt]: https://github.com/tinygo-org/bluetooth
## Status
Experimental. Seems to work for my Shelly BLU TRVs.
## Example
There is an example application at
[./cmd/shellyrpc/main.go](cmd/shellyrpc/main.go) which calls an RPC method
(with optional parameters) and dumps the response on standard out:
```terminal
: go run ./cmd/shellyrpc/main.go --help
Usage of /tmp/go-build4271337887/b001/exe/main:
-addr string
Shelly device address (default "f8:44:77:21:12:55")
-method string
RPC method to call (default "Shelly.GetConfig")
-params string
RPC method parameters as JSON blob (default "null")
: go run ./cmd/shellyrpc/main.go
{
"sys": {
"ble": {
"beacon_count": 5,
"interval_ms": 333
},
"cfg_rev": 6,
"device": {
"name": ""
},
"location": {
"lat": 0,
"lon": 0
},
"ui": {
"brightness": 7,
"flip": false,
"lock": false,
"t_units": "C"
}
},
"temperature:0": {
"id": 0,
"offset_C": 0
},
"trv:0": {
"default_boost_duration": 1800,
"default_override_duration": 2147483647,
"default_override_target_C": 8,
"enable": true,
"flags": [
"auto_calibrate",
"anticlog"
],
"id": 0,
"min_valve_position": 0,
"override_enable": true
}
}
:
```