Skip to content

hinzundcode/eq3-bluetooth-thermostat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eq3-bluetooth-thermostat

Use this library to control your "equiva Bluetooth Smart" or "eQ-3 Bluetooth Smart" radiator thermostats with javascript. Works both in the Browser (with Web Bluetooth) and with Node.js (using Bluez, linux only).

At the moment only manual mode is supported, no timers or vacation mode.

Based on the great API write-up in Heckie75/eQ-3-radiator-thermostat.

nodejs library usage

requires a modern Bluez version with BLE support

setup:

$ npm i eq3-bluetooth-thermostat webbluetooth-bluez

minimal example:

const { getStatus } = require("eq3-bluetooth-thermostat");
const { getBluetoothDevice } = require("webbluetooth-bluez");
const dbus = require("dbus");

(async () => {
	let bus = dbus.getBus("system");
	let device = await getBluetoothDevice(bus, address);
	console.log(await getStatus(device));
	bus.disconnect();
})();

web usage

import { serviceUuid, getStatus } from "node_modules/eq3-bluetooth-thermostat/src/thermostat.js";

// ...

let device = await navigator.bluetooth.requestDevice({
	filters: [ { name: "CC-RT-BLE" } ],
	optionalServices: [ serviceUuid ],
});

console.log(await getStatus(device));

See examples/thermostat.html for a more complete example.

bonus: cli tool

$ npm i -g eq3-bluetooth-thermostat webbluetooth-bluez

$ eq3-thermostat
Usage: eq3-thermostat <device address> get-status
                                       set-temperature <temperature>
                                       enable-boost
                                       disable-boost
                                       on
                                       off

$ eq3-thermostat 01:23:45:67:89:AB get-status
{ status:
   { manual: true,
     holiday: false,
     boost: false,
     dst: true,
     openWindow: false,
     lowBattery: false },
  valvePosition: 0,
  targetTemperature: 21.5 }

API

interface Status {
	status: {
		manual: boolean;
		holiday: boolean;
		boost: boolean;
		dst: boolean;
		openWindow: boolean;
		lowBattery: boolean;
	},
	valvePosition: number;
	targetTemperature: number;
}

const serviceUuid: string = "3e135142-654f-9090-134a-a6ff5bb77046";

function getStatus(device: BluetoothDevice): Promise<Status>;
function setTargetTemperature(device: BluetoothDevice, temperature: number): Promise<Status>;
function setBoost(device: BluetoothDevice, enabled: boolean): Promise<Status>;
function request(device: BluetoohDevice, payload: ArrayBuffer): Promise<Status>;

About

control your bluetooth radiator thermostats with javascript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published