Compare commits
1 Commits
9a3f622941
...
c3df0aa619
Author | SHA1 | Date | |
---|---|---|---|
c3df0aa619 |
22
.github/workflows/docker-image.yml
vendored
22
.github/workflows/docker-image.yml
vendored
@ -1,7 +1,6 @@
|
|||||||
name: Publish Docker image
|
name: Publish Docker image
|
||||||
|
|
||||||
on:
|
on: push
|
||||||
push
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
push_to_registry:
|
push_to_registry:
|
||||||
@ -11,8 +10,18 @@ jobs:
|
|||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Run read-yaml action
|
||||||
|
id: yaml-data
|
||||||
|
uses: jbutcher5/read-yaml@1.6
|
||||||
|
with:
|
||||||
|
file: "./matter-bridge/config.yml"
|
||||||
|
key-path: '["version"]'
|
||||||
|
|
||||||
|
- name: Display read-yaml output
|
||||||
|
run: echo "${{ steps.yaml-data.outputs.data }}"
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
uses: docker/login-action@v3.0.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
@ -20,12 +29,15 @@ jobs:
|
|||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ghcr.io/${{ github.repository }}
|
images: ghcr.io/${{ github.repository }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ steps.yaml-data.outputs.data }}
|
||||||
|
type=raw,value=latest
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
|
uses: docker/build-push-action@v5.1.0
|
||||||
with:
|
with:
|
||||||
context: ./matter-bridge
|
context: ./matter-bridge
|
||||||
file: ./matter-bridge/Dockerfile
|
file: ./matter-bridge/Dockerfile
|
||||||
|
@ -35,10 +35,10 @@ export class HAMiddleware {
|
|||||||
|
|
||||||
subscribe() {
|
subscribe() {
|
||||||
this.hassClient.on('state_changed', (event) => {
|
this.hassClient.on('state_changed', (event) => {
|
||||||
this.logger.debug(event);
|
this.logger.debug(JSON.stringify(event));
|
||||||
const toDo = this.functionsToCallOnChange[event.data.entity_id];
|
const toDo = this.functionsToCallOnChange[event.data.entity_id];
|
||||||
if (toDo) {
|
if (toDo) {
|
||||||
toDo(event.data);
|
toDo(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ export class HAMiddleware {
|
|||||||
},
|
},
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
this.logger.debug({ getStates: sorted });
|
this.logger.debug(JSON.stringify({ getStates: sorted }));
|
||||||
this.entities = sorted;
|
this.entities = sorted;
|
||||||
return this.entities;
|
return this.entities;
|
||||||
}
|
}
|
||||||
@ -75,7 +75,9 @@ export class HAMiddleware {
|
|||||||
prev[key].push(states[current]);
|
prev[key].push(states[current]);
|
||||||
return prev;
|
return prev;
|
||||||
}, {});
|
}, {});
|
||||||
this.logger.debug({ getStatesPartitionedByType: toReturn });
|
this.logger.debug(
|
||||||
|
JSON.stringify({ getStatesPartitionedByType: toReturn })
|
||||||
|
);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@ export const addDimmerableLightDevice: AddHaDeviceToBridge = (
|
|||||||
const device = new DimmableLightDevice(
|
const device = new DimmableLightDevice(
|
||||||
{ onOff: haEntity.state === 'on' },
|
{ onOff: haEntity.state === 'on' },
|
||||||
{
|
{
|
||||||
currentLevel: Number(haEntity.attributes['brightness']) || null,
|
currentLevel:
|
||||||
|
Number(haEntity.attributes['brightness']) / 255 || null,
|
||||||
onLevel: 0.1,
|
onLevel: 0.1,
|
||||||
options: { coupleColorTempToLevel: false, executeIfOff: false },
|
options: { coupleColorTempToLevel: false, executeIfOff: false },
|
||||||
}
|
}
|
||||||
@ -50,6 +51,8 @@ export const addDimmerableLightDevice: AddHaDeviceToBridge = (
|
|||||||
haMiddleware.subscrieToDevice(
|
haMiddleware.subscrieToDevice(
|
||||||
haEntity.entity_id,
|
haEntity.entity_id,
|
||||||
(event: StateChangedEvent) => {
|
(event: StateChangedEvent) => {
|
||||||
|
LOGGER.debug(`Event for device ${haEntity.entity_id}`);
|
||||||
|
LOGGER.debug(JSON.stringify(event));
|
||||||
device.setOnOff(event.data.new_state?.state === 'on');
|
device.setOnOff(event.data.new_state?.state === 'on');
|
||||||
device.setCurrentLevel(
|
device.setCurrentLevel(
|
||||||
(event.data.new_state?.attributes as never)['brightness']
|
(event.data.new_state?.attributes as never)['brightness']
|
||||||
|
@ -33,6 +33,8 @@ export const addOnOffLightDevice: AddHaDeviceToBridge = (
|
|||||||
haMiddleware.subscrieToDevice(
|
haMiddleware.subscrieToDevice(
|
||||||
haEntity.entity_id,
|
haEntity.entity_id,
|
||||||
(event: StateChangedEvent) => {
|
(event: StateChangedEvent) => {
|
||||||
|
LOGGER.debug(`Event for device ${haEntity.entity_id}`);
|
||||||
|
LOGGER.debug(JSON.stringify(event));
|
||||||
device.setOnOff(event.data.new_state?.state === 'on');
|
device.setOnOff(event.data.new_state?.state === 'on');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user