refactor
This commit is contained in:
1 parent
0c6d89e38b
commit
44c999437b
38 files changed
+4752
-1426
No files matched your search
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
if [[ ! -d "/mnt/Data/Projects/flic2hass" ]]; then
|
||||
echo "Cannot find source directory; Did you move it?"
|
||||
echo "(Looking for "/mnt/Data/Projects/flic2hass")"
|
||||
echo 'Cannot force reload with this script - use "direnv reload" manually and then try again'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# rebuild the cache forcefully
|
||||
_nix_direnv_force_reload=1 direnv exec "/mnt/Data/Projects/flic2hass" true
|
||||
|
||||
# Update the mtime for .envrc.
|
||||
# This will cause direnv to reload again - but without re-building.
|
||||
touch "/mnt/Data/Projects/flic2hass/.envrc"
|
||||
|
||||
# Also update the timestamp of whatever profile_rc we have.
|
||||
# This makes sure that we know we are up to date.
|
||||
touch -r "/mnt/Data/Projects/flic2hass/.envrc" "/mnt/Data/Projects/flic2hass/.direnv"/*.rc
|
||||
@@ -0,0 +1 @@
|
||||
/nix/store/01x5k4nlxcpyd85nnr0b9gm89rm8ff4x-source
|
||||
@@ -0,0 +1 @@
|
||||
/nix/store/b14gvgfs5i16wq8h26grmxdxa62lnaa7-source
|
||||
@@ -0,0 +1 @@
|
||||
/nix/store/cjjpqrp9xy44j5fjh3mygyxy3i7mslj2-source
|
||||
@@ -0,0 +1 @@
|
||||
/nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source
|
||||
@@ -0,0 +1 @@
|
||||
/nix/store/45gfi0xqahibazd3mwkcbxx18slzjcv7-nix-shell-env
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,6 @@
|
||||
if ! has nix_direnv_version || ! nix_direnv_version 3.1.0; then
|
||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.1.0/direnvrc" "sha256-yMJ2OVMzrFaDPn7q8nCBZFRYpL/f0RcHzhmw/i6btJM="
|
||||
fi
|
||||
|
||||
nix_direnv_manual_reload
|
||||
use flake
|
||||
Generated
+61
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1762844143,
|
||||
"narHash": "sha256-SlybxLZ1/e4T2lb1czEtWVzDCVSTvk9WLwGhmxFmBxI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
outputs = { nixpkgs, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var buttonModule = require('buttons');
|
||||
var ir = require('ir');
|
||||
var flichub = require('flicapp');
|
||||
var hubinfo = require('hubinfo');
|
||||
|
||||
function makeLogger(prefix) {
|
||||
var debugMode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
||||
return {
|
||||
@@ -26,7 +31,7 @@ function makeLogger(prefix) {
|
||||
};
|
||||
}
|
||||
|
||||
function _define_property$3(obj, key, value) {
|
||||
function _define_property$6(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
@@ -39,7 +44,7 @@ function _define_property$3(obj, key, value) {
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _object_spread$3(target) {
|
||||
function _object_spread$6(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
@@ -49,17 +54,44 @@ function _object_spread$3(target) {
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_define_property$3(target, key, source[key]);
|
||||
_define_property$6(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
var makeOptions$2 = function(opt) {
|
||||
return _object_spread$3({
|
||||
var makeOptions$3 = function(opt) {
|
||||
return _object_spread$6({
|
||||
debug: false
|
||||
}, opt);
|
||||
};
|
||||
|
||||
var getDeviceFromButton = function(button) {
|
||||
return {
|
||||
name: button.name,
|
||||
identifiers: [
|
||||
button.serialNumber,
|
||||
button.uuid
|
||||
],
|
||||
manufacturer: "Flic",
|
||||
model: "v".concat(button.flicVersion, "_").concat(button.color.trim().length > 0 ? button.color : "white"),
|
||||
sw_version: String(button.firmwareVersion),
|
||||
hw_version: String(button.flicVersion),
|
||||
serial_number: String(button.serialNumber),
|
||||
configuration_url: "https://hubsdk.flic.io/"
|
||||
};
|
||||
};
|
||||
var genButtonUniqueId = function(bdaddr) {
|
||||
return bdaddr.replace(/:/g, "_");
|
||||
};
|
||||
|
||||
var ENTITIES = {
|
||||
name: [
|
||||
"sensor",
|
||||
{
|
||||
entity_category: "diagnostic",
|
||||
name: "Button Name"
|
||||
}
|
||||
],
|
||||
action: [
|
||||
"sensor",
|
||||
{
|
||||
@@ -81,27 +113,6 @@ var ENTITIES = {
|
||||
device_class: "battery"
|
||||
}
|
||||
],
|
||||
batteryLastUpdate: [
|
||||
"sensor",
|
||||
{
|
||||
entity_category: "diagnostic",
|
||||
expire_after: 5,
|
||||
name: "Battery Last Update Time",
|
||||
device_class: "duration",
|
||||
unit_of_measurement: "s"
|
||||
}
|
||||
],
|
||||
lifeline: [
|
||||
"binary_sensor",
|
||||
{
|
||||
entity_category: "diagnostic",
|
||||
expire_after: 5,
|
||||
name: "Flichub Connected",
|
||||
device_class: "connectivity",
|
||||
unit_of_measurement: "s",
|
||||
payload_not_available: "OFF"
|
||||
}
|
||||
],
|
||||
connected: [
|
||||
"binary_sensor",
|
||||
{
|
||||
@@ -165,31 +176,41 @@ var ENTITIES = {
|
||||
}
|
||||
]
|
||||
};
|
||||
function makeButtonController(ha, buttonModule) {
|
||||
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
||||
options = makeOptions$2(options);
|
||||
var logger = makeLogger("btnc", options.debug);
|
||||
logger.info("Starting Flic ButtonController with", JSON.stringify(options, null, 4));
|
||||
var getDeviceFromButton = function(button) {
|
||||
return {
|
||||
name: button.name,
|
||||
identifiers: [
|
||||
button.serialNumber,
|
||||
button.uuid
|
||||
],
|
||||
manufacturer: "Flic",
|
||||
model: "v".concat(button.flicVersion, "_").concat(button.color.trim().length > 0 ? button.color : "white"),
|
||||
sw: String(button.firmwareVersion),
|
||||
hw: String(button.flicVersion),
|
||||
configuration_url: "https://hubsdk.flic.io/"
|
||||
};
|
||||
};
|
||||
var genButtonUniqueId = function(bdaddr) {
|
||||
return bdaddr.replace(/:/g, "_");
|
||||
};
|
||||
|
||||
function _define_property$5(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _object_spread$5(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === "function") {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_define_property$5(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
var ButtonStateHandler = function(ha, logger) {
|
||||
var registerButton = function(button) {
|
||||
logger.info("Registering", JSON.stringify(button, null, 4));
|
||||
var haDevice = getDeviceFromButton(button);
|
||||
var uniqId = genButtonUniqueId(button.bdaddr);
|
||||
ha.startLifeLine("Button Controller Connected", uniqId, haDevice);
|
||||
Object.keys(ENTITIES).forEach(function(objectId) {
|
||||
var avl = {
|
||||
availability: [
|
||||
@@ -206,9 +227,6 @@ function makeButtonController(ha, buttonModule) {
|
||||
],
|
||||
availability_mode: "all"
|
||||
};
|
||||
if (objectId === "lifeline") {
|
||||
avl = {};
|
||||
}
|
||||
if (objectId === "ready" || objectId == "connected") {
|
||||
avl.availability = [
|
||||
avl.availability[1]
|
||||
@@ -217,100 +235,317 @@ function makeButtonController(ha, buttonModule) {
|
||||
if (ENTITIES[objectId][0] === "device_automation") {
|
||||
avl = {};
|
||||
}
|
||||
ha.registerEntity("Button ".concat(objectId), ENTITIES[objectId][0], genButtonUniqueId(button.bdaddr), objectId, haDevice, _object_spread$3({}, ENTITIES[objectId][1], avl));
|
||||
ha.registerEntity("Button ".concat(objectId), ENTITIES[objectId][0], uniqId, objectId, haDevice, _object_spread$5({}, ENTITIES[objectId][1], avl));
|
||||
});
|
||||
};
|
||||
var deregisterButton = function(button) {
|
||||
logger.info("Deregistering", JSON.stringify(button, null, 4));
|
||||
var deregisterButton = function(bdaddr) {
|
||||
var uniqId = genButtonUniqueId(bdaddr);
|
||||
logger.info("Deregistering", JSON.stringify({
|
||||
bdaddr: bdaddr,
|
||||
uniqId: uniqId
|
||||
}, null, 4));
|
||||
Object.keys(ENTITIES).forEach(function(objectId) {
|
||||
ha.deregisterEntity(ENTITIES[objectId][0], genButtonUniqueId(button.bdaddr), objectId);
|
||||
ha.deregisterEntity(ENTITIES[objectId][0], uniqId, objectId);
|
||||
});
|
||||
};
|
||||
var publishButtonState = function(button, state) {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "state", state);
|
||||
var publishButtonState = function(bdaddr, state) {
|
||||
logger.debug('Updating state for bdaddr="'.concat(bdaddr, '" state=').concat(state));
|
||||
ha.publishState(genButtonUniqueId(bdaddr), "state", state);
|
||||
};
|
||||
var publishButtonAction = function(button, state) {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "action", state);
|
||||
var publishButtonAction = function(bdaddr, state) {
|
||||
var uniqId = genButtonUniqueId(bdaddr);
|
||||
ha.publishState(uniqId, "action", state);
|
||||
logger.debug('Publishing click for bdaddr="'.concat(bdaddr, '" uniqId="').concat(uniqId, '" state=').concat(state));
|
||||
if (state === "click") {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "button_short_press", "ON");
|
||||
ha.publishState(uniqId, "button_short_press", "ON");
|
||||
} else if (state === "double_click") {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "button_double_press", "ON");
|
||||
ha.publishState(uniqId, "button_double_press", "ON");
|
||||
} else if (state === "hold") {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "button_long_press", "ON");
|
||||
ha.publishState(uniqId, "button_long_press", "ON");
|
||||
}
|
||||
};
|
||||
var publishButtonMeta = function(button) {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "battery", button.batteryStatus);
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "batteryLastUpdate", button.batteryTimestamp ? "".concat(Math.round((Date.now() - button.batteryTimestamp) / 1000)) : "unknown");
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "connected", button.connected ? "ON" : "OFF");
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "ready", button.ready ? "ON" : "OFF");
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "activeDisconnect", button.activeDisconnect ? "ON" : "OFF");
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "passive", button.activeDisconnect ? "ON" : "OFF");
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), "lifeline", "ON");
|
||||
var publishButtonMeta = function(bdaddr) {
|
||||
var button = buttonModule.getButton(bdaddr);
|
||||
var uniqId = genButtonUniqueId(button.bdaddr);
|
||||
ha.publishState(uniqId, "name", button.name);
|
||||
ha.publishState(uniqId, "battery", button.batteryStatus);
|
||||
ha.publishState(uniqId, "connected", button.connected ? "ON" : "OFF");
|
||||
ha.publishState(uniqId, "ready", button.ready ? "ON" : "OFF");
|
||||
ha.publishState(uniqId, "activeDisconnect", button.activeDisconnect ? "ON" : "OFF");
|
||||
ha.publishState(uniqId, "passive", button.activeDisconnect ? "ON" : "OFF");
|
||||
ha.publishState(uniqId, "lifeline", "ON");
|
||||
};
|
||||
var addBtn = function(eventName) {
|
||||
return function(obj) {
|
||||
var button = buttonModule.getButton(obj.bdaddr);
|
||||
logger.info(eventName, "upserting", button.name, genButtonUniqueId(button.bdaddr));
|
||||
registerButton(button);
|
||||
};
|
||||
var handleBtnCreation = function(eventName, obj) {
|
||||
var button = buttonModule.getButton(obj.bdaddr);
|
||||
logger.info(eventName, "upserting", button.name, genButtonUniqueId(button.bdaddr));
|
||||
registerButton(button);
|
||||
};
|
||||
var start = function() {
|
||||
logger.info("Starting...");
|
||||
return {
|
||||
addBtn: function(eventName) {
|
||||
return function(o) {
|
||||
return handleBtnCreation(eventName, o);
|
||||
};
|
||||
},
|
||||
addBtnWithObject: function(eventName) {
|
||||
return function(o) {
|
||||
return handleBtnCreation(eventName, o.button);
|
||||
};
|
||||
},
|
||||
publishButtonMeta: publishButtonMeta,
|
||||
publishButtonAction: publishButtonAction,
|
||||
publishButtonState: publishButtonState,
|
||||
registerButton: registerButton,
|
||||
deregisterButton: deregisterButton
|
||||
};
|
||||
};
|
||||
|
||||
function makeButtonController(ha) {
|
||||
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
||||
options = makeOptions$3(options);
|
||||
var logger = makeLogger("btnc", options.debug);
|
||||
logger.info("Starting Flic ButtonController with", JSON.stringify(options, null, 4));
|
||||
var stateHandler = ButtonStateHandler(ha, logger);
|
||||
var setListeners = function() {
|
||||
var resetActiontInv = null;
|
||||
buttonModule.on("buttonAdded", addBtn("buttonAdded"));
|
||||
buttonModule.on("buttonConnected", addBtn("buttonConnected"));
|
||||
buttonModule.on("buttonReady", function(btn) {
|
||||
addBtn("buttonReady")(btn);
|
||||
var button = buttonModule.getButton(btn.bdaddr);
|
||||
publishButtonState(button, "released");
|
||||
publishButtonAction(button, "none");
|
||||
});
|
||||
buttonModule.on("buttonUpdated", addBtn("buttonUpdated"));
|
||||
buttonModule.on("buttonAdded", stateHandler.addBtnWithObject("buttonAdded"));
|
||||
buttonModule.on("buttonUpdated", stateHandler.addBtnWithObject("buttonUpdated"));
|
||||
buttonModule.on("buttonDeleted", function(btn) {
|
||||
logger.debug("buttonDeleted", JSON.stringify(btn, null, 4));
|
||||
deregisterButton(btn);
|
||||
publishButtonMeta(btn);
|
||||
stateHandler.deregisterButton(btn.bdaddr);
|
||||
stateHandler.publishButtonMeta(btn.bdaddr);
|
||||
});
|
||||
buttonModule.on("buttonConnected", stateHandler.addBtn("buttonConnected"));
|
||||
buttonModule.on("buttonReady", function(btn) {
|
||||
stateHandler.addBtn("buttonReady")(btn);
|
||||
stateHandler.publishButtonState(btn.bdaddr, "released");
|
||||
stateHandler.publishButtonAction(btn.bdaddr, "none");
|
||||
});
|
||||
buttonModule.on("buttonDisconnected", function(param) {
|
||||
var bdaddr = param.bdaddr;
|
||||
publishButtonMeta(buttonModule.getButton(bdaddr));
|
||||
stateHandler.publishButtonMeta(bdaddr);
|
||||
});
|
||||
buttonModule.on("buttonDown", function(param) {
|
||||
var bdaddr = param.bdaddr;
|
||||
var btn = buttonModule.getButton(bdaddr);
|
||||
publishButtonState(btn, "pressed");
|
||||
publishButtonMeta(btn);
|
||||
stateHandler.publishButtonState(bdaddr, "pressed");
|
||||
stateHandler.publishButtonMeta(bdaddr);
|
||||
});
|
||||
buttonModule.on("buttonUp", function(param) {
|
||||
var bdaddr = param.bdaddr;
|
||||
var btn = buttonModule.getButton(bdaddr);
|
||||
publishButtonState(btn, "released");
|
||||
publishButtonMeta(btn);
|
||||
stateHandler.publishButtonState(bdaddr, "released");
|
||||
stateHandler.publishButtonMeta(bdaddr);
|
||||
});
|
||||
buttonModule.on("buttonClickOrHold", function(obj) {});
|
||||
buttonModule.on("buttonSingleOrDoubleClickOrHold", function(obj) {
|
||||
if (resetActiontInv !== null) {
|
||||
clearTimeout(resetActiontInv);
|
||||
}
|
||||
var btn = buttonModule.getButton(obj.bdaddr);
|
||||
publishButtonAction(btn, obj.isSingleClick ? "click" : obj.isDoubleClick ? "double_click" : "hold");
|
||||
publishButtonMeta(btn);
|
||||
stateHandler.publishButtonAction(obj.bdaddr, obj.isSingleClick ? "click" : obj.isDoubleClick ? "double_click" : "hold");
|
||||
stateHandler.publishButtonMeta(obj.bdaddr);
|
||||
resetActiontInv = setTimeout(function() {
|
||||
publishButtonAction(btn, "none");
|
||||
stateHandler.publishButtonAction(obj.bdaddr, "none");
|
||||
}, 500);
|
||||
});
|
||||
};
|
||||
var start = function() {
|
||||
logger.info("Starting...");
|
||||
logger.info("Setting listeners...");
|
||||
setListeners();
|
||||
logger.info("Registering all buttons...");
|
||||
buttonModule.getButtons().forEach(registerButton);
|
||||
buttonModule.getButtons().forEach(function(btn) {
|
||||
return stateHandler.registerButton(btn);
|
||||
});
|
||||
setInterval(function() {
|
||||
return buttonModule.getButtons().forEach(publishButtonMeta);
|
||||
logger.debug("Updating button state!");
|
||||
buttonModule.getButtons().forEach(function(btn) {
|
||||
return stateHandler.publishButtonMeta(btn.bdaddr);
|
||||
});
|
||||
}, 3000);
|
||||
logger.info("is up");
|
||||
};
|
||||
return {
|
||||
start: start,
|
||||
publishButtonAction: publishButtonAction,
|
||||
publishButtonMeta: publishButtonMeta,
|
||||
publishButtonState: publishButtonState
|
||||
publishButtonAction: stateHandler.publishButtonAction,
|
||||
publishButtonMeta: stateHandler.publishButtonMeta,
|
||||
publishButtonState: stateHandler.publishButtonState
|
||||
};
|
||||
}
|
||||
|
||||
function _define_property$4(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _object_spread$4(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === "function") {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_define_property$4(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function ownKeys$2(object, enumerableOnly) {
|
||||
var keys = Object.keys(object);
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
var symbols = Object.getOwnPropertySymbols(object);
|
||||
keys.push.apply(keys, symbols);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
function _object_spread_props$2(target, source) {
|
||||
source = source != null ? source : {};
|
||||
if (Object.getOwnPropertyDescriptors) {
|
||||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
||||
} else {
|
||||
ownKeys$2(Object(source)).forEach(function(key) {
|
||||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
var makeOptions$2 = function(opt) {
|
||||
return _object_spread_props$2(_object_spread$4({
|
||||
debug: false
|
||||
}, opt), {
|
||||
topics: _object_spread$4({
|
||||
homeassistant: "homeassistant",
|
||||
flic: "flic"
|
||||
}, opt.topics)
|
||||
});
|
||||
};
|
||||
|
||||
function _define_property$3(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _object_spread$3(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === "function") {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_define_property$3(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function ownKeys$1(object, enumerableOnly) {
|
||||
var keys = Object.keys(object);
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
var symbols = Object.getOwnPropertySymbols(object);
|
||||
keys.push.apply(keys, symbols);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
function _object_spread_props$1(target, source) {
|
||||
source = source != null ? source : {};
|
||||
if (Object.getOwnPropertyDescriptors) {
|
||||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
||||
} else {
|
||||
ownKeys$1(Object(source)).forEach(function(key) {
|
||||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function makeHAmqtt(mqttServer) {
|
||||
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
||||
options = makeOptions$2(options);
|
||||
var logger = makeLogger("mqtt:ha", options.debug);
|
||||
logger.info("starting...", JSON.stringify(options, null, 4));
|
||||
var genFlicPrefix = function(nodeId, objectId) {
|
||||
return "".concat(options.topics.flic, "/").concat(nodeId, "/").concat(objectId);
|
||||
};
|
||||
var genFlicPrefixObject = function(nodeId, objectId) {
|
||||
return {
|
||||
nodeId: nodeId,
|
||||
objectId: objectId,
|
||||
mqttPrefix: genFlicPrefix(nodeId, objectId)
|
||||
};
|
||||
};
|
||||
var genHAPrefix = function(component, nodeId, objectId) {
|
||||
return "".concat(options.topics.homeassistant, "/").concat(component, "/").concat(nodeId, "/").concat(objectId);
|
||||
};
|
||||
var publishState = function(nodeId, objectId, state) {
|
||||
var opt = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
||||
var btntopic = genFlicPrefix(nodeId, objectId);
|
||||
mqttServer.publish(btntopic, state + "", opt);
|
||||
logger.debug(btntopic, state, JSON.stringify(opt));
|
||||
};
|
||||
var registerEntity = function(name, component, nodeId, objectId, device) {
|
||||
var additionalProps = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
|
||||
var configtopic = genHAPrefix(component, nodeId, objectId) + "/config";
|
||||
if (component === "device_automation") {
|
||||
additionalProps.topic = genFlicPrefix(nodeId, objectId);
|
||||
} else {
|
||||
additionalProps.state_topic = genFlicPrefix(nodeId, objectId);
|
||||
}
|
||||
var configObj = _object_spread_props$1(_object_spread$3({
|
||||
name: name
|
||||
}, additionalProps), {
|
||||
unique_id: "Flic_".concat(nodeId, "_").concat(objectId),
|
||||
device: device
|
||||
});
|
||||
mqttServer.publish(configtopic, JSON.stringify(configObj), {
|
||||
retain: true
|
||||
});
|
||||
logger.debug(configtopic, JSON.stringify(configObj, null, 4));
|
||||
};
|
||||
var deregisterEntity = function(component, nodeId, objectId) {
|
||||
var configtopic = genHAPrefix(component, nodeId, objectId) + "/config";
|
||||
mqttServer.publish(configtopic, null, {
|
||||
retain: false
|
||||
});
|
||||
logger.debug(configtopic, null);
|
||||
};
|
||||
var startLifeLine = function(name, nodeId, haDevice) {
|
||||
var topic = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "lifeline";
|
||||
registerEntity(name, "binary_sensor", nodeId, topic, haDevice, {
|
||||
device_class: "connectivity",
|
||||
expire_after: 5,
|
||||
off_delay: 3,
|
||||
entity_category: "diagnostic",
|
||||
payload_available: "ON",
|
||||
payload_not_available: "OFF"
|
||||
});
|
||||
setInterval(function() {
|
||||
publishState(nodeId, topic, "ON");
|
||||
}, 2500);
|
||||
};
|
||||
return {
|
||||
deregisterEntity: deregisterEntity,
|
||||
registerEntity: registerEntity,
|
||||
publishState: publishState,
|
||||
genFlicPrefix: genFlicPrefix,
|
||||
genFlicPrefixObject: genFlicPrefixObject,
|
||||
startLifeLine: startLifeLine
|
||||
};
|
||||
}
|
||||
|
||||
@@ -342,120 +577,7 @@ function _object_spread$2(target) {
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function ownKeys$1(object, enumerableOnly) {
|
||||
var keys = Object.keys(object);
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
var symbols = Object.getOwnPropertySymbols(object);
|
||||
if (enumerableOnly) {
|
||||
symbols = symbols.filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
||||
});
|
||||
}
|
||||
keys.push.apply(keys, symbols);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
function _object_spread_props$1(target, source) {
|
||||
source = source != null ? source : {};
|
||||
if (Object.getOwnPropertyDescriptors) {
|
||||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
||||
} else {
|
||||
ownKeys$1(Object(source)).forEach(function(key) {
|
||||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
var makeOptions$1 = function(opt) {
|
||||
return _object_spread_props$1(_object_spread$2({
|
||||
debug: false
|
||||
}, opt), {
|
||||
topics: _object_spread$2({
|
||||
homeassistant: "homeassistant",
|
||||
flic: "flic"
|
||||
}, opt.topics)
|
||||
});
|
||||
};
|
||||
function makeHAmqtt(mqttServer) {
|
||||
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
||||
options = makeOptions$1(options);
|
||||
var logger = makeLogger("mqtt:ha", options.debug);
|
||||
logger.info("starting...", JSON.stringify(options, null, 4));
|
||||
var genFlicPrefix = function(nodeId, objectId) {
|
||||
return "".concat(options.topics.flic, "/").concat(nodeId, "/").concat(objectId);
|
||||
};
|
||||
var genHAPrefix = function(component, nodeId, objectId) {
|
||||
return "".concat(options.topics.homeassistant, "/").concat(component, "/").concat(nodeId, "/").concat(objectId);
|
||||
};
|
||||
var publishState = function(nodeId, objectId, state) {
|
||||
var opt = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
||||
var btntopic = genFlicPrefix(nodeId, objectId);
|
||||
mqttServer.publish(btntopic, state + "", opt);
|
||||
logger.debug(btntopic, state, JSON.stringify(opt));
|
||||
};
|
||||
var registerEntity = function(name, component, nodeId, objectId, device) {
|
||||
var additionalProps = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
|
||||
var configtopic = genHAPrefix(component, nodeId, objectId) + "/config";
|
||||
if (component === "device_automation") {
|
||||
additionalProps.topic = genFlicPrefix(nodeId, objectId);
|
||||
} else {
|
||||
additionalProps.state_topic = genFlicPrefix(nodeId, objectId);
|
||||
}
|
||||
var configObj = _object_spread_props$1(_object_spread$2({
|
||||
name: name
|
||||
}, additionalProps), {
|
||||
unique_id: "Flic_".concat(nodeId, "_").concat(objectId),
|
||||
device: device
|
||||
});
|
||||
mqttServer.publish(configtopic, JSON.stringify(configObj), {
|
||||
retain: true
|
||||
});
|
||||
logger.debug(configtopic, JSON.stringify(configObj, null, 4));
|
||||
};
|
||||
var deregisterEntity = function(component, nodeId, objectId) {
|
||||
var configtopic = genHAPrefix(component, nodeId, objectId) + "/config";
|
||||
mqttServer.publish(configtopic, null, {
|
||||
retain: false
|
||||
});
|
||||
logger.debug(configtopic, null);
|
||||
};
|
||||
return {
|
||||
deregisterEntity: deregisterEntity,
|
||||
registerEntity: registerEntity,
|
||||
publishState: publishState,
|
||||
genFlicPrefix: genFlicPrefix
|
||||
};
|
||||
}
|
||||
|
||||
function _define_property$1(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _object_spread$1(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === "function") {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_define_property$1(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
var NODE_ID = "FlicHubIR";
|
||||
var NODE_ID$1 = "FlicHubIR";
|
||||
var convertUint32Array2Str = function(arr) {
|
||||
var outStr = [];
|
||||
for(var i = 0; i < arr.length; i++){
|
||||
@@ -469,26 +591,27 @@ var convertStr2Uint32Array = function(s) {
|
||||
return parseInt(v, 32);
|
||||
}));
|
||||
};
|
||||
var makeOptions = function(opt) {
|
||||
return _object_spread$1({
|
||||
var makeOptions$1 = function(opt) {
|
||||
return _object_spread$2({
|
||||
debug: false,
|
||||
uniqueId: "0"
|
||||
}, opt);
|
||||
};
|
||||
var makeIRController = function(ir, ha, mqtt) {
|
||||
var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
||||
options = makeOptions(options);
|
||||
|
||||
var makeIRController = function(ha, mqtt) {
|
||||
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
||||
options = makeOptions$1(options);
|
||||
var logger = makeLogger("ir", options.debug);
|
||||
var haDevice = {
|
||||
name: "IR",
|
||||
manufacturer: "Flic",
|
||||
model: "".concat(NODE_ID).concat(options.uniqueId),
|
||||
model: "".concat(NODE_ID$1).concat(options.uniqueId),
|
||||
identifiers: [
|
||||
"FlicHubIR"
|
||||
],
|
||||
configuration_url: "https://hubsdk.flic.io/"
|
||||
};
|
||||
var nodeId = "".concat(NODE_ID).concat(options.uniqueId);
|
||||
var nodeId = "".concat(NODE_ID$1).concat(options.uniqueId);
|
||||
var LIFELINE_SGINAL = ha.genFlicPrefix(nodeId, "lifeline");
|
||||
var RECORD_SIGNAL_SET = ha.genFlicPrefix(nodeId, "record/set");
|
||||
var VALUE_SIGNAL_SET = ha.genFlicPrefix(nodeId, "signal/set");
|
||||
@@ -512,6 +635,7 @@ var makeIRController = function(ir, ha, mqtt) {
|
||||
start: function start() {
|
||||
logger.info("starting...");
|
||||
logger.debug("setting up entities...");
|
||||
ha.startLifeLine("IR Connnected", nodeId, haDevice);
|
||||
ha.registerEntity("IR Available", "binary_sensor", nodeId, "lifeline", haDevice, {
|
||||
device_class: "connectivity",
|
||||
expire_after: 5,
|
||||
@@ -596,9 +720,6 @@ var makeIRController = function(ir, ha, mqtt) {
|
||||
});
|
||||
logger.debug("subscribing to", set_topics);
|
||||
mqtt.subscribe(set_topics);
|
||||
setInterval(function() {
|
||||
ha.publishState(nodeId, "lifeline", "ON");
|
||||
}, 2500);
|
||||
logger.info("is up");
|
||||
}
|
||||
};
|
||||
@@ -660,7 +781,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
||||
var C = {
|
||||
PROTOCOL_LEVEL: 4,
|
||||
DEF_PORT: 1883,
|
||||
DEF_KEEP_ALIVE: 60 // Default keep_alive (s)
|
||||
DEF_KEEP_ALIVE: 60
|
||||
};
|
||||
/** Control packet types */ var TYPE = {
|
||||
CONNECT: 1,
|
||||
@@ -705,7 +826,7 @@ Uint8Array.prototype.charCodeAt = function(a, b) {
|
||||
this.client = false;
|
||||
this.connected = false;
|
||||
/* if keep_alive is less than the ping interval we need to use
|
||||
a shorter ping interval, otherwise we'll just time out! */ this.ping_interval = this.keep_alive < this.C.PING_INTERVAL ? this.keep_alive - 5 : this.C.PING_INTERVAL;
|
||||
a shorter ping interval, otherwise we'll just time out! */ this.ping_interval = this.keep_alive < this.C.PING_INTERVAL ? this.keep_alive - 5 : this.C.PING_INTERVAL;
|
||||
this.protocol_name = options.protocol_name || "MQTT";
|
||||
this.protocol_level = options.protocol_level || C.PROTOCOL_LEVEL;
|
||||
if (typeof this.client_id == "string") {
|
||||
@@ -779,7 +900,7 @@ if (!Buffer.from) {
|
||||
/** 'public' constants here */ MQTT.prototype.C = {
|
||||
DEF_QOS: 0,
|
||||
CONNECT_TIMEOUT: 10000,
|
||||
PING_INTERVAL: 40 // Server ping interval (s)
|
||||
PING_INTERVAL: 40
|
||||
};
|
||||
/* Utility functions ***************************/ var fromCharCode = String.fromCharCode;
|
||||
/** MQTT string (length MSB, LSB + data) */ function mqttStr(s) {
|
||||
@@ -871,7 +992,7 @@ function mqttInt2Str(arr) {
|
||||
pakId = pakId > 65534 ? 1 : ++pakId;
|
||||
return [
|
||||
pakId >> 8,
|
||||
pakId & 0xFF
|
||||
pakId & 0xff
|
||||
];
|
||||
}
|
||||
/** Get PID from message */ function getPid(data) {
|
||||
@@ -926,11 +1047,6 @@ MQTT.prototype.packetHandler = function(data) {
|
||||
this.partData = data;
|
||||
return;
|
||||
}
|
||||
// Allow zero-size pData, but detect if its indexes
|
||||
// will go out of bounds.
|
||||
if (1 + dLen.lenBy >= data.length) {
|
||||
return;
|
||||
}
|
||||
// Get the data for this packet
|
||||
var pData = data.slice(1 + dLen.lenBy, pLen);
|
||||
// more than one packet? re-emit it so we handle it later
|
||||
@@ -1089,11 +1205,11 @@ MQTT.prototype.packetHandler = function(data) {
|
||||
this.client = false;
|
||||
};
|
||||
/** Publish message using specified topic.
|
||||
opts = {
|
||||
retain: bool // the server should retain this message and send it out again to new subscribers
|
||||
dup : bool // indicate the message is a duplicate because original wasn't ACKed (QoS > 0 only)
|
||||
}
|
||||
*/ MQTT.prototype.publish = function(topic, message, opts) {
|
||||
opts = {
|
||||
retain: bool // the server should retain this message and send it out again to new subscribers
|
||||
dup : bool // indicate the message is a duplicate because original wasn't ACKed (QoS > 0 only)
|
||||
}
|
||||
*/ MQTT.prototype.publish = function(topic, message, opts) {
|
||||
if (!this.client) return;
|
||||
opts = opts || {};
|
||||
try {
|
||||
@@ -1193,6 +1309,117 @@ MQTT.prototype.packetHandler = function(data) {
|
||||
return new MQTT(server, options);
|
||||
}
|
||||
|
||||
function _define_property$1(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _object_spread$1(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === "function") {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_define_property$1(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
var NODE_ID = "FlicHub";
|
||||
var makeOptions = function(opt) {
|
||||
return _object_spread$1({
|
||||
debug: false,
|
||||
uniqueId: "0"
|
||||
}, opt);
|
||||
};
|
||||
var getHADevice = function(options) {
|
||||
return {
|
||||
name: "FlicHub (".concat(options.uniqueId, ")"),
|
||||
manufacturer: "Flic",
|
||||
model: "".concat(NODE_ID).concat(options.uniqueId),
|
||||
identifiers: [
|
||||
"FlicHub"
|
||||
],
|
||||
configuration_url: "https://hubsdk.flic.io/",
|
||||
sw_version: hubinfo.firmwareVersion,
|
||||
serial_number: hubinfo.serialNumber
|
||||
};
|
||||
};
|
||||
var getConstants = function(ha, options) {
|
||||
var nodeId = "".concat(NODE_ID).concat(options.uniqueId);
|
||||
return {
|
||||
NODE_ID: nodeId,
|
||||
LIFELINE_SGINAL: ha.genFlicPrefixObject(nodeId, "lifeline"),
|
||||
MESSAGE: ha.genFlicPrefixObject(nodeId, "action-message"),
|
||||
COMMAND_TOPIC: function(virtualId) {
|
||||
return ha.genFlicPrefixObject(nodeId, "virt-command-".concat(virtualId));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var genVirtualDeviceObjectId = function(param) {
|
||||
var virtualDeviceId = param.virtualDeviceId, dimmableType = param.dimmableType;
|
||||
return "virt-".concat(dimmableType, "-").concat(virtualDeviceId).toLowerCase();
|
||||
};
|
||||
var VirtualDeviceType2HAComponent = {
|
||||
Blind: "cover",
|
||||
Light: "light",
|
||||
Speaker: "media_player"
|
||||
};
|
||||
var virtualDeviceUpdateHandler = function(ha, logger, haDevice, nodeId, update, commandTopic, availability) {
|
||||
var objectId = genVirtualDeviceObjectId(update.metaData);
|
||||
var mqttPrefix = ha.genFlicPrefixObject(nodeId, objectId);
|
||||
logger.info("Handling update for ".concat(update, " on ").concat(haDevice));
|
||||
ha.registerEntity(update.metaData.virtualDeviceId, VirtualDeviceType2HAComponent[update.metaData.dimmableType], mqttPrefix.nodeId, mqttPrefix.objectId, haDevice, {
|
||||
availability: availability,
|
||||
command_topic: commandTopic
|
||||
});
|
||||
ha.publishState(mqttPrefix.nodeId, mqttPrefix.objectId, {
|
||||
brightness: update.values.brightness * 255
|
||||
});
|
||||
};
|
||||
|
||||
var startFlicHubController = function(ha, mqtt) {
|
||||
var _options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
||||
var options = makeOptions(_options);
|
||||
var logger = makeLogger("flichub", options.debug);
|
||||
var haDevice = getHADevice(options);
|
||||
var constants = getConstants(ha, options);
|
||||
var availability = [
|
||||
{
|
||||
payload_available: "ON",
|
||||
payload_not_available: "unavailable",
|
||||
topic: constants.LIFELINE_SGINAL.mqttPrefix
|
||||
}
|
||||
];
|
||||
logger.info("starting...");
|
||||
logger.debug("setting up entities...");
|
||||
ha.startLifeLine("FlicHub Connected", constants.NODE_ID, haDevice, constants.LIFELINE_SGINAL.objectId);
|
||||
ha.registerEntity("Action Message", "sensor", constants.NODE_ID, constants.MESSAGE.objectId, haDevice, {
|
||||
icon: "mdi:message",
|
||||
availability: availability
|
||||
});
|
||||
ha.publishState(constants.NODE_ID, constants.MESSAGE.objectId, "");
|
||||
flichub.on("actionMessage", function(obj) {
|
||||
ha.publishState(constants.NODE_ID, constants.MESSAGE.objectId, obj);
|
||||
});
|
||||
flichub.on("virtualDeviceUpdate", function(update) {
|
||||
return virtualDeviceUpdateHandler(ha, logger, haDevice, constants.NODE_ID, update, constants.COMMAND_TOPIC(update.metaData.virtualDeviceId), availability);
|
||||
});
|
||||
};
|
||||
|
||||
function _define_property(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
@@ -1225,11 +1452,6 @@ function ownKeys(object, enumerableOnly) {
|
||||
var keys = Object.keys(object);
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
var symbols = Object.getOwnPropertySymbols(object);
|
||||
if (enumerableOnly) {
|
||||
symbols = symbols.filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
||||
});
|
||||
}
|
||||
keys.push.apply(keys, symbols);
|
||||
}
|
||||
return keys;
|
||||
@@ -1245,7 +1467,7 @@ function _object_spread_props(target, source) {
|
||||
}
|
||||
return target;
|
||||
}
|
||||
var start = function(buttonModule, irModule, options) {
|
||||
var start = function(options) {
|
||||
var mqttServer = create(options.mqtt.host, _object_spread_props(_object_spread({}, options.mqtt), {
|
||||
keep_alive: true
|
||||
}));
|
||||
@@ -1257,21 +1479,28 @@ var start = function(buttonModule, irModule, options) {
|
||||
options.flicBtns = (_options_flicBtns = options.flicBtns) !== null && _options_flicBtns !== void 0 ? _options_flicBtns : {};
|
||||
var _options_flicIR;
|
||||
options.flicIR = (_options_flicIR = options.flicIR) !== null && _options_flicIR !== void 0 ? _options_flicIR : {};
|
||||
var _options_flicHub;
|
||||
options.flicHub = (_options_flicHub = options.flicHub) !== null && _options_flicHub !== void 0 ? _options_flicHub : {};
|
||||
var _options_ha_debug, _ref;
|
||||
options.ha.debug = (_ref = (_options_ha_debug = options.ha.debug) !== null && _options_ha_debug !== void 0 ? _options_ha_debug : options.debug) !== null && _ref !== void 0 ? _ref : false;
|
||||
var _options_flicBtns_debug, _ref1;
|
||||
options.flicBtns.debug = (_ref1 = (_options_flicBtns_debug = options.flicBtns.debug) !== null && _options_flicBtns_debug !== void 0 ? _options_flicBtns_debug : options.debug) !== null && _ref1 !== void 0 ? _ref1 : false;
|
||||
var _options_flicBtns_debug1, _ref2;
|
||||
options.flicIR.debug = (_ref2 = (_options_flicBtns_debug1 = options.flicBtns.debug) !== null && _options_flicBtns_debug1 !== void 0 ? _options_flicBtns_debug1 : options.debug) !== null && _ref2 !== void 0 ? _ref2 : false;
|
||||
var _options_flicIR_debug, _ref2;
|
||||
options.flicIR.debug = (_ref2 = (_options_flicIR_debug = options.flicIR.debug) !== null && _options_flicIR_debug !== void 0 ? _options_flicIR_debug : options.debug) !== null && _ref2 !== void 0 ? _ref2 : false;
|
||||
var _options_flicHub_debug, _ref3;
|
||||
options.flicHub.debug = (_ref3 = (_options_flicHub_debug = options.flicHub.debug) !== null && _options_flicHub_debug !== void 0 ? _options_flicHub_debug : options.debug) !== null && _ref3 !== void 0 ? _ref3 : false;
|
||||
var ha = makeHAmqtt(mqttServer, options.ha);
|
||||
mqttServer.on("connected", function() {
|
||||
var _options_flicBtns, _options_flicIR;
|
||||
var _options_flicBtns, _options_flicIR, _options_flicHub;
|
||||
logger.info("connected to mqtt");
|
||||
if (!((_options_flicBtns = options.flicBtns) === null || _options_flicBtns === void 0 ? void 0 : _options_flicBtns.disabled)) {
|
||||
makeButtonController(ha, buttonModule, options.flicBtns).start();
|
||||
makeButtonController(ha, options.flicBtns).start();
|
||||
}
|
||||
if (!((_options_flicIR = options.flicIR) === null || _options_flicIR === void 0 ? void 0 : _options_flicIR.disabled)) {
|
||||
makeIRController(irModule, ha, mqttServer, options.flicIR).start();
|
||||
makeIRController(ha, mqttServer, options.flicIR).start();
|
||||
}
|
||||
if (!((_options_flicHub = options.flicHub) === null || _options_flicHub === void 0 ? void 0 : _options_flicHub.disabled)) {
|
||||
startFlicHubController(ha, mqttServer, options.flicHub);
|
||||
}
|
||||
logger.info("all services up!");
|
||||
});
|
||||
|
||||
Generated
+465
-139
@@ -70,156 +70,308 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/rollup-android-arm-eabi": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.2.0.tgz",
|
||||
"integrity": "sha512-8PlggAxGxavr+pkCNeV1TM2wTb2o+cUWDg9M1cm9nR27Dsn287uZtSLYXoQqQcmq+sYfF7lHfd3sWJJinH9GmA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.2.tgz",
|
||||
"integrity": "sha512-yDPzwsgiFO26RJA4nZo8I+xqzh7sJTZIWQOxn+/XOdPE31lAvLIYCKqjV+lNH/vxE2L2iH3plKxDCRK6i+CwhA==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-android-arm64": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.2.0.tgz",
|
||||
"integrity": "sha512-+71T85hbMFrJI+zKQULNmSYBeIhru55PYoF/u75MyeN2FcxE4HSPw20319b+FcZ4lWx2Nx/Ql9tN+hoaD3GH/A==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.2.tgz",
|
||||
"integrity": "sha512-k8FontTxIE7b0/OGKeSN5B6j25EuppBcWM33Z19JoVT7UTXFSo3D9CdU39wGTeb29NO3XxpMNauh09B+Ibw+9g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-darwin-arm64": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.2.0.tgz",
|
||||
"integrity": "sha512-IIIQLuG43QIElT1JZqUP/zqIdiJl4t9U/boa0GZnQTw9m1X0k3mlBuysbgYXeloLT1RozdL7bgw4lpSaI8GOXw==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.2.tgz",
|
||||
"integrity": "sha512-A6s4gJpomNBtJ2yioj8bflM2oogDwzUiMl2yNJ2v9E7++sHrSrsQ29fOfn5DM/iCzpWcebNYEdXpaK4tr2RhfQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-darwin-x64": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.2.0.tgz",
|
||||
"integrity": "sha512-BXcXvnLaea1Xz900omrGJhxHFJfH9jZ0CpJuVsbjjhpniJ6qiLXz3xA8Lekaa4MuhFcJd4f0r+Ky1G4VFbYhWw==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.2.tgz",
|
||||
"integrity": "sha512-e6XqVmXlHrBlG56obu9gDRPW3O3hLxpwHpLsBJvuI8qqnsrtSZ9ERoWUXtPOkY8c78WghyPHZdmPhHLWNdAGEw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-freebsd-arm64": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.2.tgz",
|
||||
"integrity": "sha512-v0E9lJW8VsrwPux5Qe5CwmH/CF/2mQs6xU1MF3nmUxmZUCHazCjLgYvToOk+YuuUqLQBio1qkkREhxhc656ViA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-freebsd-x64": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.2.tgz",
|
||||
"integrity": "sha512-ClAmAPx3ZCHtp6ysl4XEhWU69GUB1D+s7G9YjHGhIGCSrsg00nEGRRZHmINYxkdoJehde8VIsDC5t9C0gb6yqA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.2.0.tgz",
|
||||
"integrity": "sha512-f4K3MKw9Y4AKi4ANGnmPIglr+S+8tO858YrGVuqAHXxJdVghBmz9CPU9kDpOnGvT4g4vg5uNyIFpOOFvffXyMA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.2.tgz",
|
||||
"integrity": "sha512-EPlb95nUsz6Dd9Qy13fI5kUPXNSljaG9FiJ4YUGU1O/Q77i5DYFW5KR8g1OzTcdZUqQQ1KdDqsTohdFVwCwjqg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm-musleabihf": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.2.tgz",
|
||||
"integrity": "sha512-BOmnVW+khAUX+YZvNfa0tGTEMVVEerOxN0pDk2E6N6DsEIa2Ctj48FOMfNDdrwinocKaC7YXUZ1pHlKpnkja/Q==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm64-gnu": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.2.0.tgz",
|
||||
"integrity": "sha512-bNsTYQBgp4H7w6cT7FZhesxpcUPahsSIy4NgdZjH1ZwEoZHxi4XKglj+CsSEkhsKi+x6toVvMylhjRKhEMYfnA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-Xt2byDZ+6OVNuREgBXr4+CZDJtrVso5woFtpKdGPhpTPHcNG7D8YXeQzpNbFRxzTVqJf7kvPMCub/pcGUWgBjA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm64-musl": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.2.0.tgz",
|
||||
"integrity": "sha512-Jp1NxBJpGLuxRU2ihrQk4IZ+ia5nffobG6sOFUPW5PMYkF0kQtxEbeDuCa69Xif211vUOcxlOnf5IOEIpTEySA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.2.tgz",
|
||||
"integrity": "sha512-+LdZSldy/I9N8+klim/Y1HsKbJ3BbInHav5qE9Iy77dtHC/pibw1SR/fXlWyAk0ThnpRKoODwnAuSjqxFRDHUQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-loong64-gnu": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-8ms8sjmyc1jWJS6WdNSA23rEfdjWB30LH8Wqj0Cqvv7qSHnvw6kgMMXRdop6hkmGPlyYBdRPkjJnj3KCUHV/uQ==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-ppc64-gnu": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-3HRQLUQbpBDMmzoxPJYd3W6vrVHOo2cVW8RUo87Xz0JPJcBLBr5kZ1pGcQAhdZgX9VV7NbGNipah1omKKe23/g==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-riscv64-gnu": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-fMjKi+ojnmIvhk34gZP94vjogXNNUKMEYs+EDaB/5TG/wUkoeua7p7VCHnE6T2Tx+iaghAqQX8teQzcvrYpaQA==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-riscv64-musl": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.2.tgz",
|
||||
"integrity": "sha512-XuGFGU+VwUUV5kLvoAdi0Wz5Xbh2SrjIxCtZj6Wq8MDp4bflb/+ThZsVxokM7n0pcbkEr2h5/pzqzDYI7cCgLQ==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-s390x-gnu": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-w6yjZF0P+NGzWR3AXWX9zc0DNEGdtvykB03uhonSHMRa+oWA6novflo2WaJr6JZakG2ucsyb+rvhrKac6NIy+w==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-x64-gnu": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.2.0.tgz",
|
||||
"integrity": "sha512-3p3iRtQmv2aXw+vtKNyZMLOQ+LSRsqArXjKAh2Oj9cqwfIRe7OXvdkOzWfZOIp1F/x5KJzVAxGxnniF4cMbnsQ==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-yo8d6tdfdeBArzC7T/PnHd7OypfI9cbuZzPnzLJIyKYFhAQ8SvlkKtKBMbXDxe1h03Rcr7u++nFS7tqXz87Gtw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-x64-musl": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.2.0.tgz",
|
||||
"integrity": "sha512-atih7IF/reUZe4LBLC5Izd44hth2tfDIG8LaPp4/cQXdHh9jabcZEvIeRPrpDq0i/Uu487Qu5gl5KwyAnWajnw==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.2.tgz",
|
||||
"integrity": "sha512-ah59c1YkCxKExPP8O9PwOvs+XRLKwh/mV+3YdKqQ5AMQ0r4M4ZDuOrpWkUaqO7fzAHdINzV9tEVu8vNw48z0lA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-arm64-msvc": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.2.0.tgz",
|
||||
"integrity": "sha512-vYxF3tKJeUE4ceYzpNe2p84RXk/fGK30I8frpRfv/MyPStej/mRlojztkN7Jtd1014HHVeq/tYaMBz/3IxkxZw==",
|
||||
"node_modules/@rollup/rollup-openharmony-arm64": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.2.tgz",
|
||||
"integrity": "sha512-4VEd19Wmhr+Zy7hbUsFZ6YXEiP48hE//KPLCSVNY5RMGX2/7HZ+QkN55a3atM1C/BZCGIgqN+xrVgtdak2S9+A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openharmony"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-arm64-msvc": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.2.tgz",
|
||||
"integrity": "sha512-IlbHFYc/pQCgew/d5fslcy1KEaYVCJ44G8pajugd8VoOEI8ODhtb/j8XMhLpwHCMB3yk2J07ctup10gpw2nyMA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-ia32-msvc": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.2.0.tgz",
|
||||
"integrity": "sha512-1LZJ6zpl93SaPQvas618bMFarVwufWTaczH4ESAbFcwiC4OtznA6Ym+hFPyIGaJaGEB8uMWWac0uXGPXOg5FGA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.2.tgz",
|
||||
"integrity": "sha512-lNlPEGgdUfSzdCWU176ku/dQRnA7W+Gp8d+cWv73jYrb8uT7HTVVxq62DUYxjbaByuf1Yk0RIIAbDzp+CnOTFg==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-x64-gnu": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-S6YojNVrHybQis2lYov1sd+uj7K0Q05NxHcGktuMMdIQ2VixGwAfbJ23NnlvvVV1bdpR2m5MsNBViHJKcA4ADw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.2.0.tgz",
|
||||
"integrity": "sha512-dgQfFdHCNg08nM5zBmqxqc9vrm0DVzhWotpavbPa0j4//MAOKZEB75yGAfzQE9fUJ+4pvM1239Y4IhL8f6sSog==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.2.tgz",
|
||||
"integrity": "sha512-k+/Rkcyx//P6fetPoLMb8pBeqJBNGx81uuf7iljX9++yNBVRDQgD04L+SVXmXmh5ZP4/WOp4mWF0kmi06PW2tA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
@@ -238,14 +390,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/cli": {
|
||||
"version": "0.1.62",
|
||||
"resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.1.62.tgz",
|
||||
"integrity": "sha512-kOFLjKY3XH1DWLfXL1/B5MizeNorHR8wHKEi92S/Zi9Md/AK17KSqR8MgyRJ6C1fhKHvbBCl8wboyKAFXStkYw==",
|
||||
"version": "0.1.65",
|
||||
"resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.1.65.tgz",
|
||||
"integrity": "sha512-4NcgsvJVHhA7trDnMmkGLLvWMHu2kSy+qHx6QwRhhJhdiYdNUrhdp+ERxen73sYtaeEOYeLJcWrQ60nzKi6rpg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@mole-inc/bin-wrapper": "^8.0.1",
|
||||
"commander": "^7.1.0",
|
||||
"fast-glob": "^3.2.5",
|
||||
"minimatch": "^9.0.3",
|
||||
"semver": "^7.3.8",
|
||||
"slash": "3.0.0",
|
||||
"source-map": "^0.7.3"
|
||||
@@ -508,6 +662,13 @@
|
||||
"@types/responselike": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
|
||||
"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/http-cache-semantics": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz",
|
||||
@@ -561,6 +722,13 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/bin-check": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bin-check/-/bin-check-4.1.0.tgz",
|
||||
@@ -608,10 +776,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/bin-version/node_modules/cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
@@ -725,13 +894,24 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/braces": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
|
||||
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fill-range": "^7.0.1"
|
||||
"balanced-match": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/braces": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fill-range": "^7.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@@ -1007,10 +1187,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/fill-range": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"to-regex-range": "^5.0.1"
|
||||
},
|
||||
@@ -1173,6 +1354,7 @@
|
||||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
||||
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.12.0"
|
||||
}
|
||||
@@ -1251,12 +1433,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/micromatch": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz",
|
||||
"integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==",
|
||||
"version": "4.0.8",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
|
||||
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"braces": "^3.0.2",
|
||||
"braces": "^3.0.3",
|
||||
"picomatch": "^2.3.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1290,6 +1473,22 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "9.0.5",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
|
||||
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/normalize-url": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz",
|
||||
@@ -1518,10 +1717,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.2.0.tgz",
|
||||
"integrity": "sha512-deaMa9Z+jPVeBD2dKXv+h7EbdKte9++V2potc/ADqvVgEr6DEJ3ia9u0joarjC2lX/ubaCRYz3QVx0TzuVqAJA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.2.tgz",
|
||||
"integrity": "sha512-MHngMYwGJVi6Fmnk6ISmnk7JAHRNF0UkuucA0CUW3N3a4KnONPEZz+vUanQP/ZC/iY1Qkf3bwPWzyY84wEks1g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.8"
|
||||
},
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
},
|
||||
@@ -1530,18 +1733,28 @@
|
||||
"npm": ">=8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-android-arm-eabi": "4.2.0",
|
||||
"@rollup/rollup-android-arm64": "4.2.0",
|
||||
"@rollup/rollup-darwin-arm64": "4.2.0",
|
||||
"@rollup/rollup-darwin-x64": "4.2.0",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.2.0",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.2.0",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.2.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.2.0",
|
||||
"@rollup/rollup-linux-x64-musl": "4.2.0",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.2.0",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.2.0",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.2.0",
|
||||
"@rollup/rollup-android-arm-eabi": "4.53.2",
|
||||
"@rollup/rollup-android-arm64": "4.53.2",
|
||||
"@rollup/rollup-darwin-arm64": "4.53.2",
|
||||
"@rollup/rollup-darwin-x64": "4.53.2",
|
||||
"@rollup/rollup-freebsd-arm64": "4.53.2",
|
||||
"@rollup/rollup-freebsd-x64": "4.53.2",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.53.2",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.53.2",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.53.2",
|
||||
"@rollup/rollup-linux-loong64-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-ppc64-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-riscv64-musl": "4.53.2",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-x64-musl": "4.53.2",
|
||||
"@rollup/rollup-openharmony-arm64": "4.53.2",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.53.2",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.53.2",
|
||||
"@rollup/rollup-win32-x64-gnu": "4.53.2",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.53.2",
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
@@ -1778,6 +1991,7 @@
|
||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-number": "^7.0.0"
|
||||
},
|
||||
@@ -1908,86 +2122,156 @@
|
||||
}
|
||||
},
|
||||
"@rollup/rollup-android-arm-eabi": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.2.0.tgz",
|
||||
"integrity": "sha512-8PlggAxGxavr+pkCNeV1TM2wTb2o+cUWDg9M1cm9nR27Dsn287uZtSLYXoQqQcmq+sYfF7lHfd3sWJJinH9GmA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.2.tgz",
|
||||
"integrity": "sha512-yDPzwsgiFO26RJA4nZo8I+xqzh7sJTZIWQOxn+/XOdPE31lAvLIYCKqjV+lNH/vxE2L2iH3plKxDCRK6i+CwhA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-android-arm64": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.2.0.tgz",
|
||||
"integrity": "sha512-+71T85hbMFrJI+zKQULNmSYBeIhru55PYoF/u75MyeN2FcxE4HSPw20319b+FcZ4lWx2Nx/Ql9tN+hoaD3GH/A==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.2.tgz",
|
||||
"integrity": "sha512-k8FontTxIE7b0/OGKeSN5B6j25EuppBcWM33Z19JoVT7UTXFSo3D9CdU39wGTeb29NO3XxpMNauh09B+Ibw+9g==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-darwin-arm64": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.2.0.tgz",
|
||||
"integrity": "sha512-IIIQLuG43QIElT1JZqUP/zqIdiJl4t9U/boa0GZnQTw9m1X0k3mlBuysbgYXeloLT1RozdL7bgw4lpSaI8GOXw==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.2.tgz",
|
||||
"integrity": "sha512-A6s4gJpomNBtJ2yioj8bflM2oogDwzUiMl2yNJ2v9E7++sHrSrsQ29fOfn5DM/iCzpWcebNYEdXpaK4tr2RhfQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-darwin-x64": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.2.0.tgz",
|
||||
"integrity": "sha512-BXcXvnLaea1Xz900omrGJhxHFJfH9jZ0CpJuVsbjjhpniJ6qiLXz3xA8Lekaa4MuhFcJd4f0r+Ky1G4VFbYhWw==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.2.tgz",
|
||||
"integrity": "sha512-e6XqVmXlHrBlG56obu9gDRPW3O3hLxpwHpLsBJvuI8qqnsrtSZ9ERoWUXtPOkY8c78WghyPHZdmPhHLWNdAGEw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-freebsd-arm64": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.2.tgz",
|
||||
"integrity": "sha512-v0E9lJW8VsrwPux5Qe5CwmH/CF/2mQs6xU1MF3nmUxmZUCHazCjLgYvToOk+YuuUqLQBio1qkkREhxhc656ViA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-freebsd-x64": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.2.tgz",
|
||||
"integrity": "sha512-ClAmAPx3ZCHtp6ysl4XEhWU69GUB1D+s7G9YjHGhIGCSrsg00nEGRRZHmINYxkdoJehde8VIsDC5t9C0gb6yqA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-linux-arm-gnueabihf": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.2.0.tgz",
|
||||
"integrity": "sha512-f4K3MKw9Y4AKi4ANGnmPIglr+S+8tO858YrGVuqAHXxJdVghBmz9CPU9kDpOnGvT4g4vg5uNyIFpOOFvffXyMA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.2.tgz",
|
||||
"integrity": "sha512-EPlb95nUsz6Dd9Qy13fI5kUPXNSljaG9FiJ4YUGU1O/Q77i5DYFW5KR8g1OzTcdZUqQQ1KdDqsTohdFVwCwjqg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-linux-arm-musleabihf": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.2.tgz",
|
||||
"integrity": "sha512-BOmnVW+khAUX+YZvNfa0tGTEMVVEerOxN0pDk2E6N6DsEIa2Ctj48FOMfNDdrwinocKaC7YXUZ1pHlKpnkja/Q==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-linux-arm64-gnu": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.2.0.tgz",
|
||||
"integrity": "sha512-bNsTYQBgp4H7w6cT7FZhesxpcUPahsSIy4NgdZjH1ZwEoZHxi4XKglj+CsSEkhsKi+x6toVvMylhjRKhEMYfnA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-Xt2byDZ+6OVNuREgBXr4+CZDJtrVso5woFtpKdGPhpTPHcNG7D8YXeQzpNbFRxzTVqJf7kvPMCub/pcGUWgBjA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-linux-arm64-musl": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.2.0.tgz",
|
||||
"integrity": "sha512-Jp1NxBJpGLuxRU2ihrQk4IZ+ia5nffobG6sOFUPW5PMYkF0kQtxEbeDuCa69Xif211vUOcxlOnf5IOEIpTEySA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.2.tgz",
|
||||
"integrity": "sha512-+LdZSldy/I9N8+klim/Y1HsKbJ3BbInHav5qE9Iy77dtHC/pibw1SR/fXlWyAk0ThnpRKoODwnAuSjqxFRDHUQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-linux-loong64-gnu": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-8ms8sjmyc1jWJS6WdNSA23rEfdjWB30LH8Wqj0Cqvv7qSHnvw6kgMMXRdop6hkmGPlyYBdRPkjJnj3KCUHV/uQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-linux-ppc64-gnu": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-3HRQLUQbpBDMmzoxPJYd3W6vrVHOo2cVW8RUo87Xz0JPJcBLBr5kZ1pGcQAhdZgX9VV7NbGNipah1omKKe23/g==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-linux-riscv64-gnu": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-fMjKi+ojnmIvhk34gZP94vjogXNNUKMEYs+EDaB/5TG/wUkoeua7p7VCHnE6T2Tx+iaghAqQX8teQzcvrYpaQA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-linux-riscv64-musl": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.2.tgz",
|
||||
"integrity": "sha512-XuGFGU+VwUUV5kLvoAdi0Wz5Xbh2SrjIxCtZj6Wq8MDp4bflb/+ThZsVxokM7n0pcbkEr2h5/pzqzDYI7cCgLQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-linux-s390x-gnu": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-w6yjZF0P+NGzWR3AXWX9zc0DNEGdtvykB03uhonSHMRa+oWA6novflo2WaJr6JZakG2ucsyb+rvhrKac6NIy+w==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-linux-x64-gnu": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.2.0.tgz",
|
||||
"integrity": "sha512-3p3iRtQmv2aXw+vtKNyZMLOQ+LSRsqArXjKAh2Oj9cqwfIRe7OXvdkOzWfZOIp1F/x5KJzVAxGxnniF4cMbnsQ==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-yo8d6tdfdeBArzC7T/PnHd7OypfI9cbuZzPnzLJIyKYFhAQ8SvlkKtKBMbXDxe1h03Rcr7u++nFS7tqXz87Gtw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-linux-x64-musl": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.2.0.tgz",
|
||||
"integrity": "sha512-atih7IF/reUZe4LBLC5Izd44hth2tfDIG8LaPp4/cQXdHh9jabcZEvIeRPrpDq0i/Uu487Qu5gl5KwyAnWajnw==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.2.tgz",
|
||||
"integrity": "sha512-ah59c1YkCxKExPP8O9PwOvs+XRLKwh/mV+3YdKqQ5AMQ0r4M4ZDuOrpWkUaqO7fzAHdINzV9tEVu8vNw48z0lA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-openharmony-arm64": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.2.tgz",
|
||||
"integrity": "sha512-4VEd19Wmhr+Zy7hbUsFZ6YXEiP48hE//KPLCSVNY5RMGX2/7HZ+QkN55a3atM1C/BZCGIgqN+xrVgtdak2S9+A==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-win32-arm64-msvc": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.2.0.tgz",
|
||||
"integrity": "sha512-vYxF3tKJeUE4ceYzpNe2p84RXk/fGK30I8frpRfv/MyPStej/mRlojztkN7Jtd1014HHVeq/tYaMBz/3IxkxZw==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.2.tgz",
|
||||
"integrity": "sha512-IlbHFYc/pQCgew/d5fslcy1KEaYVCJ44G8pajugd8VoOEI8ODhtb/j8XMhLpwHCMB3yk2J07ctup10gpw2nyMA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-win32-ia32-msvc": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.2.0.tgz",
|
||||
"integrity": "sha512-1LZJ6zpl93SaPQvas618bMFarVwufWTaczH4ESAbFcwiC4OtznA6Ym+hFPyIGaJaGEB8uMWWac0uXGPXOg5FGA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.2.tgz",
|
||||
"integrity": "sha512-lNlPEGgdUfSzdCWU176ku/dQRnA7W+Gp8d+cWv73jYrb8uT7HTVVxq62DUYxjbaByuf1Yk0RIIAbDzp+CnOTFg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-win32-x64-gnu": {
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.2.tgz",
|
||||
"integrity": "sha512-S6YojNVrHybQis2lYov1sd+uj7K0Q05NxHcGktuMMdIQ2VixGwAfbJ23NnlvvVV1bdpR2m5MsNBViHJKcA4ADw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@rollup/rollup-win32-x64-msvc": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.2.0.tgz",
|
||||
"integrity": "sha512-dgQfFdHCNg08nM5zBmqxqc9vrm0DVzhWotpavbPa0j4//MAOKZEB75yGAfzQE9fUJ+4pvM1239Y4IhL8f6sSog==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.2.tgz",
|
||||
"integrity": "sha512-k+/Rkcyx//P6fetPoLMb8pBeqJBNGx81uuf7iljX9++yNBVRDQgD04L+SVXmXmh5ZP4/WOp4mWF0kmi06PW2tA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
@@ -1998,14 +2282,15 @@
|
||||
"dev": true
|
||||
},
|
||||
"@swc/cli": {
|
||||
"version": "0.1.62",
|
||||
"resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.1.62.tgz",
|
||||
"integrity": "sha512-kOFLjKY3XH1DWLfXL1/B5MizeNorHR8wHKEi92S/Zi9Md/AK17KSqR8MgyRJ6C1fhKHvbBCl8wboyKAFXStkYw==",
|
||||
"version": "0.1.65",
|
||||
"resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.1.65.tgz",
|
||||
"integrity": "sha512-4NcgsvJVHhA7trDnMmkGLLvWMHu2kSy+qHx6QwRhhJhdiYdNUrhdp+ERxen73sYtaeEOYeLJcWrQ60nzKi6rpg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@mole-inc/bin-wrapper": "^8.0.1",
|
||||
"commander": "^7.1.0",
|
||||
"fast-glob": "^3.2.5",
|
||||
"minimatch": "^9.0.3",
|
||||
"semver": "^7.3.8",
|
||||
"slash": "3.0.0",
|
||||
"source-map": "^0.7.3"
|
||||
@@ -2140,6 +2425,12 @@
|
||||
"@types/responselike": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"@types/estree": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
|
||||
"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/http-cache-semantics": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz",
|
||||
@@ -2179,6 +2470,12 @@
|
||||
"integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==",
|
||||
"dev": true
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
||||
"dev": true
|
||||
},
|
||||
"bin-check": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bin-check/-/bin-check-4.1.0.tgz",
|
||||
@@ -2200,9 +2497,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-key": "^3.1.0",
|
||||
@@ -2291,13 +2588,22 @@
|
||||
"semver-truncate": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"braces": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||
"brace-expansion": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
|
||||
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fill-range": "^7.0.1"
|
||||
"balanced-match": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"braces": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fill-range": "^7.1.1"
|
||||
}
|
||||
},
|
||||
"cacheable-lookup": {
|
||||
@@ -2499,9 +2805,9 @@
|
||||
}
|
||||
},
|
||||
"fill-range": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"to-regex-range": "^5.0.1"
|
||||
@@ -2674,12 +2980,12 @@
|
||||
"dev": true
|
||||
},
|
||||
"micromatch": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz",
|
||||
"integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==",
|
||||
"version": "4.0.8",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
|
||||
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"braces": "^3.0.2",
|
||||
"braces": "^3.0.3",
|
||||
"picomatch": "^2.3.1"
|
||||
}
|
||||
},
|
||||
@@ -2701,6 +3007,15 @@
|
||||
"integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==",
|
||||
"dev": true
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "9.0.5",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
|
||||
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"normalize-url": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz",
|
||||
@@ -2849,23 +3164,34 @@
|
||||
"dev": true
|
||||
},
|
||||
"rollup": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.2.0.tgz",
|
||||
"integrity": "sha512-deaMa9Z+jPVeBD2dKXv+h7EbdKte9++V2potc/ADqvVgEr6DEJ3ia9u0joarjC2lX/ubaCRYz3QVx0TzuVqAJA==",
|
||||
"version": "4.53.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.2.tgz",
|
||||
"integrity": "sha512-MHngMYwGJVi6Fmnk6ISmnk7JAHRNF0UkuucA0CUW3N3a4KnONPEZz+vUanQP/ZC/iY1Qkf3bwPWzyY84wEks1g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@rollup/rollup-android-arm-eabi": "4.2.0",
|
||||
"@rollup/rollup-android-arm64": "4.2.0",
|
||||
"@rollup/rollup-darwin-arm64": "4.2.0",
|
||||
"@rollup/rollup-darwin-x64": "4.2.0",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.2.0",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.2.0",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.2.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.2.0",
|
||||
"@rollup/rollup-linux-x64-musl": "4.2.0",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.2.0",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.2.0",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.2.0",
|
||||
"@rollup/rollup-android-arm-eabi": "4.53.2",
|
||||
"@rollup/rollup-android-arm64": "4.53.2",
|
||||
"@rollup/rollup-darwin-arm64": "4.53.2",
|
||||
"@rollup/rollup-darwin-x64": "4.53.2",
|
||||
"@rollup/rollup-freebsd-arm64": "4.53.2",
|
||||
"@rollup/rollup-freebsd-x64": "4.53.2",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.53.2",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.53.2",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.53.2",
|
||||
"@rollup/rollup-linux-loong64-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-ppc64-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-riscv64-musl": "4.53.2",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.53.2",
|
||||
"@rollup/rollup-linux-x64-musl": "4.53.2",
|
||||
"@rollup/rollup-openharmony-arm64": "4.53.2",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.53.2",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.53.2",
|
||||
"@rollup/rollup-win32-x64-gnu": "4.53.2",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.53.2",
|
||||
"@types/estree": "1.0.8",
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
"version": "1.1.0",
|
||||
"description": "Flic Hub MQTT Server",
|
||||
"scripts": {
|
||||
"build": "swc src/ -d dist/ && rollup dist/index.js --file lib.js -f cjs"
|
||||
"build": "rm -rf dist/* && swc src/ -d dist/ && rollup dist/index.js --file lib.js -f cjs"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -21,4 +21,4 @@
|
||||
"rollup": "^4.2.0",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,194 +0,0 @@
|
||||
import { HAComponent, HADevice, HAmqtt } from "./HAmqtt";
|
||||
import { makeLogger } from "./Logger";
|
||||
import { Button, ButtonModule } from "./flicTypes";
|
||||
|
||||
const ms2ISO8601 = (ms: number): string =>
|
||||
(new Date(ms)).toISOString().slice(0, 19).replace('T', ' ')
|
||||
|
||||
export type ButtonControllerOpt = {
|
||||
debug: boolean;
|
||||
}
|
||||
export const makeOptions = (opt: Partial<ButtonControllerOpt>): ButtonControllerOpt => ({
|
||||
debug: false,
|
||||
...opt,
|
||||
})
|
||||
const ENTITIES: Record<string, [HAComponent, Record<string, any>]> = {
|
||||
"action": ['sensor', { icon: 'mdi:gesture-tap-button', name: "Click Action" }],
|
||||
"state": ['sensor', { icon: 'mdi:radiobox-indeterminate-variant' }],
|
||||
"battery": ['sensor', { expire_after: 5, unit_of_measurement: '%', device_class: 'battery' }],
|
||||
"batteryLastUpdate": ['sensor', { entity_category: "diagnostic", expire_after: 5, name: "Battery Last Update Time", device_class: "duration", unit_of_measurement: "s" }],
|
||||
"lifeline": ['binary_sensor', { entity_category: "diagnostic", expire_after: 5, name: "Flichub Connected", device_class: "connectivity", unit_of_measurement: "s", payload_not_available: "OFF" }],
|
||||
"connected": ['binary_sensor', { entity_category: "diagnostic", expire_after: 5, device_class: 'connectivity', name: "Connection Established", payload_not_available: "OFF" }],
|
||||
"ready": ['binary_sensor', { entity_category: "config", expire_after: 5, device_class: 'connectivity', name: "Connection Verified" }],
|
||||
"activeDisconnect": ['binary_sensor', { entity_category: "config", expire_after: 5, name: "User Active Disconnect" }],
|
||||
"passive": ['binary_sensor', { entity_category: "config", expire_after: 5, name: "Passive Mode" }],
|
||||
"button_short_press": [
|
||||
'device_automation',
|
||||
{ 'type': 'button_short_press', 'subtype': 'button_1', 'automation_type': 'trigger', 'payload': 'ON' }
|
||||
],
|
||||
"button_long_press": [
|
||||
'device_automation',
|
||||
{ 'type': 'button_long_press', 'subtype': 'button_1', 'automation_type': 'trigger', 'payload': 'ON' }
|
||||
],
|
||||
"button_double_press": [
|
||||
'device_automation',
|
||||
{ 'type': 'button_double_press', 'subtype': 'button_1', 'automation_type': 'trigger', 'payload': 'ON' }
|
||||
]
|
||||
}
|
||||
export type ButtonController = ReturnType<typeof makeButtonController>;
|
||||
export function makeButtonController(
|
||||
ha: HAmqtt,
|
||||
buttonModule: ButtonModule,
|
||||
options: Partial<ButtonControllerOpt> = {},
|
||||
) {
|
||||
options = makeOptions(options);
|
||||
const logger = makeLogger('btnc', options.debug)
|
||||
logger.info("Starting Flic ButtonController with", JSON.stringify(options, null, 4));
|
||||
|
||||
const getDeviceFromButton = (button: Button): HADevice => {
|
||||
return {
|
||||
name: button.name,
|
||||
identifiers: [button.serialNumber, button.uuid],
|
||||
manufacturer: 'Flic',
|
||||
model: `v${button.flicVersion}_${button.color.trim().length > 0 ? button.color : 'white'}`,
|
||||
sw: String(button.firmwareVersion),
|
||||
hw: String(button.flicVersion),
|
||||
configuration_url: "https://hubsdk.flic.io/",
|
||||
}
|
||||
}
|
||||
const genButtonUniqueId = (bdaddr: string): string => bdaddr.replace(/:/g, '_')
|
||||
const registerButton = (button: Button) => {
|
||||
logger.info('Registering', JSON.stringify(button, null, 4))
|
||||
const haDevice = getDeviceFromButton(button);
|
||||
Object.keys(ENTITIES).forEach(objectId => {
|
||||
let avl: any = {
|
||||
availability: [
|
||||
{
|
||||
payload_available: 'ON',
|
||||
payload_not_available: 'unavailable',
|
||||
topic: ha.genFlicPrefix(genButtonUniqueId(button.bdaddr), 'ready')
|
||||
},
|
||||
{
|
||||
payload_available: 'ON',
|
||||
payload_not_available: 'unavailable',
|
||||
topic: ha.genFlicPrefix(genButtonUniqueId(button.bdaddr), 'lifeline')
|
||||
},
|
||||
],
|
||||
availability_mode: 'all',
|
||||
};
|
||||
if (objectId === 'lifeline') {
|
||||
avl = {}
|
||||
}
|
||||
if (objectId === 'ready' || objectId == 'connected') {
|
||||
avl.availability = [avl.availability[1]]
|
||||
}
|
||||
if (ENTITIES[objectId][0] === 'device_automation') {
|
||||
avl = {}
|
||||
}
|
||||
ha.registerEntity(
|
||||
`Button ${objectId}`,
|
||||
ENTITIES[objectId][0],
|
||||
genButtonUniqueId(button.bdaddr),
|
||||
objectId,
|
||||
haDevice,
|
||||
{
|
||||
...ENTITIES[objectId][1],
|
||||
...avl
|
||||
},
|
||||
)
|
||||
});
|
||||
}
|
||||
const deregisterButton = (button: Button) => {
|
||||
logger.info('Deregistering', JSON.stringify(button, null, 4))
|
||||
Object.keys(ENTITIES).forEach(objectId => {
|
||||
ha.deregisterEntity(
|
||||
ENTITIES[objectId][0],
|
||||
genButtonUniqueId(button.bdaddr),
|
||||
objectId,
|
||||
)
|
||||
});
|
||||
}
|
||||
const publishButtonState = (button: Button, state: 'released' | 'pressed') => {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'state', state);
|
||||
}
|
||||
const publishButtonAction = (button: Button, state: 'click' | 'double_click' | 'hold') => {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'action', state);
|
||||
if (state === 'click') {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'button_short_press', 'ON')
|
||||
} else if (state === 'double_click') {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'button_double_press', 'ON')
|
||||
} else if (state === 'hold') {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'button_long_press', 'ON')
|
||||
}
|
||||
}
|
||||
const publishButtonMeta = (button: Button) => {
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'battery', button.batteryStatus);
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'batteryLastUpdate', button.batteryTimestamp ? `${Math.round((Date.now() - button.batteryTimestamp) / 1000)}` : 'unknown');
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'connected', button.connected ? 'ON' : "OFF");
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'ready', button.ready ? 'ON' : "OFF");
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'activeDisconnect', button.activeDisconnect ? 'ON' : "OFF");
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'passive', button.activeDisconnect ? 'ON' : "OFF");
|
||||
ha.publishState(genButtonUniqueId(button.bdaddr), 'lifeline', 'ON');
|
||||
}
|
||||
const addBtn = (eventName: string) => (obj: { bdaddr: string }) => {
|
||||
const button = buttonModule.getButton(obj.bdaddr);
|
||||
logger.info(eventName, "upserting", button.name, genButtonUniqueId(button.bdaddr));
|
||||
registerButton(button);
|
||||
}
|
||||
const start = () => {
|
||||
logger.info("Starting...")
|
||||
let resetActiontInv: null | any = null;
|
||||
buttonModule.on('buttonAdded', addBtn('buttonAdded'));
|
||||
buttonModule.on('buttonConnected', addBtn('buttonConnected'));
|
||||
buttonModule.on('buttonReady', (btn) => {
|
||||
addBtn('buttonReady')(btn);
|
||||
const button = buttonModule.getButton(btn.bdaddr);
|
||||
publishButtonState(button, 'released')
|
||||
publishButtonAction(button, 'none')
|
||||
});
|
||||
buttonModule.on('buttonUpdated', addBtn('buttonUpdated'));
|
||||
buttonModule.on('buttonDeleted', (btn) => {
|
||||
logger.debug('buttonDeleted', JSON.stringify(btn, null, 4))
|
||||
deregisterButton(btn);
|
||||
publishButtonMeta(btn);
|
||||
});
|
||||
buttonModule.on('buttonDisconnected', ({ bdaddr }) => {
|
||||
publishButtonMeta(buttonModule.getButton(bdaddr));
|
||||
});
|
||||
buttonModule.on('buttonDown', ({ bdaddr }) => {
|
||||
const btn = buttonModule.getButton(bdaddr);
|
||||
publishButtonState(btn, 'pressed');
|
||||
publishButtonMeta(btn);
|
||||
});
|
||||
buttonModule.on('buttonUp', ({ bdaddr }) => {
|
||||
const btn = buttonModule.getButton(bdaddr);
|
||||
publishButtonState(btn, 'released');
|
||||
publishButtonMeta(btn);
|
||||
});
|
||||
buttonModule.on('buttonSingleOrDoubleClickOrHold', obj => {
|
||||
if (resetActiontInv !== null) {
|
||||
clearTimeout(resetActiontInv);
|
||||
}
|
||||
const btn = buttonModule.getButton(obj.bdaddr);
|
||||
publishButtonAction(
|
||||
btn,
|
||||
obj.isSingleClick ? "click" : obj.isDoubleClick ? "double_click" : "hold",
|
||||
);
|
||||
publishButtonMeta(btn);
|
||||
resetActiontInv = setTimeout(() => {
|
||||
publishButtonAction(btn, 'none');
|
||||
}, 500)
|
||||
});
|
||||
logger.info("Registering all buttons...")
|
||||
buttonModule.getButtons().forEach(registerButton);
|
||||
setInterval(() => buttonModule.getButtons().forEach(publishButtonMeta), 3000);
|
||||
logger.info('is up')
|
||||
}
|
||||
|
||||
return {
|
||||
start,
|
||||
publishButtonAction,
|
||||
publishButtonMeta,
|
||||
publishButtonState,
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
import { makeLogger } from "./Logger";
|
||||
import { MQTT } from "./mqtt";
|
||||
|
||||
export type HAmqttOptions = {
|
||||
debug: boolean,
|
||||
topics: {
|
||||
homeassistant: string,
|
||||
flic: string,
|
||||
}
|
||||
}
|
||||
export type MQTTPublishOpt = {
|
||||
retain?: boolean // the server should retain this message and send it out again to new subscribers
|
||||
dup?: boolean // indicate the message is a duplicate because original wasn't ACKed (QoS > 0 only)
|
||||
}
|
||||
export type HADevice = {
|
||||
name: string,
|
||||
identifiers: string[],
|
||||
manufacturer: string,
|
||||
model: string,
|
||||
sw?: string,
|
||||
hw?: string,
|
||||
configuration_url?: string,
|
||||
}
|
||||
export type HAComponent = 'sensor' | 'binary_sensor' | 'button' | 'switch' | 'text' | 'device_automation';
|
||||
export const makeOptions = (opt: Partial<HAmqttOptions>): HAmqttOptions => ({
|
||||
debug: false,
|
||||
...opt,
|
||||
topics: {
|
||||
homeassistant: 'homeassistant',
|
||||
flic: 'flic',
|
||||
...opt.topics,
|
||||
}
|
||||
})
|
||||
export type HAmqtt = ReturnType<typeof makeHAmqtt>;
|
||||
export function makeHAmqtt(
|
||||
mqttServer: MQTT,
|
||||
options: Partial<HAmqttOptions> = {},
|
||||
) {
|
||||
options = makeOptions(options);
|
||||
const logger = makeLogger('mqtt:ha', options.debug);
|
||||
logger.info("starting...", JSON.stringify(options, null, 4));
|
||||
|
||||
const genFlicPrefix = (nodeId: string, objectId: string): string => {
|
||||
return `${options.topics.flic}/${nodeId}/${objectId}`
|
||||
}
|
||||
|
||||
const genHAPrefix = (component: HAComponent, nodeId: string, objectId: string) => {
|
||||
return `${options.topics.homeassistant}/${component}/${nodeId}/${objectId}`
|
||||
}
|
||||
|
||||
const publishState = (nodeId: string, objectId: string, state: any, opt: MQTTPublishOpt = {}) => {
|
||||
const btntopic = genFlicPrefix(nodeId, objectId);
|
||||
mqttServer.publish(btntopic, state + "", opt);
|
||||
logger.debug(btntopic, state, JSON.stringify(opt))
|
||||
}
|
||||
const registerEntity = (
|
||||
name: string,
|
||||
component: HAComponent,
|
||||
nodeId: string,
|
||||
objectId: string,
|
||||
device: HADevice,
|
||||
additionalProps: Record<string, any> = {},
|
||||
) => {
|
||||
const configtopic = genHAPrefix(component, nodeId, objectId) + "/config"
|
||||
if (component === 'device_automation') {
|
||||
additionalProps.topic = genFlicPrefix(nodeId, objectId)
|
||||
} else {
|
||||
additionalProps.state_topic = genFlicPrefix(nodeId, objectId)
|
||||
}
|
||||
const configObj = {
|
||||
name,
|
||||
...additionalProps,
|
||||
unique_id: `Flic_${nodeId}_${objectId}`,
|
||||
device,
|
||||
};
|
||||
mqttServer.publish(configtopic, JSON.stringify(configObj), {
|
||||
retain: true,
|
||||
});
|
||||
logger.debug(configtopic, JSON.stringify(configObj, null, 4));
|
||||
}
|
||||
|
||||
const deregisterEntity = (
|
||||
component: HAComponent,
|
||||
nodeId: string,
|
||||
objectId: string,
|
||||
) => {
|
||||
const configtopic = genHAPrefix(component, nodeId, objectId) + "/config"
|
||||
mqttServer.publish(configtopic, null, { retain: false });
|
||||
logger.debug(configtopic, null);
|
||||
}
|
||||
|
||||
return {
|
||||
deregisterEntity,
|
||||
registerEntity,
|
||||
publishState,
|
||||
genFlicPrefix,
|
||||
}
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
import { HADevice, HAmqtt } from "./HAmqtt";
|
||||
import { makeLogger } from "./Logger";
|
||||
import { IRModule } from "./flicTypes";
|
||||
import { MQTT } from "./mqtt";
|
||||
|
||||
const NODE_ID = 'FlicHubIR';
|
||||
const convertUint32Array2Str = (arr: Uint32Array): string => {
|
||||
let outStr = []
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
outStr.push(arr[i].toString(32))
|
||||
}
|
||||
return outStr.join('_')
|
||||
}
|
||||
const convertStr2Uint32Array = (s: string): Uint32Array => {
|
||||
const a = s.split('_');
|
||||
return new Uint32Array(a.slice(0, a.length - 2).map(v => parseInt(v, 32)))
|
||||
}
|
||||
export type IRControllerOpt = {
|
||||
uniqueId: string,
|
||||
debug: boolean;
|
||||
}
|
||||
export const makeOptions = (opt: Partial<IRControllerOpt>): IRControllerOpt => ({
|
||||
debug: false,
|
||||
uniqueId: "0",
|
||||
...opt,
|
||||
})
|
||||
export const makeIRController = (
|
||||
ir: IRModule,
|
||||
ha: HAmqtt,
|
||||
mqtt: MQTT,
|
||||
options: Partial<IRControllerOpt> = {},
|
||||
) => {
|
||||
options = makeOptions(options);
|
||||
const logger = makeLogger('ir', options.debug);
|
||||
const haDevice: HADevice = {
|
||||
name: 'IR',
|
||||
manufacturer: 'Flic',
|
||||
model: `${NODE_ID}${options.uniqueId}`,
|
||||
identifiers: ['FlicHubIR'],
|
||||
configuration_url: "https://hubsdk.flic.io/",
|
||||
}
|
||||
const nodeId = `${NODE_ID}${options.uniqueId}`;
|
||||
const LIFELINE_SGINAL = ha.genFlicPrefix(nodeId, 'lifeline');
|
||||
const RECORD_SIGNAL_SET = ha.genFlicPrefix(nodeId, 'record/set');
|
||||
const VALUE_SIGNAL_SET = ha.genFlicPrefix(nodeId, 'signal/set');
|
||||
const VALUE_SIGNAL_STATE = ha.genFlicPrefix(nodeId, 'signal');
|
||||
const PLAY_SIGNAL_SET = ha.genFlicPrefix(nodeId, 'play/set');
|
||||
const availability = [
|
||||
{
|
||||
"payload_available": "ON",
|
||||
"payload_not_available": "unavailable",
|
||||
"topic": LIFELINE_SGINAL,
|
||||
}
|
||||
]
|
||||
let currentSignal: string | null = null;
|
||||
|
||||
const set_topics = [
|
||||
RECORD_SIGNAL_SET,
|
||||
VALUE_SIGNAL_SET,
|
||||
PLAY_SIGNAL_SET,
|
||||
VALUE_SIGNAL_STATE,
|
||||
];
|
||||
|
||||
return {
|
||||
start() {
|
||||
logger.info('starting...')
|
||||
logger.debug('setting up entities...')
|
||||
ha.registerEntity(
|
||||
'IR Available',
|
||||
'binary_sensor',
|
||||
nodeId,
|
||||
'lifeline',
|
||||
haDevice,
|
||||
{
|
||||
device_class: 'connectivity',
|
||||
expire_after: 5,
|
||||
off_delay: 3,
|
||||
entity_category: "diagnostic",
|
||||
payload_available: "ON",
|
||||
payload_not_available: "OFF",
|
||||
}
|
||||
)
|
||||
ha.registerEntity(
|
||||
'Record Signal',
|
||||
'switch',
|
||||
nodeId,
|
||||
'record',
|
||||
haDevice,
|
||||
{
|
||||
icon: 'mdi:record-rec',
|
||||
command_topic: RECORD_SIGNAL_SET,
|
||||
device_class: 'switch',
|
||||
availability,
|
||||
}
|
||||
)
|
||||
ha.registerEntity(
|
||||
'Signal',
|
||||
'text',
|
||||
nodeId,
|
||||
'signal',
|
||||
haDevice,
|
||||
{
|
||||
command_topic: VALUE_SIGNAL_SET,
|
||||
icon: 'mdi:broadcast',
|
||||
max: 255,
|
||||
availability,
|
||||
}
|
||||
)
|
||||
ha.registerEntity(
|
||||
'Play Signal',
|
||||
'button',
|
||||
nodeId,
|
||||
'play',
|
||||
haDevice,
|
||||
{
|
||||
icon: 'mdi:play',
|
||||
command_topic: PLAY_SIGNAL_SET,
|
||||
availability,
|
||||
}
|
||||
)
|
||||
logger.debug('setting default states....')
|
||||
ha.publishState(nodeId, 'record', 'OFF')
|
||||
ha.publishState(nodeId, 'play', 'OFF')
|
||||
logger.debug('registering events')
|
||||
mqtt.on('message', (topic, message) => {
|
||||
logger.debug('message:', JSON.stringify({ topic, message }))
|
||||
if (topic === RECORD_SIGNAL_SET) {
|
||||
logger.debug('starting record')
|
||||
ir.record()
|
||||
ha.publishState(nodeId, 'record', 'ON')
|
||||
} else if (topic === PLAY_SIGNAL_SET) {
|
||||
if (currentSignal !== null) {
|
||||
logger.info('playing', currentSignal)
|
||||
let arr: Uint32Array | null = null
|
||||
try {
|
||||
arr = convertStr2Uint32Array(currentSignal)
|
||||
} catch (err) {
|
||||
logger.error('invalid string signal set', JSON.stringify(err), err)
|
||||
return
|
||||
}
|
||||
ir.play(arr, (err) => {
|
||||
if (err) {
|
||||
logger.error('failed to play signal', JSON.stringify(err), err)
|
||||
} else {
|
||||
logger.debug('signal played!')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
logger.error('cannot play an unset signal')
|
||||
}
|
||||
} else if (topic === VALUE_SIGNAL_STATE) {
|
||||
currentSignal = message
|
||||
logger.info('setting currentSignal', currentSignal)
|
||||
} else if (topic === VALUE_SIGNAL_SET) {
|
||||
ha.publishState(nodeId, 'signal', message, { retain: true })
|
||||
}
|
||||
})
|
||||
ir.on('recordComplete', data => {
|
||||
const stringMessage = convertUint32Array2Str(data)
|
||||
logger.debug('recording completed with', JSON.stringify({ data, stringMessage, rev: convertStr2Uint32Array(stringMessage) }))
|
||||
if (stringMessage.length > 255) {
|
||||
logger.error("stringMessage is too big! size=", stringMessage.length, 'max=255')
|
||||
}
|
||||
ha.publishState(nodeId, 'signal', stringMessage, { retain: true })
|
||||
ha.publishState(nodeId, 'record', 'OFF')
|
||||
})
|
||||
|
||||
logger.debug('subscribing to', set_topics)
|
||||
mqtt.subscribe(set_topics)
|
||||
setInterval(() => {
|
||||
ha.publishState(nodeId, 'lifeline', 'ON')
|
||||
}, 2500)
|
||||
logger.info('is up')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
import buttonModule, { Button } from "buttons";
|
||||
import { HAmqtt } from "../ha_mqtt/index";
|
||||
import { Logger } from "../Logger";
|
||||
import { genButtonUniqueId, getDeviceFromButton } from "./utils";
|
||||
import { ENTITIES } from "./entities";
|
||||
|
||||
export const ButtonStateHandler = (ha: HAmqtt, logger: Logger) => {
|
||||
const registerButton = (button: Button) => {
|
||||
logger.info("Registering", JSON.stringify(button, null, 4));
|
||||
const haDevice = getDeviceFromButton(button);
|
||||
const uniqId = genButtonUniqueId(button.bdaddr);
|
||||
ha.startLifeLine("Button Controller Connected", uniqId, haDevice);
|
||||
Object.keys(ENTITIES).forEach((objectId) => {
|
||||
let avl: any = {
|
||||
availability: [
|
||||
{
|
||||
payload_available: "ON",
|
||||
payload_not_available: "unavailable",
|
||||
topic: ha.genFlicPrefix(genButtonUniqueId(button.bdaddr), "ready"),
|
||||
},
|
||||
{
|
||||
payload_available: "ON",
|
||||
payload_not_available: "unavailable",
|
||||
topic: ha.genFlicPrefix(
|
||||
genButtonUniqueId(button.bdaddr),
|
||||
"lifeline",
|
||||
),
|
||||
},
|
||||
],
|
||||
availability_mode: "all",
|
||||
};
|
||||
if (objectId === "ready" || objectId == "connected") {
|
||||
avl.availability = [avl.availability[1]];
|
||||
}
|
||||
if (ENTITIES[objectId][0] === "device_automation") {
|
||||
avl = {};
|
||||
}
|
||||
ha.registerEntity(
|
||||
`Button ${objectId}`,
|
||||
ENTITIES[objectId][0],
|
||||
uniqId,
|
||||
objectId,
|
||||
haDevice,
|
||||
{
|
||||
...ENTITIES[objectId][1],
|
||||
...avl,
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
const deregisterButton = (bdaddr: string) => {
|
||||
const uniqId = genButtonUniqueId(bdaddr);
|
||||
logger.info("Deregistering", JSON.stringify({ bdaddr, uniqId }, null, 4));
|
||||
Object.keys(ENTITIES).forEach((objectId) => {
|
||||
ha.deregisterEntity(ENTITIES[objectId][0], uniqId, objectId);
|
||||
});
|
||||
};
|
||||
const publishButtonState = (
|
||||
bdaddr: string,
|
||||
state: "released" | "pressed",
|
||||
) => {
|
||||
logger.debug(`Updating state for bdaddr="${bdaddr}" state=${state}`);
|
||||
ha.publishState(genButtonUniqueId(bdaddr), "state", state);
|
||||
};
|
||||
const publishButtonAction = (
|
||||
bdaddr: string,
|
||||
state: "click" | "double_click" | "hold" | "none",
|
||||
) => {
|
||||
const uniqId = genButtonUniqueId(bdaddr);
|
||||
ha.publishState(uniqId, "action", state);
|
||||
logger.debug(
|
||||
`Publishing click for bdaddr="${bdaddr}" uniqId="${uniqId}" state=${state}`,
|
||||
);
|
||||
if (state === "click") {
|
||||
ha.publishState(uniqId, "button_short_press", "ON");
|
||||
} else if (state === "double_click") {
|
||||
ha.publishState(uniqId, "button_double_press", "ON");
|
||||
} else if (state === "hold") {
|
||||
ha.publishState(uniqId, "button_long_press", "ON");
|
||||
}
|
||||
};
|
||||
const publishButtonMeta = (bdaddr: string) => {
|
||||
const button = buttonModule.getButton(bdaddr);
|
||||
const uniqId = genButtonUniqueId(button.bdaddr);
|
||||
ha.publishState(uniqId, "name", button.name);
|
||||
ha.publishState(uniqId, "battery", button.batteryStatus);
|
||||
ha.publishState(uniqId, "connected", button.connected ? "ON" : "OFF");
|
||||
ha.publishState(uniqId, "ready", button.ready ? "ON" : "OFF");
|
||||
ha.publishState(
|
||||
uniqId,
|
||||
"activeDisconnect",
|
||||
button.activeDisconnect ? "ON" : "OFF",
|
||||
);
|
||||
ha.publishState(uniqId, "passive", button.activeDisconnect ? "ON" : "OFF");
|
||||
ha.publishState(uniqId, "lifeline", "ON");
|
||||
};
|
||||
const handleBtnCreation = (eventName: string, obj: { bdaddr: string }) => {
|
||||
const button = buttonModule.getButton(obj.bdaddr);
|
||||
logger.info(
|
||||
eventName,
|
||||
"upserting",
|
||||
button.name,
|
||||
genButtonUniqueId(button.bdaddr),
|
||||
);
|
||||
registerButton(button);
|
||||
};
|
||||
return {
|
||||
addBtn: (eventName: string) => (o: { bdaddr: string }) =>
|
||||
handleBtnCreation(eventName, o),
|
||||
addBtnWithObject: (eventName: string) => (o: { button: Button }) =>
|
||||
handleBtnCreation(eventName, o.button),
|
||||
publishButtonMeta,
|
||||
publishButtonAction,
|
||||
publishButtonState,
|
||||
registerButton,
|
||||
deregisterButton,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,73 @@
|
||||
export const ENTITIES: Record<string, [HAComponent, Record<string, any>]> = {
|
||||
name: [
|
||||
"sensor",
|
||||
{
|
||||
entity_category: "diagnostic",
|
||||
name: "Button Name",
|
||||
},
|
||||
],
|
||||
action: ["sensor", { icon: "mdi:gesture-tap-button", name: "Click Action" }],
|
||||
state: ["sensor", { icon: "mdi:radiobox-indeterminate-variant" }],
|
||||
battery: [
|
||||
"sensor",
|
||||
{ expire_after: 5, unit_of_measurement: "%", device_class: "battery" },
|
||||
],
|
||||
connected: [
|
||||
"binary_sensor",
|
||||
{
|
||||
entity_category: "diagnostic",
|
||||
expire_after: 5,
|
||||
device_class: "connectivity",
|
||||
name: "Connection Established",
|
||||
payload_not_available: "OFF",
|
||||
},
|
||||
],
|
||||
ready: [
|
||||
"binary_sensor",
|
||||
{
|
||||
entity_category: "config",
|
||||
expire_after: 5,
|
||||
device_class: "connectivity",
|
||||
name: "Connection Verified",
|
||||
},
|
||||
],
|
||||
activeDisconnect: [
|
||||
"binary_sensor",
|
||||
{
|
||||
entity_category: "config",
|
||||
expire_after: 5,
|
||||
name: "User Active Disconnect",
|
||||
},
|
||||
],
|
||||
passive: [
|
||||
"binary_sensor",
|
||||
{ entity_category: "config", expire_after: 5, name: "Passive Mode" },
|
||||
],
|
||||
button_short_press: [
|
||||
"device_automation",
|
||||
{
|
||||
type: "button_short_press",
|
||||
subtype: "button_1",
|
||||
automation_type: "trigger",
|
||||
payload: "ON",
|
||||
},
|
||||
],
|
||||
button_long_press: [
|
||||
"device_automation",
|
||||
{
|
||||
type: "button_long_press",
|
||||
subtype: "button_1",
|
||||
automation_type: "trigger",
|
||||
payload: "ON",
|
||||
},
|
||||
],
|
||||
button_double_press: [
|
||||
"device_automation",
|
||||
{
|
||||
type: "button_double_press",
|
||||
subtype: "button_1",
|
||||
automation_type: "trigger",
|
||||
payload: "ON",
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,93 @@
|
||||
import buttonModule from "buttons";
|
||||
import { HAmqtt } from "../ha_mqtt/index";
|
||||
import { makeLogger } from "../Logger";
|
||||
import { makeOptions } from "./options";
|
||||
import { ButtonStateHandler } from "./button_state_handler";
|
||||
|
||||
export type ButtonController = ReturnType<typeof makeButtonController>;
|
||||
export function makeButtonController(
|
||||
ha: HAmqtt,
|
||||
options: Partial<ButtonControllerOpt> = {},
|
||||
) {
|
||||
options = makeOptions(options);
|
||||
const logger = makeLogger("btnc", options.debug);
|
||||
logger.info(
|
||||
"Starting Flic ButtonController with",
|
||||
JSON.stringify(options, null, 4),
|
||||
);
|
||||
const stateHandler = ButtonStateHandler(ha, logger);
|
||||
const setListeners = () => {
|
||||
let resetActiontInv: null | any = null;
|
||||
buttonModule.on(
|
||||
"buttonAdded",
|
||||
stateHandler.addBtnWithObject("buttonAdded"),
|
||||
);
|
||||
buttonModule.on(
|
||||
"buttonUpdated",
|
||||
stateHandler.addBtnWithObject("buttonUpdated"),
|
||||
);
|
||||
buttonModule.on("buttonDeleted", (btn) => {
|
||||
logger.debug("buttonDeleted", JSON.stringify(btn, null, 4));
|
||||
stateHandler.deregisterButton(btn.bdaddr);
|
||||
stateHandler.publishButtonMeta(btn.bdaddr);
|
||||
});
|
||||
buttonModule.on("buttonConnected", stateHandler.addBtn("buttonConnected"));
|
||||
buttonModule.on("buttonReady", (btn) => {
|
||||
stateHandler.addBtn("buttonReady")(btn);
|
||||
stateHandler.publishButtonState(btn.bdaddr, "released");
|
||||
stateHandler.publishButtonAction(btn.bdaddr, "none");
|
||||
});
|
||||
buttonModule.on("buttonDisconnected", ({ bdaddr }) => {
|
||||
stateHandler.publishButtonMeta(bdaddr);
|
||||
});
|
||||
buttonModule.on("buttonDown", ({ bdaddr }) => {
|
||||
stateHandler.publishButtonState(bdaddr, "pressed");
|
||||
stateHandler.publishButtonMeta(bdaddr);
|
||||
});
|
||||
buttonModule.on("buttonUp", ({ bdaddr }) => {
|
||||
stateHandler.publishButtonState(bdaddr, "released");
|
||||
stateHandler.publishButtonMeta(bdaddr);
|
||||
});
|
||||
buttonModule.on("buttonClickOrHold", (obj) => {});
|
||||
buttonModule.on("buttonSingleOrDoubleClickOrHold", (obj) => {
|
||||
if (resetActiontInv !== null) {
|
||||
clearTimeout(resetActiontInv);
|
||||
}
|
||||
stateHandler.publishButtonAction(
|
||||
obj.bdaddr,
|
||||
obj.isSingleClick
|
||||
? "click"
|
||||
: obj.isDoubleClick
|
||||
? "double_click"
|
||||
: "hold",
|
||||
);
|
||||
stateHandler.publishButtonMeta(obj.bdaddr);
|
||||
resetActiontInv = setTimeout(() => {
|
||||
stateHandler.publishButtonAction(obj.bdaddr, "none");
|
||||
}, 500);
|
||||
});
|
||||
};
|
||||
const start = () => {
|
||||
logger.info("Starting...");
|
||||
logger.info("Setting listeners...");
|
||||
setListeners();
|
||||
logger.info("Registering all buttons...");
|
||||
buttonModule
|
||||
.getButtons()
|
||||
.forEach((btn) => stateHandler.registerButton(btn));
|
||||
setInterval(() => {
|
||||
logger.debug("Updating button state!");
|
||||
buttonModule
|
||||
.getButtons()
|
||||
.forEach((btn) => stateHandler.publishButtonMeta(btn.bdaddr));
|
||||
}, 3000);
|
||||
logger.info("is up");
|
||||
};
|
||||
|
||||
return {
|
||||
start,
|
||||
publishButtonAction: stateHandler.publishButtonAction,
|
||||
publishButtonMeta: stateHandler.publishButtonMeta,
|
||||
publishButtonState: stateHandler.publishButtonState,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export const makeOptions = (
|
||||
opt: Partial<ButtonControllerOpt>,
|
||||
): ButtonControllerOpt => ({
|
||||
debug: false,
|
||||
...opt,
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Button } from "buttons";
|
||||
import { HADevice } from "../ha_mqtt/index";
|
||||
|
||||
export const getDeviceFromButton = (button: Button): HADevice => {
|
||||
return {
|
||||
name: button.name,
|
||||
identifiers: [button.serialNumber, button.uuid],
|
||||
manufacturer: "Flic",
|
||||
model: `v${button.flicVersion}_${button.color.trim().length > 0 ? button.color : "white"}`,
|
||||
sw_version: String(button.firmwareVersion),
|
||||
hw_version: String(button.flicVersion),
|
||||
serial_number: String(button.serialNumber),
|
||||
configuration_url: "https://hubsdk.flic.io/",
|
||||
};
|
||||
};
|
||||
export const genButtonUniqueId = (bdaddr: string): string =>
|
||||
bdaddr.replace(/:/g, "_");
|
||||
@@ -1,40 +0,0 @@
|
||||
|
||||
|
||||
export type Button = {
|
||||
bdaddr: string // Device address of button
|
||||
serialNumber: string // Serial number
|
||||
color: string // Colour of the button (lowercase)
|
||||
name: string // The user assigned button name
|
||||
activeDisconnect: boolean // The user has explicitly disconnected the button
|
||||
connected: boolean // The connection to the button is currently established
|
||||
ready: boolean // The connection is verified (see buttonReady)
|
||||
batteryStatus: number | null // Battery level in percent (0-100), or null if unknown
|
||||
batteryTimestamp: number | null // Last time the battery was updated
|
||||
firmwareVersion: number | null // Firmware version of button, or null if unknown
|
||||
flicVersion: number | null // Flic version (1 or 2)
|
||||
uuid: string // A 32 characters long hex string, unique for every button
|
||||
key: number | null // A 40 characters long hex string (only for Flic 2)
|
||||
}
|
||||
|
||||
export interface ButtonModule {
|
||||
getButtons(): Button[],
|
||||
getButton(bdaddr: string): Button,
|
||||
on(ev: "buttonAdded", cb: (btn: Button) => void): void,
|
||||
on(ev: "buttonUpdated", cb: (btn: Button) => void): void,
|
||||
on(ev: "buttonDeleted", cb: (btn: Button) => void): void,
|
||||
on(ev: "buttonConnected", cb: (btn: Button) => void): void,
|
||||
on(ev: "buttonReady", cb: (obj: { bdaddr: string }) => void): void,
|
||||
on(ev: "buttonDisconnected", cb: (obj: { bdaddr: string }) => void): void,
|
||||
on(ev: "buttonDown", cb: (obj: { bdaddr: string }) => void): void,
|
||||
on(ev: "buttonUp", cb: (obj: { bdaddr: string }) => void): void,
|
||||
on(ev: "buttonClickOrHold", cb: (obj: { bdaddr: string, isClick: boolean, isHold: boolean }) => void): void,
|
||||
on(ev: "buttonSingleOrDoubleClick", cb: (obj: { bdaddr: string, isSingleClick: boolean, isDoubleClick: boolean }) => void): void,
|
||||
on(ev: "buttonSingleOrDoubleClickOrHold", cb: (obj: { bdaddr: string, isSingleClick: boolean, isDoubleClick: boolean, isHold: boolean }) => void): void,
|
||||
}
|
||||
|
||||
export interface IRModule {
|
||||
record(): void;
|
||||
cancelRecord(): void;
|
||||
play(arr: Uint32Array, cb: (err: any | undefined) => void): void;
|
||||
on(ev: 'recordComplete', cb: (d: Uint32Array) => void): void;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import { makeLogger } from "../Logger";
|
||||
import { MQTT } from "../mqtt";
|
||||
import { makeOptions } from "./utils";
|
||||
|
||||
export type HAmqtt = ReturnType<typeof makeHAmqtt>;
|
||||
export function makeHAmqtt(
|
||||
mqttServer: MQTT,
|
||||
options: Partial<HAmqttOptions> = {},
|
||||
) {
|
||||
options = makeOptions(options);
|
||||
const logger = makeLogger("mqtt:ha", options.debug);
|
||||
logger.info("starting...", JSON.stringify(options, null, 4));
|
||||
const genFlicPrefix = (nodeId: string, objectId: string): string => {
|
||||
return `${options.topics.flic}/${nodeId}/${objectId}`;
|
||||
};
|
||||
const genFlicPrefixObject = (
|
||||
nodeId: string,
|
||||
objectId: string,
|
||||
): FlicMqttPrefix => ({
|
||||
nodeId,
|
||||
objectId,
|
||||
mqttPrefix: genFlicPrefix(nodeId, objectId),
|
||||
});
|
||||
|
||||
const genHAPrefix = (
|
||||
component: HAComponent,
|
||||
nodeId: string,
|
||||
objectId: string,
|
||||
) => {
|
||||
return `${options.topics.homeassistant}/${component}/${nodeId}/${objectId}`;
|
||||
};
|
||||
|
||||
const publishState = (
|
||||
nodeId: string,
|
||||
objectId: string,
|
||||
state: any,
|
||||
opt: MQTTPublishOpt = {},
|
||||
) => {
|
||||
const btntopic = genFlicPrefix(nodeId, objectId);
|
||||
mqttServer.publish(btntopic, state + "", opt);
|
||||
logger.debug(btntopic, state, JSON.stringify(opt));
|
||||
};
|
||||
const registerEntity = (
|
||||
name: string,
|
||||
component: HAComponent,
|
||||
nodeId: string,
|
||||
objectId: string,
|
||||
device: HADevice,
|
||||
additionalProps: {
|
||||
topic?: string;
|
||||
state_topic?: string;
|
||||
} & {
|
||||
[key: string]: any;
|
||||
} = {},
|
||||
) => {
|
||||
const configtopic = genHAPrefix(component, nodeId, objectId) + "/config";
|
||||
if (component === "device_automation") {
|
||||
additionalProps.topic = genFlicPrefix(nodeId, objectId);
|
||||
} else {
|
||||
additionalProps.state_topic = genFlicPrefix(nodeId, objectId);
|
||||
}
|
||||
const configObj = {
|
||||
name,
|
||||
...additionalProps,
|
||||
unique_id: `Flic_${nodeId}_${objectId}`,
|
||||
device,
|
||||
};
|
||||
mqttServer.publish(configtopic, JSON.stringify(configObj), {
|
||||
retain: true,
|
||||
});
|
||||
logger.debug(configtopic, JSON.stringify(configObj, null, 4));
|
||||
};
|
||||
|
||||
const deregisterEntity = (
|
||||
component: HAComponent,
|
||||
nodeId: string,
|
||||
objectId: string,
|
||||
) => {
|
||||
const configtopic = genHAPrefix(component, nodeId, objectId) + "/config";
|
||||
mqttServer.publish(configtopic, null, { retain: false });
|
||||
logger.debug(configtopic, null);
|
||||
};
|
||||
const startLifeLine = (
|
||||
name: string,
|
||||
nodeId: string,
|
||||
haDevice: HADevice,
|
||||
topic: string = "lifeline",
|
||||
) => {
|
||||
registerEntity(name, "binary_sensor", nodeId, topic, haDevice, {
|
||||
device_class: "connectivity",
|
||||
expire_after: 5,
|
||||
off_delay: 3,
|
||||
entity_category: "diagnostic",
|
||||
payload_available: "ON",
|
||||
payload_not_available: "OFF",
|
||||
});
|
||||
setInterval(() => {
|
||||
publishState(nodeId, topic, "ON");
|
||||
}, 2500);
|
||||
};
|
||||
return {
|
||||
deregisterEntity,
|
||||
registerEntity,
|
||||
publishState,
|
||||
genFlicPrefix,
|
||||
genFlicPrefixObject,
|
||||
startLifeLine,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export const makeOptions = (opt: Partial<HAmqttOptions>): HAmqttOptions => ({
|
||||
debug: false,
|
||||
...opt,
|
||||
topics: {
|
||||
homeassistant: "homeassistant",
|
||||
flic: "flic",
|
||||
...opt.topics,
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,65 @@
|
||||
import { HAmqtt } from "../ha_mqtt/index";
|
||||
import { makeLogger } from "../Logger";
|
||||
import { MQTT } from "../mqtt";
|
||||
import flichub from "flicapp";
|
||||
import {
|
||||
makeOptions,
|
||||
getHADevice,
|
||||
getConstants,
|
||||
FlicHubConstants,
|
||||
} from "./utils";
|
||||
import { virtualDeviceUpdateHandler } from "./virtual_device_update";
|
||||
|
||||
export const startFlicHubController = (
|
||||
ha: HAmqtt,
|
||||
mqtt: MQTT,
|
||||
_options: Partial<FlicHubOptions> = {},
|
||||
) => {
|
||||
const options = makeOptions(_options);
|
||||
const logger = makeLogger("flichub", options.debug);
|
||||
const haDevice = getHADevice(options);
|
||||
const constants: FlicHubConstants = getConstants(ha, options);
|
||||
const availability = [
|
||||
{
|
||||
payload_available: "ON",
|
||||
payload_not_available: "unavailable",
|
||||
topic: constants.LIFELINE_SGINAL.mqttPrefix,
|
||||
},
|
||||
];
|
||||
|
||||
logger.info("starting...");
|
||||
logger.debug("setting up entities...");
|
||||
ha.startLifeLine(
|
||||
"FlicHub Connected",
|
||||
constants.NODE_ID,
|
||||
haDevice,
|
||||
constants.LIFELINE_SGINAL.objectId,
|
||||
);
|
||||
ha.registerEntity(
|
||||
"Action Message",
|
||||
"sensor",
|
||||
constants.NODE_ID,
|
||||
constants.MESSAGE.objectId,
|
||||
haDevice,
|
||||
{
|
||||
icon: "mdi:message",
|
||||
availability,
|
||||
},
|
||||
);
|
||||
ha.publishState(constants.NODE_ID, constants.MESSAGE.objectId, "");
|
||||
|
||||
flichub.on("actionMessage", (obj) => {
|
||||
ha.publishState(constants.NODE_ID, constants.MESSAGE.objectId, obj);
|
||||
});
|
||||
flichub.on("virtualDeviceUpdate", (update) =>
|
||||
virtualDeviceUpdateHandler(
|
||||
ha,
|
||||
logger,
|
||||
haDevice,
|
||||
constants.NODE_ID,
|
||||
update,
|
||||
constants.COMMAND_TOPIC(update.metaData.virtualDeviceId),
|
||||
availability,
|
||||
),
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
import hubinfo from "hubinfo";
|
||||
import { HAmqtt } from "../ha_mqtt/index";
|
||||
|
||||
const NODE_ID = "FlicHub";
|
||||
|
||||
export const makeOptions = (opt: Partial<FlicHubOptions>): FlicHubOptions => ({
|
||||
debug: false,
|
||||
uniqueId: "0",
|
||||
...opt,
|
||||
});
|
||||
export const getHADevice = (options: FlicHubOptions): HADevice => ({
|
||||
name: `FlicHub (${options.uniqueId})`,
|
||||
manufacturer: "Flic",
|
||||
model: `${NODE_ID}${options.uniqueId}`,
|
||||
identifiers: ["FlicHub"],
|
||||
configuration_url: "https://hubsdk.flic.io/",
|
||||
sw_version: hubinfo.firmwareVersion,
|
||||
serial_number: hubinfo.serialNumber,
|
||||
});
|
||||
export type FlicHubConstants = ReturnType<typeof getConstants>;
|
||||
export type FlicHubConstantsNames = keyof FlicHubConstants;
|
||||
export const getConstants = (ha: HAmqtt, options: FlicHubOptions) => {
|
||||
const nodeId = `${NODE_ID}${options.uniqueId}`;
|
||||
return {
|
||||
NODE_ID: nodeId,
|
||||
LIFELINE_SGINAL: ha.genFlicPrefixObject(nodeId, "lifeline"),
|
||||
MESSAGE: ha.genFlicPrefixObject(nodeId, "action-message"),
|
||||
COMMAND_TOPIC: (virtualId: string) =>
|
||||
ha.genFlicPrefixObject(nodeId, `virt-command-${virtualId}`),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
import {
|
||||
VirtualDeviceMetaData,
|
||||
VirtualDeviceType,
|
||||
VirtualDeviceUpdate,
|
||||
} from "flicapp";
|
||||
import { HAmqtt } from "../ha_mqtt/index";
|
||||
import { Logger } from "../Logger";
|
||||
|
||||
const genVirtualDeviceObjectId = ({
|
||||
virtualDeviceId,
|
||||
dimmableType,
|
||||
}: VirtualDeviceMetaData) =>
|
||||
`virt-${dimmableType}-${virtualDeviceId}`.toLowerCase();
|
||||
|
||||
const VirtualDeviceType2HAComponent: Record<VirtualDeviceType, HAComponent> = {
|
||||
Blind: "cover",
|
||||
Light: "light",
|
||||
Speaker: "media_player",
|
||||
};
|
||||
|
||||
const convertStateUpdate2HA = (update: VirtualDeviceUpdate) => {
|
||||
if (update.metaData.dimmableType === "Light") {
|
||||
if (update.values.brightness) {
|
||||
return {
|
||||
brightness: Math.floor(update.values.brightness * 255),
|
||||
state: update.values.brightness > 0 ? "ON" : "OFF",
|
||||
};
|
||||
}
|
||||
if (update.values.colorTemperature) {
|
||||
return {
|
||||
color_temp: Math.floor(update.values.colorTemperature * 255),
|
||||
};
|
||||
}
|
||||
}
|
||||
throw new Error(`${update} is not supported at the moment!`);
|
||||
};
|
||||
export const virtualDeviceUpdateHandler = (
|
||||
ha: HAmqtt,
|
||||
logger: Logger,
|
||||
haDevice: HADevice,
|
||||
nodeId: string,
|
||||
update: VirtualDeviceUpdate,
|
||||
commandTopic: FlicMqttPrefix,
|
||||
availability: any,
|
||||
) => {
|
||||
const objectId = genVirtualDeviceObjectId(update.metaData);
|
||||
const mqttPrefix = ha.genFlicPrefixObject(nodeId, objectId);
|
||||
logger.info(`Handling update for ${update} on ${haDevice}`);
|
||||
ha.registerEntity(
|
||||
update.metaData.virtualDeviceId,
|
||||
VirtualDeviceType2HAComponent[update.metaData.dimmableType],
|
||||
mqttPrefix.nodeId,
|
||||
mqttPrefix.objectId,
|
||||
haDevice,
|
||||
{ availability, command_topic: commandTopic },
|
||||
);
|
||||
ha.publishState(mqttPrefix.nodeId, mqttPrefix.objectId, {
|
||||
brightness: update.values.brightness * 255,
|
||||
});
|
||||
};
|
||||
+56
-76
@@ -1,77 +1,57 @@
|
||||
import {ButtonControllerOpt, makeButtonController} from "./ButtonController";
|
||||
import {HAmqttOptions, makeHAmqtt} from './HAmqtt';
|
||||
import {IRControllerOpt, makeIRController} from "./IRController";
|
||||
import {makeLogger} from "./Logger";
|
||||
import {ButtonModule, IRModule} from './flicTypes';
|
||||
import * as mqtt from './mqtt';
|
||||
import { makeButtonController } from "./button_controller/index";
|
||||
|
||||
export type MQTTOpt = {
|
||||
host: string;
|
||||
port: number;
|
||||
client_id: string;
|
||||
keep_alive: boolean;
|
||||
clean_session: boolean;
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
export type Options = {
|
||||
mqtt: Partial<MQTTOpt> & { host: string };
|
||||
debug?: boolean;
|
||||
ha?: Partial<HAmqttOptions>;
|
||||
flicBtns?: Partial<ButtonControllerOpt> & { disabled?: boolean };
|
||||
flicIR?: Partial<IRControllerOpt> & { disabled?: boolean };
|
||||
}
|
||||
export const start = (
|
||||
buttonModule: ButtonModule,
|
||||
irModule: IRModule,
|
||||
options: Options,
|
||||
) => {
|
||||
const mqttServer = mqtt.create(
|
||||
options.mqtt.host,
|
||||
{...options.mqtt, keep_alive: true},
|
||||
);
|
||||
const logger = makeLogger('root', options.debug ?? false);
|
||||
options.ha = options.ha ?? {};
|
||||
options.flicBtns = options.flicBtns ?? {};
|
||||
options.flicIR = options.flicIR ?? {};
|
||||
options.ha.debug = options.ha.debug ?? options.debug ?? false;
|
||||
options.flicBtns.debug = options.flicBtns.debug ?? options.debug ?? false;
|
||||
options.flicIR.debug = options.flicIR.debug ?? options.debug ?? false;
|
||||
const ha = makeHAmqtt(mqttServer, options.ha);
|
||||
mqttServer.on('connected', () => {
|
||||
logger.info("connected to mqtt");
|
||||
if (!options.flicBtns?.disabled) {
|
||||
makeButtonController(
|
||||
ha, buttonModule, options.flicBtns,
|
||||
).start();
|
||||
}
|
||||
if (!options.flicIR?.disabled) {
|
||||
makeIRController(
|
||||
irModule,
|
||||
ha,
|
||||
mqttServer,
|
||||
options.flicIR,
|
||||
).start();
|
||||
}
|
||||
logger.info("all services up!");
|
||||
});
|
||||
mqttServer.on('error', function (err) {
|
||||
logger.info("'Error' event", JSON.stringify(err));
|
||||
setTimeout(function () {
|
||||
throw new Error("Crashed");
|
||||
}, 1000);
|
||||
});
|
||||
mqttServer.on("disconnected", function (err) {
|
||||
logger.info("'Error' disconnected", JSON.stringify(err));
|
||||
setTimeout(function () {
|
||||
throw new Error("Crashed");
|
||||
}, 1000);
|
||||
});
|
||||
mqttServer.on("close", function (err) {
|
||||
logger.info("'Error' close", JSON.stringify(err));
|
||||
setTimeout(function () {
|
||||
throw new Error("Crashed");
|
||||
}, 1000);
|
||||
});
|
||||
mqttServer.connect();
|
||||
};
|
||||
import { makeHAmqtt } from "./ha_mqtt/index";
|
||||
import { makeIRController } from "./ir_controller/index";
|
||||
|
||||
import { makeLogger } from "./Logger";
|
||||
import * as mqtt from "./mqtt";
|
||||
import { startFlicHubController } from "./hub_controller/index";
|
||||
|
||||
export const start = (options: Options) => {
|
||||
const mqttServer = mqtt.create(options.mqtt.host, {
|
||||
...options.mqtt,
|
||||
keep_alive: true,
|
||||
});
|
||||
const logger = makeLogger("root", options.debug ?? false);
|
||||
options.ha = options.ha ?? {};
|
||||
options.flicBtns = options.flicBtns ?? {};
|
||||
options.flicIR = options.flicIR ?? {};
|
||||
options.flicHub = options.flicHub ?? {};
|
||||
options.ha.debug = options.ha.debug ?? options.debug ?? false;
|
||||
options.flicBtns.debug = options.flicBtns.debug ?? options.debug ?? false;
|
||||
options.flicIR.debug = options.flicIR.debug ?? options.debug ?? false;
|
||||
options.flicHub.debug = options.flicHub.debug ?? options.debug ?? false;
|
||||
const ha = makeHAmqtt(mqttServer, options.ha);
|
||||
mqttServer.on("connected", () => {
|
||||
logger.info("connected to mqtt");
|
||||
if (!options.flicBtns?.disabled) {
|
||||
makeButtonController(ha, options.flicBtns).start();
|
||||
}
|
||||
if (!options.flicIR?.disabled) {
|
||||
makeIRController(ha, mqttServer, options.flicIR).start();
|
||||
}
|
||||
if (!options.flicHub?.disabled) {
|
||||
startFlicHubController(ha, mqttServer, options.flicHub);
|
||||
}
|
||||
logger.info("all services up!");
|
||||
});
|
||||
mqttServer.on("error", function (err) {
|
||||
logger.info("'Error' event", JSON.stringify(err));
|
||||
setTimeout(function () {
|
||||
throw new Error("Crashed");
|
||||
}, 1000);
|
||||
});
|
||||
mqttServer.on("disconnected", function (err) {
|
||||
logger.info("'Error' disconnected", JSON.stringify(err));
|
||||
setTimeout(function () {
|
||||
throw new Error("Crashed");
|
||||
}, 1000);
|
||||
});
|
||||
mqttServer.on("close", function (err) {
|
||||
logger.info("'Error' close", JSON.stringify(err));
|
||||
setTimeout(function () {
|
||||
throw new Error("Crashed");
|
||||
}, 1000);
|
||||
});
|
||||
mqttServer.connect();
|
||||
};
|
||||
@@ -0,0 +1,153 @@
|
||||
import ir from "ir";
|
||||
|
||||
import { HAmqtt } from "../ha_mqtt/index";
|
||||
import { makeLogger } from "../Logger";
|
||||
import { MQTT } from "../mqtt";
|
||||
import {
|
||||
NODE_ID,
|
||||
convertStr2Uint32Array,
|
||||
convertUint32Array2Str,
|
||||
makeOptions,
|
||||
} from "./utils";
|
||||
|
||||
export const makeIRController = (
|
||||
ha: HAmqtt,
|
||||
mqtt: MQTT,
|
||||
options: Partial<IRControllerOpt> = {},
|
||||
) => {
|
||||
options = makeOptions(options);
|
||||
const logger = makeLogger("ir", options.debug);
|
||||
const haDevice: HADevice = {
|
||||
name: "IR",
|
||||
manufacturer: "Flic",
|
||||
model: `${NODE_ID}${options.uniqueId}`,
|
||||
identifiers: ["FlicHubIR"],
|
||||
configuration_url: "https://hubsdk.flic.io/",
|
||||
};
|
||||
const nodeId = `${NODE_ID}${options.uniqueId}`;
|
||||
const LIFELINE_SGINAL = ha.genFlicPrefix(nodeId, "lifeline");
|
||||
const RECORD_SIGNAL_SET = ha.genFlicPrefix(nodeId, "record/set");
|
||||
const VALUE_SIGNAL_SET = ha.genFlicPrefix(nodeId, "signal/set");
|
||||
const VALUE_SIGNAL_STATE = ha.genFlicPrefix(nodeId, "signal");
|
||||
const PLAY_SIGNAL_SET = ha.genFlicPrefix(nodeId, "play/set");
|
||||
const availability = [
|
||||
{
|
||||
payload_available: "ON",
|
||||
payload_not_available: "unavailable",
|
||||
topic: LIFELINE_SGINAL,
|
||||
},
|
||||
];
|
||||
let currentSignal: string | null = null;
|
||||
|
||||
const set_topics = [
|
||||
RECORD_SIGNAL_SET,
|
||||
VALUE_SIGNAL_SET,
|
||||
PLAY_SIGNAL_SET,
|
||||
VALUE_SIGNAL_STATE,
|
||||
];
|
||||
|
||||
return {
|
||||
start() {
|
||||
logger.info("starting...");
|
||||
logger.debug("setting up entities...");
|
||||
ha.startLifeLine("IR Connnected", nodeId, haDevice);
|
||||
ha.registerEntity(
|
||||
"IR Available",
|
||||
"binary_sensor",
|
||||
nodeId,
|
||||
"lifeline",
|
||||
haDevice,
|
||||
{
|
||||
device_class: "connectivity",
|
||||
expire_after: 5,
|
||||
off_delay: 3,
|
||||
entity_category: "diagnostic",
|
||||
payload_available: "ON",
|
||||
payload_not_available: "OFF",
|
||||
},
|
||||
);
|
||||
ha.registerEntity("Record Signal", "switch", nodeId, "record", haDevice, {
|
||||
icon: "mdi:record-rec",
|
||||
command_topic: RECORD_SIGNAL_SET,
|
||||
device_class: "switch",
|
||||
availability,
|
||||
});
|
||||
ha.registerEntity("Signal", "text", nodeId, "signal", haDevice, {
|
||||
command_topic: VALUE_SIGNAL_SET,
|
||||
icon: "mdi:broadcast",
|
||||
max: 255,
|
||||
availability,
|
||||
});
|
||||
ha.registerEntity("Play Signal", "button", nodeId, "play", haDevice, {
|
||||
icon: "mdi:play",
|
||||
command_topic: PLAY_SIGNAL_SET,
|
||||
availability,
|
||||
});
|
||||
logger.debug("setting default states....");
|
||||
ha.publishState(nodeId, "record", "OFF");
|
||||
ha.publishState(nodeId, "play", "OFF");
|
||||
logger.debug("registering events");
|
||||
mqtt.on("message", (topic, message) => {
|
||||
logger.debug("message:", JSON.stringify({ topic, message }));
|
||||
if (topic === RECORD_SIGNAL_SET) {
|
||||
logger.debug("starting record");
|
||||
ir.record();
|
||||
ha.publishState(nodeId, "record", "ON");
|
||||
} else if (topic === PLAY_SIGNAL_SET) {
|
||||
if (currentSignal !== null) {
|
||||
logger.info("playing", currentSignal);
|
||||
let arr: Uint32Array | null = null;
|
||||
try {
|
||||
arr = convertStr2Uint32Array(currentSignal);
|
||||
} catch (err) {
|
||||
logger.error(
|
||||
"invalid string signal set",
|
||||
JSON.stringify(err),
|
||||
err,
|
||||
);
|
||||
return;
|
||||
}
|
||||
ir.play(arr, (err) => {
|
||||
if (err) {
|
||||
logger.error("failed to play signal", JSON.stringify(err), err);
|
||||
} else {
|
||||
logger.debug("signal played!");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
logger.error("cannot play an unset signal");
|
||||
}
|
||||
} else if (topic === VALUE_SIGNAL_STATE) {
|
||||
currentSignal = message;
|
||||
logger.info("setting currentSignal", currentSignal);
|
||||
} else if (topic === VALUE_SIGNAL_SET) {
|
||||
ha.publishState(nodeId, "signal", message, { retain: true });
|
||||
}
|
||||
});
|
||||
ir.on("recordComplete", (data) => {
|
||||
const stringMessage = convertUint32Array2Str(data);
|
||||
logger.debug(
|
||||
"recording completed with",
|
||||
JSON.stringify({
|
||||
data,
|
||||
stringMessage,
|
||||
rev: convertStr2Uint32Array(stringMessage),
|
||||
}),
|
||||
);
|
||||
if (stringMessage.length > 255) {
|
||||
logger.error(
|
||||
"stringMessage is too big! size=",
|
||||
stringMessage.length,
|
||||
"max=255",
|
||||
);
|
||||
}
|
||||
ha.publishState(nodeId, "signal", stringMessage, { retain: true });
|
||||
ha.publishState(nodeId, "record", "OFF");
|
||||
});
|
||||
|
||||
logger.debug("subscribing to", set_topics);
|
||||
mqtt.subscribe(set_topics);
|
||||
logger.info("is up");
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
export const NODE_ID = "FlicHubIR";
|
||||
export const convertUint32Array2Str = (arr: Uint32Array): string => {
|
||||
let outStr = [];
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
outStr.push(arr[i].toString(32));
|
||||
}
|
||||
return outStr.join("_");
|
||||
};
|
||||
export const convertStr2Uint32Array = (s: string): Uint32Array => {
|
||||
const a = s.split("_");
|
||||
return new Uint32Array(a.slice(0, a.length - 2).map((v) => parseInt(v, 32)));
|
||||
};
|
||||
|
||||
export const makeOptions = (
|
||||
opt: Partial<IRControllerOpt>,
|
||||
): IRControllerOpt => ({
|
||||
debug: false,
|
||||
uniqueId: "0",
|
||||
...opt,
|
||||
});
|
||||
+465
-437
File diff suppressed because it is too large.
Load diff
+6
-9
@@ -1,10 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2015",
|
||||
"module": "ESNext"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"rollup.config.ts"
|
||||
],
|
||||
}
|
||||
"compilerOptions": {
|
||||
"target": "ES2015",
|
||||
"module": "ESNext"
|
||||
},
|
||||
"include": ["src/**/*", "rollup.config.ts", "types/*"]
|
||||
}
|
||||
Vendored
+118
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* Flic Hub Studio - Buttons Module
|
||||
* TypeScript Declaration File
|
||||
*/
|
||||
|
||||
declare module "buttons" {
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
/** Button Object Type */
|
||||
export interface Button {
|
||||
bdaddr: string;
|
||||
serialNumber: string;
|
||||
color: string;
|
||||
name: string;
|
||||
activeDisconnect: boolean;
|
||||
connected: boolean;
|
||||
ready: boolean;
|
||||
batteryStatus: number | null;
|
||||
firmwareVersion: number | null;
|
||||
flicVersion: 1 | 2;
|
||||
uuid: string;
|
||||
key?: string; // Only for Flic 2
|
||||
}
|
||||
|
||||
/** ScanWizard Event Types */
|
||||
type ScanWizardEventMap = {
|
||||
foundPrivateButton: [];
|
||||
foundPublicButton: [{ bdaddr: string }];
|
||||
buttonConnect: [{ bdaddr: string }];
|
||||
complete: [{ bdaddr: string }];
|
||||
fail: [{ error: ScanWizardFailReason }];
|
||||
};
|
||||
|
||||
export type ScanWizardFailReason =
|
||||
| "CancelledByUser"
|
||||
| "FailedTimeout"
|
||||
| "ButtonIsPrivate"
|
||||
| "BluetoothUnavailable"
|
||||
| "InternetBackendError"
|
||||
| "InvalidData";
|
||||
|
||||
/** ScanWizard Class */
|
||||
export interface ScanWizard extends EventEmitter {
|
||||
on<K extends keyof ScanWizardEventMap>(
|
||||
event: K,
|
||||
listener: (...args: ScanWizardEventMap[K]) => void,
|
||||
): this;
|
||||
once<K extends keyof ScanWizardEventMap>(
|
||||
event: K,
|
||||
listener: (...args: ScanWizardEventMap[K]) => void,
|
||||
): this;
|
||||
emit<K extends keyof ScanWizardEventMap>(
|
||||
event: K,
|
||||
...args: ScanWizardEventMap[K]
|
||||
): boolean;
|
||||
|
||||
cancel(): void;
|
||||
}
|
||||
|
||||
/** Buttons Event Types */
|
||||
export type ButtonsEventMap = {
|
||||
buttonAdded: [{ button: Button }];
|
||||
buttonUpdated: [{ button: Button }];
|
||||
buttonDeleted: [{ bdaddr: string }];
|
||||
buttonConnected: [{ bdaddr: string }];
|
||||
buttonReady: [{ bdaddr: string }];
|
||||
buttonDisconnected: [{ bdaddr: string }];
|
||||
buttonDown: [{ bdaddr: string }];
|
||||
buttonUp: [{ bdaddr: string }];
|
||||
buttonClickOrHold: [{ bdaddr: string; isClick: boolean; isHold: boolean }];
|
||||
buttonSingleOrDoubleClick: [
|
||||
{ bdaddr: string; isSingleClick: boolean; isDoubleClick: boolean },
|
||||
];
|
||||
buttonSingleOrDoubleClickOrHold: [
|
||||
{
|
||||
bdaddr: string;
|
||||
isSingleClick: boolean;
|
||||
isDoubleClick: boolean;
|
||||
isHold: boolean;
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
/** Buttons Class */
|
||||
export interface Buttons extends EventEmitter {
|
||||
on<K extends keyof ButtonsEventMap>(
|
||||
event: K,
|
||||
listener: (...args: ButtonsEventMap[K]) => void,
|
||||
): this;
|
||||
once<K extends keyof ButtonsEventMap>(
|
||||
event: K,
|
||||
listener: (...args: ButtonsEventMap[K]) => void,
|
||||
): this;
|
||||
emit<K extends keyof ButtonsEventMap>(
|
||||
event: K,
|
||||
...args: ButtonsEventMap[K]
|
||||
): boolean;
|
||||
|
||||
getButtons(): Button[];
|
||||
getButton(bdaddr: string): Button | null;
|
||||
startScanWizard(): ScanWizard;
|
||||
|
||||
importFlic2Pairings(
|
||||
pairings: Array<{
|
||||
bdaddr: string;
|
||||
serialNumber: string;
|
||||
color: string;
|
||||
firmwareVersion: number;
|
||||
uuid: string;
|
||||
key: string;
|
||||
}>,
|
||||
callback: () => void,
|
||||
): void;
|
||||
}
|
||||
|
||||
const buttons: Buttons;
|
||||
export default buttons;
|
||||
}
|
||||
Vendored
+84
@@ -0,0 +1,84 @@
|
||||
declare module "flicapp" {
|
||||
import { EventEmitter } from "events";
|
||||
/**
|
||||
* The FlicApp class allows integration with virtual devices and message actions
|
||||
* configured in the Flic mobile app for use with Flic Twist and other controls.
|
||||
*/
|
||||
export class FlicApp extends EventEmitter {
|
||||
/**
|
||||
* Emitted when a message action configured in the Flic app is triggered.
|
||||
* Useful for advanced Flic Twist configurations like action points in dimming or Scene Blender.
|
||||
*
|
||||
* @event actionMessage
|
||||
* @param message - The configured message string from the Flic app
|
||||
*/
|
||||
on(event: "actionMessage", listener: (message: string) => void): this;
|
||||
|
||||
/**
|
||||
* Emitted when a Flic Twist rotation updates a virtual device.
|
||||
* Only includes the fields that changed in this update.
|
||||
*
|
||||
* @event virtualDeviceUpdate
|
||||
* @param update - Object containing metadata and updated values
|
||||
*/
|
||||
on(
|
||||
event: "virtualDeviceUpdate",
|
||||
listener: (update: VirtualDeviceUpdate) => void,
|
||||
): this;
|
||||
|
||||
/**
|
||||
* Updates the state of a virtual device in the Flic app to reflect external changes.
|
||||
* This keeps the Flic Twist in sync (e.g., LED indicators, small movements).
|
||||
*
|
||||
* Note: For Advanced Dimming and Scene Blender, this is not required as communication is one-way.
|
||||
*
|
||||
* @param type - Type of the virtual device
|
||||
* @param id - Identifier of the virtual device (must match Flic app configuration)
|
||||
* @param values - Partial state update with values between 0 and 1
|
||||
*/
|
||||
virtualDeviceUpdateState(
|
||||
type: VirtualDeviceType,
|
||||
id: string,
|
||||
values: VirtualDeviceValues,
|
||||
): void;
|
||||
}
|
||||
|
||||
/** Supported virtual device types */
|
||||
export type VirtualDeviceType = "Light" | "Blind" | "Speaker";
|
||||
|
||||
/** Metadata included in virtualDeviceUpdate events */
|
||||
export interface VirtualDeviceMetaData {
|
||||
/** ID of the Flic Button or Twist that triggered the change */
|
||||
buttonId: string;
|
||||
/** Type of dimmable device */
|
||||
dimmableType: VirtualDeviceType;
|
||||
/** ID of the virtual device being controlled */
|
||||
virtualDeviceId: string;
|
||||
}
|
||||
|
||||
/** Possible value fields in virtual device updates */
|
||||
export interface VirtualDeviceValues {
|
||||
/** Brightness level (0 to 1) - for Light, Blind, Speaker */
|
||||
brightness?: number;
|
||||
/** Hue (0 to 1) - for Light */
|
||||
hue?: number;
|
||||
/** Saturation (0 to 1) - for Light */
|
||||
saturation?: number;
|
||||
/** Color temperature (0 to 1) - for Light */
|
||||
colorTemperature?: number;
|
||||
/** Volume level (0 to 1) - for Speaker */
|
||||
volume?: number;
|
||||
/** Position (0 to 1) - for Blind */
|
||||
position?: number;
|
||||
}
|
||||
|
||||
/** Full structure of a virtualDeviceUpdate event */
|
||||
export interface VirtualDeviceUpdate {
|
||||
metaData: VirtualDeviceMetaData;
|
||||
values: VirtualDeviceValues;
|
||||
}
|
||||
|
||||
/** The exported module instance */
|
||||
const flicapp: FlicApp;
|
||||
export default flicapp;
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
declare module "hubinfo" {
|
||||
export interface HubInfo {
|
||||
serialNumber: string;
|
||||
firmwareVersion: string;
|
||||
}
|
||||
const hubinfo: HubInfo;
|
||||
export default hubinfo;
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Flic Hub Studio - IR Module
|
||||
* TypeScript Declaration File
|
||||
*/
|
||||
|
||||
declare module "ir" {
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
/** IR Class */
|
||||
export interface IR extends EventEmitter {
|
||||
on(event: "recordComplete", listener: (arr: Uint32Array) => void): this;
|
||||
once(event: "recordComplete", listener: (arr: Uint32Array) => void): this;
|
||||
emit(event: "recordComplete", arr: Uint32Array): boolean;
|
||||
|
||||
record(): void;
|
||||
cancelRecord(): void;
|
||||
play(arr: Uint32Array, callback: (error: any) => void): void;
|
||||
}
|
||||
|
||||
const ir: IR;
|
||||
export default ir;
|
||||
}
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
type HADevice = {
|
||||
name: string;
|
||||
identifiers: string[];
|
||||
manufacturer: string;
|
||||
model: string;
|
||||
sw_version?: string;
|
||||
hw_version?: string;
|
||||
serial_number?: string;
|
||||
configuration_url?: string;
|
||||
};
|
||||
type HAComponent =
|
||||
| "cover"
|
||||
| "media_player"
|
||||
| "light"
|
||||
| "sensor"
|
||||
| "binary_sensor"
|
||||
| "button"
|
||||
| "switch"
|
||||
| "text"
|
||||
| "device_automation";
|
||||
type FlicMqttPrefix = {
|
||||
nodeId: string;
|
||||
objectId: string;
|
||||
mqttPrefix: string;
|
||||
};
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
type HAmqttOptions = {
|
||||
debug: boolean;
|
||||
topics: {
|
||||
homeassistant: string;
|
||||
flic: string;
|
||||
};
|
||||
};
|
||||
type MQTTPublishOpt = {
|
||||
retain?: boolean; // the server should retain this message and send it out again to new subscribers
|
||||
dup?: boolean; // indicate the message is a duplicate because original wasn't ACKed (QoS > 0 only)
|
||||
};
|
||||
type ButtonControllerOpt = {
|
||||
debug: boolean;
|
||||
};
|
||||
type IRControllerOpt = {
|
||||
uniqueId: string;
|
||||
debug: boolean;
|
||||
};
|
||||
type FlicHubOptions = {
|
||||
uniqueId: string;
|
||||
debug: boolean;
|
||||
};
|
||||
type MQTTOpt = {
|
||||
host: string;
|
||||
port: number;
|
||||
client_id: string;
|
||||
keep_alive: boolean;
|
||||
clean_session: boolean;
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
type Options = {
|
||||
mqtt: Partial<MQTTOpt> & { host: string };
|
||||
debug?: boolean;
|
||||
ha?: Partial<HAmqttOptions>;
|
||||
flicBtns?: Partial<ButtonControllerOpt> & { disabled?: boolean };
|
||||
flicIR?: Partial<IRControllerOpt> & { disabled?: boolean };
|
||||
flicHub?: Partial<FlicHubOptions> & { disabled?: boolean };
|
||||
};
|
||||
Reference in new issue
Block a user