Skip to content

Commit

Permalink
Add some debug output, publish on all pushes to main
Browse files Browse the repository at this point in the history
  • Loading branch information
yusijs committed Aug 8, 2023
1 parent 469f1eb commit 20fe88d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 6 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/publish-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Docker image

on:
push:
branches:
- main

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: yusijs
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: yusijs/homely-mqtt
tags: |
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }},yusijs/homely-mqtt:dev
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion config/local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ database:
mqtt:
# Set to false to disable mqtt. This will log all messages to the console.
# Useful for testing the setup.
enabled: true
enabled: false
qos: 1
host: mqtt://192.168.86.38:1883
user: homely
Expand Down
15 changes: 10 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,16 @@ async function updateAndCreateEntities(homeData: Home) {
await init();
const homes = await locations();
logger.info(`Loaded ${homes.length} homes`);
logger.debug(homes);

for (const location of homes) {
const homeData = await home(location.locationId);
await updateAndCreateEntities(homeData);
await pollHomely(location.locationId);
await listenToSocket(location.locationId);
try {
for (const location of homes) {
const homeData = await home(location.locationId);
await updateAndCreateEntities(homeData);
await pollHomely(location.locationId);
await listenToSocket(location.locationId);
}
} catch (ex) {
logger.fatal(ex);
}
})();

0 comments on commit 20fe88d

Please sign in to comment.