openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.9k stars 3.59k forks source link

[shelly] Support for Shelly BLU TRV via BLU Gateway #17756

Open timbms opened 1 week ago

timbms commented 1 week ago

Shelly offers new thermostats. BLU TRVs are replacing the TRV. They communicate via Bluetooth with a Bluetoot-Wifi gateway.

It would be great to have them supported on openHAB.

Here is the result of some analysis

curl -X POST --json '{"id":1,"method":"Shelly.ListMethods"}' http://192.168.2.52/rpc | jq

{
  "id": 1,
  "src": "shellyblugwg3-8cbfeaa7caf4",
  "result": {
    "methods": [
      "BluGw.SetConfig",
      "BluGw.GetConfig",
      "BluGw.GetStatus",
      "Button.SetConfig",
      "Button.GetConfig",
      "Button.GetStatus",
      "Button.Trigger",
      "Text.SetConfig",
      "Text.GetConfig",
      "Text.GetStatus",
      "Text.Set",
      "Number.SetConfig",
      "Number.GetConfig",
      "Number.GetStatus",
      "Number.Set",
      "Group.SetConfig",
      "Group.GetConfig",
      "Group.GetStatus",
      "Group.Set",
      "Enum.SetConfig",
      "Enum.GetConfig",
      "Enum.GetStatus",
      "Enum.Set",
      "Boolean.SetConfig",
      "Boolean.GetConfig",
      "Boolean.GetStatus",
      "Boolean.Set",
      "Virtual.Delete",
      "Virtual.Add",
      "Schedule.List",
      "Schedule.DeleteAll",
      "Schedule.Delete",
      "Schedule.Update",
      "Schedule.Create",
      "BLE.StartBluTrvAssociations",
      "BluTrv.CheckForUpdates",
      "BluTrv.UpdateFirmware",
      "BluTrv.GetRemoteDeviceInfo",
      "BluTrv.GetRemoteStatus",
      "BluTrv.GetRemoteConfig",
      "BluTrv.Call",
      "BluTrv.Delete",
      "BluTrv.SetConfig",
      "BluTrv.GetConfig",
      "BluTrv.GetStatus",
      "BTHomeSensor.SetConfig",
      "BTHomeSensor.GetConfig",
      "BTHomeSensor.GetStatus",
      "BTHomeDevice.UpdateFirmware",
      "BTHomeDevice.GetKnownObjects",
      "BTHomeDevice.SetConfig",
      "BTHomeDevice.GetConfig",
      "BTHomeDevice.GetStatus",
      "BTHome.GetObjectInfos",
      "BTHome.DeleteSensor",
      "BTHome.AddSensor",
      "BTHome.DeleteDevice",
      "BTHome.AddDevice",
      "BTHome.StartDeviceDiscovery",
      "BTHome.SetConfig",
      "BTHome.GetConfig",
      "BTHome.GetStatus",
      "Webhook.ListSupported",
      "Webhook.List",
      "Webhook.DeleteAll",
      "Webhook.Delete",
      "Webhook.Update",
      "Webhook.Create",
      "Script.Stop",
      "Script.Start",
      "Script.Eval",
      "Script.GetCode",
      "Script.PutCode",
      "Script.SetConfig",
      "Script.GetConfig",
      "Script.GetStatus",
      "Script.List",
      "Script.Delete",
      "Script.Create",
      "WS.SetConfig",
      "WS.GetConfig",
      "WS.GetStatus",
      "Mqtt.SetConfig",
      "Mqtt.GetConfig",
      "Mqtt.GetStatus",
      "Cloud.SetConfig",
      "Cloud.GetConfig",
      "Cloud.GetStatus",
      "BLE.SetConfig",
      "BLE.GetConfig",
      "BLE.GetStatus",
      "BLE.CloudRelay.ListInfos",
      "BLE.CloudRelay.List",
      "Wifi.Scan",
      "Wifi.ListAPClients",
      "Wifi.SetConfig",
      "Wifi.GetConfig",
      "Wifi.GetStatus",
      "Sys.SetConfig",
      "Sys.GetConfig",
      "Sys.GetStatus",
      "KVS.Delete",
      "KVS.Set",
      "KVS.GetMany",
      "KVS.Get",
      "KVS.List",
      "Shelly.Identify",
      "HTTP.Request",
      "HTTP.POST",
      "HTTP.GET",
      "Shelly.ListMethods",
      "Shelly.PutTLSClientKey",
      "Shelly.PutTLSClientCert",
      "Shelly.PutUserCA",
      "Shelly.Reboot",
      "Shelly.SetAuth",
      "Shelly.Update",
      "Shelly.CheckForUpdate",
      "Shelly.DetectLocation",
      "Shelly.ListTimezones",
      "Shelly.GetComponents",
      "Shelly.GetStatus",
      "Shelly.FactoryReset",
      "Shelly.ResetWiFiConfig",
      "Shelly.GetConfig",
      "Shelly.GetDeviceInfo",
      "OTA.Abort",
      "OTA.Write",
      "OTA.Data",
      "OTA.Start",
      "OTA.Revert",
      "OTA.Commit",
      "OTA.Update",
      "Sys.SetDebug"
    ]
  }
}

curl -X POST --json '{"id":1,"method":"Shelly.GetComponents"}' http://192.168.2.52/rpc | jq

{
  "id": 1,
  "src": "shellyblugwg3-8cbfeaa7caf4",
  "result": {
    "components": [
      {
        "key": "ble",
        "status": {},
        "config": {
          "enable": true,
          "rpc": {
            "enable": true
          }
        }
      },
      {
        "key": "blugw",
        "status": {},
        "config": {
          "sys_led_enable": false
        }
      },
      {
        "key": "blutrv:200",
        "status": {
          "id": 200,
          "rssi": -57,
          "battery": 100,
          "packet_id": 136,
          "last_updated_ts": 1731924071,
          "paired": true,
          "rpc": true,
          "rsv": 37
        },
        "config": {
          "id": 200,
          "addr": "f8:44:77:37:32:70",
          "name": null,
          "key": null,
          "trv": "bthomedevice:200",
          "temp_sensors": [],
          "dw_sensors": [],
          "meta": null
        }
      },
      {
        "key": "blutrv:201",
        "status": {
          "id": 201,
          "rssi": -49,
          "battery": 100,
          "packet_id": 93,
          "last_updated_ts": 1731924076,
          "paired": true,
          "rpc": true,
          "rsv": 17
        },
        "config": {
          "id": 201,
          "addr": "f8:44:77:1e:ef:ab",
          "name": null,
          "key": null,
          "trv": "bthomedevice:201",
          "temp_sensors": [],
          "dw_sensors": [
            "bthomesensor:210"
          ],
          "meta": null
        }
      },
      {
        "key": "bthome",
        "status": {},
        "config": {}
      },
      {
        "key": "bthomedevice:200",
        "status": {
          "id": 200,
          "rssi": -57,
          "battery": 100,
          "packet_id": 136,
          "last_updated_ts": 1731924071,
          "paired": true,
          "rpc": true,
          "rsv": 37
        },
        "config": {
          "id": 200,
          "addr": "f8:44:77:37:32:70",
          "name": null,
          "key": null,
          "meta": null
        },
        "attrs": {
          "flags": 17,
          "model_id": 8
        }
      },
      {
        "key": "bthomedevice:201",
        "status": {
          "id": 201,
          "rssi": -49,
          "battery": 100,
          "packet_id": 93,
          "last_updated_ts": 1731924076,
          "paired": true,
          "rpc": true,
          "rsv": 17
        },
        "config": {
          "id": 201,
          "addr": "f8:44:77:1e:ef:ab",
          "name": null,
          "key": null,
          "meta": null
        },
        "attrs": {
          "flags": 17,
          "model_id": 8
        }
      },
      {
        "key": "bthomedevice:202",
        "status": {
          "id": 202,
          "rssi": -54,
          "battery": 100,
          "packet_id": 137,
          "last_updated_ts": 1731923034,
          "paired": true,
          "rpc": false,
          "rsv": -1
        },
        "config": {
          "id": 202,
          "addr": "b0:c7:de:27:b5:8f",
          "name": null,
          "key": null,
          "meta": null
        },
        "attrs": {
          "flags": 17,
          "model_id": 2
        }
      },
      {
        "key": "bthomesensor:200",
        "status": {
          "id": 200,
          "value": 100,
          "last_updated_ts": 1731924071
        },
        "config": {
          "id": 200,
          "addr": "f8:44:77:37:32:70",
          "name": null,
          "obj_id": 1,
          "idx": 0,
          "meta": null
        }
      },
      {
        "key": "bthomesensor:201",
        "status": {
          "id": 201,
          "last_updated_ts": 1070226336
        },
        "config": {
          "id": 201,
          "addr": "f8:44:77:37:32:70",
          "name": null,
          "obj_id": 58,
          "idx": 0,
          "meta": null
        }
      },
      {
        "key": "bthomesensor:202",
        "status": {
          "id": 202,
          "value": 16.0,
          "last_updated_ts": 1731924071
        },
        "config": {
          "id": 202,
          "addr": "f8:44:77:37:32:70",
          "name": null,
          "obj_id": 69,
          "idx": 0,
          "meta": null
        }
      }
    ],
    "cfg_rev": 1137,
    "offset": 0,
    "total": 26
  }
}

`curl -X POST --json '{"id":1,"method":"BluTrv.GetRemoteStatus","params":{"id":201} }' http://192.168.2.52/rpc | jq

{
  "id": 1,
  "src": "shellyblugwg3-8cbfeaa7caf4",
  "result": {
    "v": 17,
    "ts": 1731923738,
    "status": {
      "sys": {
        "time": "10:55",
        "unixtime": 1731923748,
        "offset": 3600,
        "uptime": 933049,
        "ram_size": 30840,
        "ram_free": 15620,
        "cfg_rev": 17,
        "state_rev": 17
      },
      "temperature:0": {
        "id": 0,
        "tC": 22.78,
        "tF": 73.00,
        "errors": []
      },
      "trv:0": {
        "id": 0,
        "pos": 0,
        "steps": 25475452,
        "current_C": 22.78,
        "target_C": 16.00,
        "schedule_rev": 12,
        "errors": []
      }
    }
  }
}

curl -X POST --json '{"id":1,"method":"BluTrv.GetRemoteConfig","params":{"id":201} }' http://192.168.2.52/rpc | jq

{
  "id": 1,
  "src": "shellyblugwg3-8cbfeaa7caf4",
  "result": {
    "v": 22,
    "ts": 1731925210,
    "config": {
      "sys": {
        "device": {
          "name": ""
        },
        "location": {
          "lat": 48.0000,
          "lon": 11.0000
        },
        "ui": {
          "lock": false,
          "t_units": "C",
          "flip": false,
          "brightness": 7
        },
        "ble": {
          "interval_ms": 333,
          "beacon_count": 5
        },
        "cfg_rev": 17
      },
      "temperature:0": {
        "id": 0,
        "offset_C": 0.00
      },
      "trv:0": {
        "id": 0,
        "enable": true,
        "override_enable": false,
        "min_valve_position": 0,
        "default_boost_duration": 1800,
        "default_override_duration": 2147483647,
        "default_override_target_C": 8.00,
        "flags": [
          "accel",
          "auto_calibrate",
          "anticlog"
        ]
      }
    }
  }
}