testing integration

This commit is contained in:
Jatus 2024-01-29 16:49:36 +01:00
parent 04e4a08ac9
commit dc4a381bce
5 changed files with 72 additions and 8 deletions

View File

@ -0,0 +1,36 @@
{
"name": "devcontainer for add-on repositories",
"image": "ghcr.io/home-assistant/devcontainer:addons",
"appPort": [
"7123:8123",
"7357:4357"
],
"postStartCommand": "bash devcontainer_bootstrap",
"runArgs": [
"-e",
"GIT_EDITOR=code --wait",
"--privileged"
],
"containerEnv": {
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
},
"extensions": [
"timonwong.shellcheck",
"esbenp.prettier-vscode"
],
"mounts": [
"type=volume,target=/var/lib/docker"
],
"settings": {
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}

20
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,20 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Home Assistant",
"type": "shell",
"command": "supervisor_run",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}

View File

@ -9,5 +9,9 @@ arch:
ports:
5540/tcp: 5540
hassio_role: admin
hassio_role: homeassistant
hassio_api: true
homeassistant_api: true
auth_api: true
map:
- addon_config:rw

View File

@ -26,12 +26,14 @@ export class Bridge {
private static readonly vendorName = getParameter('vendor') || 'Jatus';
private static readonly productName = 'HomeAssistant';
private static readonly port = getIntParameter('port') ?? 5540;
private ready = false;
private matterServer: MatterServer;
private static instace: Bridge;
private logger = new Logger('bridge');
private storageManager: StorageManager;
private aggregator: Aggregator;
private commissioningServer: CommissioningServer | undefined;
private constructor(
matterServer: MatterServer,
@ -106,20 +108,22 @@ export class Bridge {
typeof BridgedDeviceBasicInformationCluster.attributes
>
) {
// const id = getIntParameter('uniqueid');
if (!this.commissioningServer?.isCommissioned()) {
this.logger.warn('System not initialized, may cause crashes');
}
this.aggregator.addBridgedDevice(device, bridgedBasicInformation);
}
async start() {
this.logger.info('Starting...');
const commissioningServer =
this.commissioningServer =
await this.setupContextAndCommissioningServer();
commissioningServer.addDevice(this.aggregator);
this.matterServer.addCommissioningServer(commissioningServer);
this.commissioningServer.addDevice(this.aggregator);
this.matterServer.addCommissioningServer(this.commissioningServer);
await this.matterServer.start();
this.logger.info('Listening');
if (!commissioningServer.isCommissioned()) {
const pairingData = commissioningServer.getPairingCode();
if (!this.commissioningServer.isCommissioned()) {
const pairingData = this.commissioningServer.getPairingCode();
const { qrPairingCode, manualPairingCode } = pairingData;
console.log(QrCode.get(qrPairingCode));

View File

@ -16,7 +16,7 @@ export function serverSetup(): {
storageManager: StorageManager;
} {
if (!(MATTER_SERVER && STORAGE && STORAGE_MANAGER)) {
const storageLocation = getParameter('store') || './deviceData';
const storageLocation = getParameter('store') || '/config/deviceData';
STORAGE = new StorageBackendDisk(
storageLocation,