Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Lagg committed Nov 19, 2023
1 parent 6f9f713 commit a8c0953
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 52 deletions.
52 changes: 37 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
// for development container on remote pi we need to clone source into the remote container, instead of bind:
"workspaceFolder": "/workspaces/hacs-govee",
"workspaceMount": "source=/usr/share/hassio/share/dev/hacs-govee,target=/workspaces/hacs-govee,type=bind,consistency=delegated",
// "workspaceFolder": "/workspaces/hacs-govee",
// "workspaceMount": "source=/usr/share/hassio/share/dev/hacs-govee,target=/workspaces/hacs-govee,type=bind,consistency=delegated",
// "remoteEnv": {
// "WS_PATH": "..",
// },
Expand All @@ -11,13 +11,15 @@
// },
//TODO: finish your own container for faster dev setup
//"image": "laggat/hacs-base-container",
"image": "ludeeus/container:python-base-debian",
//cannot use arm64 Image from here, as my raspberry is ARMv7 (32bit)
// "image": "ghcr.io/ludeeus/debian/base:latest",
//"image": "ludeeus/container:python-base-debian",
"image": "ghcr.io/laggat/ha-devcontainer:main",
//"dockerFile": "Dockerfile",
"name": "Govee integration development",
"context": "..",
// "appPort": [
// "9123:8123"
// ],
"appPort": [
"9123:8123"
],
"postCreateCommand": "/bin/chmod +x /workspaces/hacs-govee/.devcontainer/*.sh && /workspaces/hacs-govee/.devcontainer/postCreateContainer.sh",
"extensions": [
"cschleiden.vscode-github-actions",
Expand All @@ -29,10 +31,18 @@
"ms-python.python",
"ms-python.vscode-pylance",
"ryanluker.vscode-coverage-gutters",
"tht13.python",
"tht13.python"
],
"settings": {
"files.eol": "\n",
//linux line breaks
"files.eol": "\n",
//prefer ZSH shell
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.tabSize": 4,
"python.pythonPath": "/usr/bin/python3",
"python.analysis.autoSearchPaths": false,
Expand All @@ -44,24 +54,25 @@
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
// to develop on your raspberry pi 4 (for BLE):
"docker.host": "ssh://[email protected]",
//"docker.host": "ssh://[email protected]"
// also set docker.host for this workspace in vscode
// create keys with "ssh-keygen -t rsa -b 4096"
// also run this on your pi
// copy your local id-rsa.pub content to /root/.ssh/authorized_keys
// copy your local C:\Users\root\.ssh\id_rsa.pub content to /root/.ssh/authorized_keys
// then configure remote-ssh to use key auth: "Remote-SSH: Open Configuration file":
// Host 192.168.144.5
// HostName 192.168.144.5
// User root
// ForwardAgent yes
// IdentityFile C:\Users\root\.ssh\id_rsa
// then in "Remote Containers: Re-build and re-open in container"
// if this doesn't work or takes forever: stop frigate, or any cpu hungry process on your pi! Also check if your local "Docker Desktop" is working (if not: reinstall)!
},
"runArgs": [
"--name",
"devcontainer_govee",
"--network",
"host",
// "--network",
// "host",
"--privileged",
"-v",
"/etc/machine-id:/etc/machine-id:ro",
Expand All @@ -70,6 +81,17 @@
"-v",
"/dev:/dev:ro",
"-v",
"/run/udev:/run/udev:ro",
]
"/run/udev:/run/udev:ro"
],
//Environment Variables to set in the dev container
"containerEnv": {},
//security options
"securityOpt": [
"seccomp:unconfined",
"apparmor:unconfined"
],
//user defaults to vscode, let's use root for easier handling for now
"remoteUser": "root",
"containerUser": "root",
"context": ".."
}
19 changes: 10 additions & 9 deletions .devcontainer/postCreateContainer.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#!/bin/bash

/bin/echo ------------ postCreateCommand apt-get ------------
#TODO: remove unused
apt-get update
apt-get -y install bash bluetooth bluez bluez-tools build-essential ca-certificates cargo cython gcc git iputils-ping libatomic1 libavcodec-dev libc-dev libffi-dev libjpeg-dev libpcap-dev libssl-dev make nano openssh-client procps python3 python3-dev python3-pip python3-setuptools rfkill unzip wget wget zlib1g-dev

/bin/echo ------------ postCreateCommand container install ------------
mkdir -p /src/ludeeus
cd /src/ludeeus
git clone https://github.com/ludeeus/container
cp -r ./container/rootfs/common/* /
chmod +x /usr/bin/container
/usr/bin/container install
#activate all custom_components in /workspaces/...
/usr/local/bin/dev component activate --all

/workspaces/hacs-govee/.devcontainer/postHassUpdated.sh
# install dependencies

/bin/echo ------------ postCreateCommand finished ------------


#start home assistant in background
/usr/local/bin/dev ha start &

#/bin/echo ------------ postCreateCommand finished ------------
26 changes: 0 additions & 26 deletions .devcontainer/postHassUpdated.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .git-subtree/python-govee-api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
long_description = fh.read()

INSTALL_REQUIRES = [
"aiohttp>=3.7.1",
"aiohttp>=3.7.4.post0",
"bios>=0.1.2",
"certifi>=2021.10.8",
"dacite>=1.6.0",
Expand Down
1 change: 1 addition & 0 deletions custom_components/govee/govee
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
asynctest>=0.12.3
asynctest>=0.13.0
black>=22.3.0
colorlog==4.6.2
coveralls
Expand Down

0 comments on commit a8c0953

Please sign in to comment.