Skip to content

Commit

Permalink
interactor: changing how the home assistant plugin works
Browse files Browse the repository at this point in the history
Pre-building the docker image is proving difficult and I'd rather it was
using the hassio images. For now am replacing the prebuilt images with a
Dockerfile in the addon repository
  • Loading branch information
delfick committed Nov 20, 2022
1 parent 62b53cb commit b5ae273
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 36 deletions.
37 changes: 9 additions & 28 deletions .github/workflows/release-interactor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- run: python3 -m pip install venvstarter

- name: Enable experimental features for the Docker daemon and CLI
if: github.event.inputs.skipdockermain == '0'
run: |
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
mkdir -p ~/.docker
Expand All @@ -42,12 +43,15 @@ jobs:

- id: version
run: |
printf "::set-output name=version::%s\n" $(python -c "import runpy; print(runpy.run_path('apps/interactor/interactor/__init__.py')['VERSION'])")
printf "::set-output name=versiondash::%s\n" $(python -c "import runpy; print(runpy.run_path('apps/interactor/interactor/__init__.py')['VERSION'].replace('.', '-'))")
version=$(python -c "import runpy; print(runpy.run_path('apps/interactor/interactor/__init__.py')['VERSION'])")
versiondash=$(python -c "import runpy; print(runpy.run_path('apps/interactor/interactor/__init__.py')['VERSION'].replace('.', '-'))")
echo "version=$version" >> $GITHUB_OUTPUT
echo "versiondash=$versiondash" >> $GITHUB_OUTPUT
- id: package
run: >
printf "::set-output name=package::lifx-photons-interactor-${{ steps.version.outputs.version}}.tar.gz"
echo "package=lifx-photons-interactor-${{ steps.version.outputs.version}}.tar.gz" >> $GITHUB_OUTPUT
- id: create_release
uses: actions/create-release@v1
Expand Down Expand Up @@ -91,13 +95,6 @@ jobs:
tar xf context_lifx-photons-interactor.tar
rm context_lifx-photons-interactor.tar
cd ..
mkdir staging-homeassistant
cd staging-homeassistant
../apps/interactor/docker/harpoon get_docker_context lifx-photons-interactor-homeassistant
tar xf context_lifx-photons-interactor-homeassistant.tar
rm context_lifx-photons-interactor-homeassistant.tar
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1

Expand All @@ -106,10 +103,6 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- id: repository_owner
run: |
printf "::set-output name=lowercase::%s\n" $(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')
- name: Build and push
uses: docker/build-push-action@v2
if: github.event.inputs.skipdockermain == '0'
Expand All @@ -119,17 +112,5 @@ jobs:
platforms: linux/386,linux/arm64,linux/amd64,linux/arm/v7,linux/arm/v6
push: true
tags: |
${{ steps.repository_owner.outputs.lowercase }}/lifx-photons-interactor:latest
${{ steps.repository_owner.outputs.lowercase }}/lifx-photons-interactor:${{ steps.version.outputs.version }}
- name: Build and push
uses: docker/build-push-action@v2
if: github.event.inputs.skipdockerha == '0'
with:
context: staging-homeassistant
file: ./staging-homeassistant/Dockerfile
platforms: linux/386,linux/arm64,linux/amd64,linux/arm/v7,linux/arm/v6
push: true
tags: |
${{ steps.repository_owner.outputs.lowercase }}/lifx-photons-interactor-homeassistant:latest
${{ steps.repository_owner.outputs.lowercase }}/lifx-photons-interactor-homeassistant:${{ steps.version.outputs.version }}
${{ github.repository_owner }}/lifx-photons-interactor:latest
${{ github.repository_owner }}/lifx-photons-interactor:${{ steps.version.outputs.version }}
8 changes: 0 additions & 8 deletions apps/interactor/docker/harpoon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,3 @@ images:
- ENV INTERACTOR_HOST 0.0.0.0
- HEALTHCHECK CMD lifx interactor_healthcheck --silent || exit 1
- CMD ["lifx", "lan:interactor"]

lifx-photons-interactor-homeassistant:
context: false

commands:
- [FROM, "delfick/lifx-photons-interactor:{VERSION:from_env}"]
- WORKDIR /data
- LABEL io.hass.version="0.8.5" io.hass.type="addon" io.hass.arch="aarch64|amd64|armhf|armv7|i386"
7 changes: 7 additions & 0 deletions apps/interactor/docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Changelog
=========

.. _release-interactor-0-12-5:

0.12.5 - TBD
* Added GET /v1/lifx/status that returns "working"
* Removed prebuilt homeassistant image and changed the plugin to offer
a Dockerfile that is built on installation instead

.. _release-interactor-0-12-4:

0.12.4 - 27 July 2022
Expand Down
5 changes: 5 additions & 0 deletions apps/interactor/docs/homeassistant.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ Interactor do things to your devices:
}
Will use the interactor to change all of your lights to red.

A custom lifx.yml configuration may also be provided by placing a ``lifx.yml``
file in a ``photons`` folder in the home assistant ``config`` share.

See https://www.home-assistant.io/docs/configuration/
6 changes: 6 additions & 0 deletions apps/interactor/interactor/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
REQUEST_IDENTIFIER_HEADER = "X-Request-ID"


class StatusHandler(tornado.web.RequestHandler):
def get(self):
self.write("working")


class Commander(Commander):
def peek_valid_request(self, meta, command, path, body):
request = meta.everything["request_handler"].request
Expand Down Expand Up @@ -138,6 +143,7 @@ def tornado_routes(self):
"wsconnections": self.wsconnections,
},
),
("/v1/lifx/status", StatusHandler),
]

async def setup(self, server_options, *, tasks, sender, cleaners, animation_options=None):
Expand Down

0 comments on commit b5ae273

Please sign in to comment.