testing integration

This commit is contained in:
Jatus 2024-01-29 16:49:36 +01:00
parent 04e4a08ac9
commit 76345fae59
5 changed files with 74 additions and 9 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: ports:
5540/tcp: 5540 5540/tcp: 5540
hassio_role: admin hassio_role: homeassistant
hassio_api: true hassio_api: true
homeassistant_api: true
auth_api: true
map:
- addon_config:rw

View File

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

View File

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