-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c776f64
Showing
8 changed files
with
727 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
__pycache__/ | ||
venv/ | ||
state.json | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Thymis Modules | ||
|
||
This repository contains thymis modules. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
description = ""; | ||
inputs = { | ||
}; | ||
outputs = { self }: { | ||
}; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[tool.poetry] | ||
name = "thymis_modules" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Adrian Block <[email protected]>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
thymis-controller = { git = "https://github.com/thymis-io/thymis.git", subdirectory = "controller" } | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import thymis_controller | ||
import thymis_controller.lib | ||
import pathlib | ||
|
||
from thymis_controller.models import Setting, ModuleSettings | ||
from thymis_controller.modules import Module | ||
|
||
|
||
class HomeAssistant(Module): | ||
displayName: str = "Home Assistant" | ||
icon: str = thymis_controller.lib.read_into_base64( | ||
pathlib.Path(__file__).parent / "assets" / "home-assistant.png" | ||
) | ||
|
||
|
||
timezone = Setting( | ||
name="homeassistant.timezone", | ||
type="string", | ||
default="Europe/Berlin", | ||
description="The timezone for Home Assistant.", | ||
example="Europe/Berlin", | ||
) | ||
|
||
def write_nix_settings( | ||
self, f, module_settings: thymis_controller.models.ModuleSettings, priority: int | ||
): | ||
timezone = ( | ||
module_settings.settings["timezone"] | ||
if "timezone" in module_settings.settings | ||
else self.timezone.default | ||
) | ||
f.write( | ||
f""" | ||
services.home-assistant.enable = true; | ||
services.home-assistant.openFirewall = true; | ||
services.home-assistant.config.homeassistant.time_zone = "{timezone}"; | ||
""" | ||
) | ||
|
||
class HomeAssistant(Module): | ||
displayName: str = "Home Assistant" | ||
icon: str = thymis_controller.lib.read_into_base64( | ||
pathlib.Path(__file__).parent / "assets" / "home-assistant.png" | ||
) | ||
|
||
|
||
timezone = Setting( | ||
name="homeassistant.timezone", | ||
type="string", | ||
default="Europe/Berlin", | ||
description="The timezone for Home Assistant.", | ||
example="Europe/Berlin", | ||
) | ||
|
||
def write_nix_settings( | ||
self, f, module_settings: thymis_controller.models.ModuleSettings, priority: int | ||
): | ||
timezone = ( | ||
module_settings.settings["timezone"] | ||
if "timezone" in module_settings.settings | ||
else self.timezone.default | ||
) | ||
f.write( | ||
f""" | ||
services.home-assistant.enable = true; | ||
services.home-assistant.openFirewall = true; | ||
services.home-assistant.config.homeassistant.time_zone = "{timezone}"; | ||
""" | ||
) |