Skip to main content
Version: 1.0

BTHomeDevice

The BTHomeDevice component stands for an individual physical device identified by its MAC address. It uses BTHomeDevice as RPC namespace and has the following methods:

Methods

BTHomeDevice.SetConfig

PropertyTypeDescription

id

number

Id of the component instance

config

object

Configuration that the method takes

Find more about the config properties in config section

BTHomeDevice.GetConfig

Properties:

PropertyTypeDescription

id

number

Id of the component instance

Find the BTHomeDevice.GetConfig response properties in config section

BTHomeDevice.GetStatus

Properties:

PropertyTypeDescription

id

number

Id of the component instance

Find more about the status response properties in status section

BTHomeDevice.GetKnownObjects

Request

Parameters:

PropertyTypeDescription

id

number

Id of the component instance. Required

info

The new_objects event is triggered upon the discovery of a new sensor. See example event at new_objects example.

Response

Attributes in the result:

PropertyTypeDescription

id

number

Id of the component instance

objects

array of objects

PropertyTypeDescription

obj_id

number

BTHome object id in decimal

idx

number

BTHome object index

component

string or null

Component key if the sensor is managed, otherwise null

Configuration

The configuration of the BTHomeDevice component contains information about its MAC address, display name, id, and meta data. To Get/Set the configuration of the BTHomeDevice component its id must be specified.

Properties:

PropertyTypeDescription

id

number

Id of the component instance

name

string or null

Name of the component instance

addr

string

MAC address of the physical device

key

string or null

AES encryption key as hexadecimal string for encrypted devices

meta

object

Object for storing meta data

ui

object

Properties of how the component will be rendered in the UI

icon

string or null

Allows setting custom icon for the component's card by providing an external hosted image via link.

Status

The status of the BTHomeDevice component contains information about its id, signal strength received with the latest packet, battery percentage of the device, the last packet id and a timestamp for when the packet is received. To obtain the status of the BTHomeDevice component its id must be specified.

Properties:

PropertyTypeDescription

id

number

Id of the component instance

rssi

number or null

Strength of the signal in dBms from the latest packet

battery

number or null

Device's battery percentage

packet_id

number or null

Id of the latest received packet

last_update_ts

number

Unix timestamp of the latest received packet

errors

array of type string

Component error conditions. May contain key_missing_or_bad, decrypt_failed, parse_failed and unencrypted_data.

Examples

BTHomeDevice.SetConfig example

http://192.168.33.1/rpc/BTHomeDevice.SetConfig?id=200&config={"name":"Bathroom temperature"}

Response

{
"restart_required": false
}

BTHomeDevice.GetConfig example

http://192.168.33.1/rpc/BTHomeDevice.GetConfig?id=200

Response

{
"id": 200,
"addr": "3c:2e:f5:71:d5:2a",
"name": "Bathroom temperature",
"key": null,
"meta": null
}

BTHomeDevice.GetStatus example

http://192.168.33.1/rpc/BTHomeDevice.GetStatus?id=200

Response

{
"id": 200,
"rssi": -55,
"battery": 100,
"packet_id": 1,
"last_updated_ts": 1706593991.91
}

BTHomeDevice.GetKnownObjects example

http://192.168.33.1/rpc/BTHomeDevice.GetKnownObjects?id=200

Response

{
"id": 200,
"objects": [
{
"obj_id": 5,
"idx": 3,
"component": "bthomesensor:200"
}
]
}

Events

new_objects example

{
"component": "bthomedevice:200",
"id": 200,
"event": "new_objects",
"ts": 1706593991.91
}