Compare commits

...
6 Commits
Author SHA1 Message Date
ari 8bcbcaa801 added a redirect 2022-08-06 20:03:10 -04:00
ari b479476833 fixed up invalid node issue 2022-08-06 15:29:41 -04:00
Przemysław Adam Sowa baa31ab649 Don't use network host mode in the example docker-compose.yaml (#128) 2022-08-06 14:20:27 -04:00
Ari Sosnovsky dc7c6273e4 Update README.md 2022-08-06 13:16:34 -04:00
Ari Sosnovsky 2942b6173b Update README.md 2022-08-05 23:41:46 -04:00
ari bcfc648011 controls 2022-08-05 23:35:47 -04:00
9 changed files with 83 additions and 8 deletions

No files matched your search

+7
View File
@@ -1,5 +1,12 @@
# Changelog ![GitHub release (latest by date)](https://img.shields.io/github/v/release/asosnovsky/Shortumation?label=&style=for-the-badge) # Changelog ![GitHub release (latest by date)](https://img.shields.io/github/v/release/asosnovsky/Shortumation?label=&style=for-the-badge)
## [0.5.2] - Better Controls
- Add automation trigger
- Speed dial on the bottom
<img src="https://user-images.githubusercontent.com/7451445/183231968-9891bbb4-5c7c-4e05-b804-36978c809a5c.png" width="200px"/>
- Infinite undos <img src="https://user-images.githubusercontent.com/7451445/183231977-ed000017-2886-4a57-b5fb-c7e527bf3894.png" width="200px"/>
## [0.5.1] - Sidebar! ## [0.5.1] - Sidebar!
- completely redesigned the sidebar! - completely redesigned the sidebar!
+6 -2
View File
@@ -1,4 +1,4 @@
# Shortumation ![GitHub release (latest by date)](https://img.shields.io/github/v/release/asosnovsky/Shortumation?label=&style=platsic) # <img src="logo.png" height="40x"/> Shortumation ![GitHub release (latest by date)](https://img.shields.io/github/v/release/asosnovsky/Shortumation?label=&style=platsic)
[![Test](https://github.com/asosnovsky/Shortumation/actions/workflows/test.yml/badge.svg)](https://github.com/asosnovsky/Shortumation/actions/workflows/test.yml) [![Build](https://github.com/asosnovsky/Shortumation/actions/workflows/build.yml/badge.svg)](https://github.com/asosnovsky/Shortumation/actions/workflows/build.yml) [![Test](https://github.com/asosnovsky/Shortumation/actions/workflows/test.yml/badge.svg)](https://github.com/asosnovsky/Shortumation/actions/workflows/test.yml) [![Build](https://github.com/asosnovsky/Shortumation/actions/workflows/build.yml/badge.svg)](https://github.com/asosnovsky/Shortumation/actions/workflows/build.yml)
@@ -6,7 +6,9 @@
| ------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | ------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| Version | ![GitHub release (latest by date)](https://img.shields.io/github/v/release/asosnovsky/Shortumation?label=&style=for-the-badge) | ![Docker Image Version (latest semver)](https://img.shields.io/docker/v/asosnovsky/shortumation-amd64?&sort=date&label=&style=for-the-badge) | | Version | ![GitHub release (latest by date)](https://img.shields.io/github/v/release/asosnovsky/Shortumation?label=&style=for-the-badge) | ![Docker Image Version (latest semver)](https://img.shields.io/docker/v/asosnovsky/shortumation-amd64?&sort=date&label=&style=for-the-badge) |
A [home-assistant addon](https://www.home-assistant.io/addons/) for a better UI for managing and writing your automations. We provide a way to visualize your automation using a visual-programming language that draws inspirations from [Node-Red](https://nodered.org/). A [home-assistant addon](https://www.home-assistant.io/addons/) for a better UI for managing and writing your automations. We provide a way to visualize your automation using a visual-programming language that draws inspirations from [Node-Red](https://nodered.org/).
<img src="./assets/comparisons.png">
## Features ## Features
@@ -46,6 +48,8 @@ Add the repository URL under **Supervisor → Add-on store → ⋮ → Manage ad
It should now appear in your `Add-on Store` and you should be able to install it! It should now appear in your `Add-on Store` and you should be able to install it!
**Please note that you may need to enable advance mode in your settings first!**
### Containerized or HA Core ### Containerized or HA Core
Please note that this way of using Shortumation is **not future proof**. Please note that this way of using Shortumation is **not future proof**.
+11 -1
View File
@@ -1,6 +1,7 @@
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles from fastapi.staticfiles import StaticFiles
from fastapi.responses import RedirectResponse
from src.automations.manager import AutomationManager from src.automations.manager import AutomationManager
from src.env import API_PREFIX, ORIGIN, ROOT_FOLDER from src.env import API_PREFIX, ORIGIN, ROOT_FOLDER
@@ -10,7 +11,8 @@ from .routes import automations, details, ping, socket
def make_app(automation_mgr: AutomationManager) -> FastAPI: def make_app(automation_mgr: AutomationManager) -> FastAPI:
app = FastAPI() app = FastAPI()
if (ROOT_FOLDER / "web").exists(): has_web_folder = (ROOT_FOLDER / "web").exists()
if has_web_folder:
app.mount( app.mount(
f"{API_PREFIX}/web", f"{API_PREFIX}/web",
StaticFiles( StaticFiles(
@@ -19,6 +21,7 @@ def make_app(automation_mgr: AutomationManager) -> FastAPI:
), ),
name="web", name="web",
) )
else: else:
print("WARN: could not find web folder") print("WARN: could not find web folder")
app.add_middleware( app.add_middleware(
@@ -36,4 +39,11 @@ def make_app(automation_mgr: AutomationManager) -> FastAPI:
details.make_details_router(automation_mgr.hass_config), prefix=f"{API_PREFIX}/details" details.make_details_router(automation_mgr.hass_config), prefix=f"{API_PREFIX}/details"
) )
app.include_router(socket.router, prefix=f"{API_PREFIX}/socket") app.include_router(socket.router, prefix=f"{API_PREFIX}/socket")
@app.get("/")
def get_index():
if has_web_folder:
return RedirectResponse("/web")
return RedirectResponse("/details")
return app return app
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

+1 -1
View File
@@ -1,5 +1,5 @@
name: Shortumation name: Shortumation
version: v0.5.1 version: v0.5.2
slug: shortumation slug: shortumation
image: asosnovsky/shortumation-{arch} image: asosnovsky/shortumation-{arch}
url: "https://github.com/asosnovsky/Shortumation" url: "https://github.com/asosnovsky/Shortumation"
+5 -2
View File
@@ -12,9 +12,12 @@ services:
shortumation: shortumation:
# make sure to replace the ARCH with whatever system you are running! # make sure to replace the ARCH with whatever system you are running!
image: "asosnovsky/shortumation-${ARCH:-amd64}:${SHORTUMATION_VERSION:-latest}" image: "asosnovsky/shortumation-${ARCH:-amd64}:${SHORTUMATION_VERSION:-latest}"
network_mode: host ports:
- 8000:8000
extra_hosts:
- "host.docker.internal:host-gateway"
volumes: volumes:
- ./config:/config - ./config:/config
environment: environment:
- SUPERVISOR_TOKEN=${SUPERVISOR_TOKEN} - SUPERVISOR_TOKEN=${SUPERVISOR_TOKEN}
- HASSIO_WS=ws://0.0.0.0:8123/api/websocket - HASSIO_WS=ws://host.docker.internal:8123/api/websocket
@@ -120,3 +120,54 @@ export const MissingAutoInConfig = make({
entitySource: {}, entitySource: {},
}, },
}); });
export const BadAutomation = make({
haProps: {
loading: false,
entities: {
[`automation.${auto1.metadata.id}`]: {
entity_id: `automation.${auto1.metadata.id}`,
attributes: {
id: "test",
},
context: { id: "", parent_id: null, user_id: null },
last_changed: "",
last_updated: "",
state: "on",
},
},
entitySource: {},
},
automations: [
{
tags: {},
metadata: {
id: "test",
mode: "single",
alias: "Light.Tank_Day",
description: "",
},
trigger: [
{
platform: "sun",
event: "sunrise",
offset: "30",
} as any,
{ whoAmI: "bad node is who" } as any,
],
condition: [{ whoAmI: "bad node is who" } as any],
sequence: [
{ scene: "scene.light_day" } as any,
{ whoAmI: "bad node is who" } as any,
{
service: "input_select.set_options",
target: {
entity_id: "input_select.tank_light_mode",
},
data: {
options: "day",
},
},
],
},
],
});
@@ -6,7 +6,7 @@ export const NODE_HEIGHT = 80 as const;
export const DEFAULT_DIMS: DAGDims = { export const DEFAULT_DIMS: DAGDims = {
collection: { collection: {
height: NODE_HEIGHT * 3, height: NODE_HEIGHT * 3,
width: NODE_WIDTH * 1.5, width: NODE_WIDTH * 2.5,
}, },
node: { node: {
height: NODE_HEIGHT, height: NODE_HEIGHT,
@@ -29,7 +29,7 @@ export const useDAGElementsState = () => {
}, },
getIsClosedActions(nodeId: string, node: AutomationNode) { getIsClosedActions(nodeId: string, node: AutomationNode) {
if (isSpecialNode(getNodeSubType(node))) { if (isSpecialNode(getNodeSubType(node, true))) {
return { return {
isClosed: this.get(nodeId).isClosed ?? false, isClosed: this.get(nodeId).isClosed ?? false,
setIsClosed: (v: boolean) => this.set(nodeId, "isClosed", v), setIsClosed: (v: boolean) => this.set(nodeId, "isClosed", v),