Compare commits

..
7 Commits
Author SHA1 Message Date
ari 6ee7ce8f70 ignoring non yaml 2022-09-02 15:45:16 -04:00
ari 2dfbc31b5d v0.7.3 2022-09-02 10:36:55 -04:00
ari ab4997494d lint 2022-09-02 10:34:16 -04:00
ari 83b1c85043 correct fix 2022-09-02 10:33:52 -04:00
ari 7526b578ba fixed return values from backend 2022-09-02 10:11:38 -04:00
ari c461640957 fixed storybook 2022-09-02 09:45:32 -04:00
ari fd0a0aa0c4 v0.7.1 2022-09-01 21:23:49 -04:00
15 changed files with 65 additions and 159 deletions

No files matched your search

+12 -136
View File
@@ -1,5 +1,17 @@
# 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.7.3] Bugfixes
- Backend now correctly returns unset alias + description
## [0.7.1] Bugfixes + Italian!
- Added support for automations that do not have an `id`
- Added Italian
- Merged grammar fixes for french
- Fixed up strange centering styling bug
- Replaced more non-multilingual texts with multilingual text
## [0.7.0] Configuration Menu / Light Mode / Lang Support ## [0.7.0] Configuration Menu / Light Mode / Lang Support
- Added configuration menu - Added configuration menu
@@ -17,11 +29,6 @@
![image](https://user-images.githubusercontent.com/7451445/187043147-15cea23b-0b64-4484-9c87-747998ea9fe6.png) ![image](https://user-images.githubusercontent.com/7451445/187043147-15cea23b-0b64-4484-9c87-747998ea9fe6.png)
## [0.6.2] - Patches
- Attempting to increasing websocket file limit
- Support for all !include directives
## [0.6.1] - v0.6.0 Split Config Support & Better Error handling! ## [0.6.1] - v0.6.0 Split Config Support & Better Error handling!
- Added visual support for split config (this was a heavy refactor!) - Added visual support for split config (this was a heavy refactor!)
@@ -37,11 +44,6 @@
- Better global error capture - Better global error capture
![image](https://user-images.githubusercontent.com/7451445/185441268-9dbde36e-b28b-4a13-bd7f-45ae23834e78.png) ![image](https://user-images.githubusercontent.com/7451445/185441268-9dbde36e-b28b-4a13-bd7f-45ae23834e78.png)
## [0.5.3] - Bug Fixes
- Redirecting `/` to `/web` to resolve container install strangeness reported in https://github.com/asosnovsky/Shortumation/issues/125
- Fixed missing flag that caused the automation to explode in https://github.com/asosnovsky/Shortumation/issues/124
## [0.5.2] - Better Controls ## [0.5.2] - Better Controls
- Add automation trigger - Add automation trigger
@@ -62,11 +64,6 @@
- Websockets now live-refresh when updates occur - Websockets now live-refresh when updates occur
## [0.4.0] - Depedency update
- Core dependency updates
- Python port is now dynamically set
## [0.3.4] - Condition/Trigger Editor Upgrades! ## [0.3.4] - Condition/Trigger Editor Upgrades!
- Many condition editor fixes - Many condition editor fixes
@@ -83,19 +80,6 @@
![image](https://user-images.githubusercontent.com/7451445/180238004-4b04f13a-77a2-4c4c-9144-963dbc394bf4.png) ![image](https://user-images.githubusercontent.com/7451445/180238004-4b04f13a-77a2-4c4c-9144-963dbc394bf4.png)
## [0.3.2] - Fixed Addon Image for arm-based devices
- Using hypercon instead of uvicorn (this losses the rust dependency which makes it easier to install on arm)
- Pre-building web assets outside of docker (this takes the image size down and speeds up instaltion of addon)
- Updated build scripts to actually fail installation when build/prep steps fail
- Ensured that builds for all architecture run successfully
- Re-worked github actions (quicker test phases)
## [0.3.1] - Increased Pagination + Restricted Repeat Node
- Increased pagination to display up to 10,000 autos for now
- Repeat node now has types
## [0.3.0] - Complete Refactor of Graphs ## [0.3.0] - Complete Refactor of Graphs
- Added visual support for - Added visual support for
@@ -114,113 +98,5 @@
![image](https://user-images.githubusercontent.com/7451445/179135916-8083aab5-bee1-4d27-b19d-9e000ca012f9.png) ![image](https://user-images.githubusercontent.com/7451445/179135916-8083aab5-bee1-4d27-b19d-9e000ca012f9.png)
## [0.1.22] - Many Visual improvements
- Deprecated several custom components in favor of mui.com
- Device Editor now has support for 99% of diplay types
- Condition Device is implemented
- Improved naming autogen for trigger & choose
## [0.1.21] - Service Editor
- first version of service editor
- reloading automations on save
## [0.1.20] - UI Bugfixes
- Using MUI elements for input time
- Added delay action / wait_on_triggers action
- Added enabled/disabled flag in node editor
- Optional flip vertical during desktop mode
- Fixed up modal clipping
## [0.1.19] - Vertical mobile mode
- in mobile mode we draw the graphs vertically now
## [0.1.17] - Websockets
- Connected to HA main websocket -- now we retrieve real-time information about
- Device names
- Entity names/ids
- Autocomplete for devices and entities
## [0.1.14] - Material UI + Autocomplete
- Brought some Material UI elements for input and text
- Autocomplete for tags
- Using 'id' as alias for trigger (as it seems to break HA otherwise)
- Not using 'alias' for conditions, always auto-generating it (again, this used to break HA)
- Added missing `data` object to service-actions
## [0.1.13] - YAML
- Better YAML
- Rewrote yaml parser/loader to use pyyaml and safe mode
- Cleaned up description vs alias
## [0.1.12] - Less Intense Error Messages
- Added more node-based errors (this way it's easier to see where validations failed)
- Made the validators less strict in order to capture more edge cases that HA supports
- Nicer auto-generated descriptions for some trigger nodes
## [0.1.10] - More Bug Fixes
- Allowing null or undefined values for metadata fields
- Trigger.platform==time will now have the .at property better supported
## [0.1.9] - Fixed up invalid types for various triggers
- Some triggers had invalid types and were causing a false-positive validation
## [0.1.8] - Support for Malformed Automations
- API will no longer error out on missing values or invalid lists
- Frontend has support for displaying bad automations
## [0.1.6] - Mobile Mode
- Improved mobile mode
- Fixed up arrow styles due to typos
- Added selection color
## [0.1.2] - Docker Hub Images
- Publishing images to docker hub is now stable
## [0.0.15] - Publish to dockerhub
- Publishing images to docker hub
## [0.0.14] - Using vanila ha yaml
- Supporing vanilla out of the box HA yaml as oppose to parsing them (no more $smType)
- Conditions have now a more a explicit node
## [0.0.13] - Better Styling with react-flow
- Fixed up styling (using react-flow)
- cleaned up some button styles
## [0.0.12] - Tags
- Added tag management system for automations
## [0.0.11] - Zoom
- Added lazy saving
## [0.0.10] - Zoom
- Introducing Zoom!
## [0.0.9] - First Working Version
- Instalable verion via github
- Initial POC done
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+1 -1
View File
@@ -11,7 +11,7 @@ from src.hass_config.loader import HassConfig
def make_automation_router(hass_config: HassConfig) -> APIRouter: def make_automation_router(hass_config: HassConfig) -> APIRouter:
router = APIRouter() router = APIRouter()
@router.post("/list") @router.post("/list", response_model_exclude_unset=True, response_model_exclude_none=True)
def list_autos(body: ListParams) -> ListData[ExtenededAutomation]: def list_autos(body: ListParams) -> ListData[ExtenededAutomation]:
automations = AutomationManager(hass_config) automations = AutomationManager(hass_config)
try: try:
+2
View File
@@ -330,6 +330,8 @@ def load_automation_path(
def clean_automation(auto_raw: dict): def clean_automation(auto_raw: dict):
return { return {
**auto_raw, **auto_raw,
"alias": auto_raw.get("alias", "") or "",
"description": auto_raw.get("description", "") or "",
"condition": ifempty_or_null_then_list(load_conditions(auto_raw.get("condition", []))), "condition": ifempty_or_null_then_list(load_conditions(auto_raw.get("condition", []))),
"action": ifempty_or_null_then_list(load_conditions(auto_raw.get("action", []))), "action": ifempty_or_null_then_list(load_conditions(auto_raw.get("action", []))),
"trigger": ifempty_or_null_then_list(normalize_obj(auto_raw.get("trigger", []))), "trigger": ifempty_or_null_then_list(normalize_obj(auto_raw.get("trigger", []))),
+2 -2
View File
@@ -33,8 +33,8 @@ AutomationExtractedIter = Iterator[ExtractedAutomation]
class BaseAutomation(BaseModel): class BaseAutomation(BaseModel):
id: Optional[str] id: Optional[str]
alias: Optional[str] = None alias: str = ""
description: Optional[str] = None description: str = ""
trigger_variables: Optional[dict[str, Union[str, int, bool, float]]] = None trigger_variables: Optional[dict[str, Union[str, int, bool, float]]] = None
mode: str = "single" mode: str = "single"
trigger: list[dict] = [] trigger: list[dict] = []
+10 -3
View File
@@ -1,21 +1,28 @@
from pathlib import Path from pathlib import Path
from typing import Iterator, NamedTuple, Tuple, Union from typing import Iterator, NamedTuple, Tuple
from yaml.nodes import Node from yaml.nodes import Node
from src.logger import get_logger
from .manager import YamlManager from .manager import YamlManager
dump_yaml = YamlManager.dump_yaml dump_yaml = YamlManager.dump_yaml
load_yaml = YamlManager.load_yaml load_yaml = YamlManager.load_yaml
logger = get_logger(__file__)
def load_dir_yaml(folder_or_file: Path) -> Iterator[Tuple[Path, dict | list]]: def load_dir_yaml(folder_or_file: Path) -> Iterator[Tuple[Path, dict | list]]:
if folder_or_file.is_dir(): if folder_or_file.is_dir():
for file in folder_or_file.iterdir(): for file in folder_or_file.iterdir():
yield from load_dir_yaml(file) yield from load_dir_yaml(file)
else: else:
with folder_or_file.open("r") as fp: if folder_or_file.suffix.lower() == ".yaml":
yield folder_or_file, load_yaml(fp, root_path=folder_or_file.parent) with folder_or_file.open("r") as fp:
yield folder_or_file, load_yaml(fp, root_path=folder_or_file.parent)
else:
logger.info(f"Ignoring the file {folder_or_file}")
@YamlManager.as_constructor("!include") @YamlManager.as_constructor("!include")
@@ -0,0 +1,7 @@
# all the packages!
This is really cool :)
- A list item!
<<more thisngs!>>
@@ -0,0 +1,7 @@
# all the packages!
This is really cool :)
- A list item!
<<more thisngs!>>
@@ -0,0 +1,7 @@
# all the packages!
This is really cool :)
- A list item!
<<more thisngs!>>
@@ -0,0 +1,7 @@
# all the packages!
This is really cool :)
- A list item!
<<more thisngs!>>
+2 -2
View File
@@ -249,7 +249,7 @@ class automation_update_tests(BaseTestCase):
) )
autos = resp.json()["data"] autos = resp.json()["data"]
self.assertEqual(resp.json()["totalItems"], self.test_params["total"]) self.assertEqual(resp.json()["totalItems"], self.test_params["total"])
self.assertNotIn("i am new", set([a["id"] for a in autos])) self.assertNotIn("i am new", set([a.get("id", "") for a in autos]))
resp = self.client.post( resp = self.client.post(
"/automations/item", "/automations/item",
json=Automation( json=Automation(
@@ -262,7 +262,7 @@ class automation_update_tests(BaseTestCase):
) )
data = resp.json() data = resp.json()
self.assertEqual(data["totalItems"], self.test_params["total"] + 1) self.assertEqual(data["totalItems"], self.test_params["total"] + 1)
self.assertIn("i am new", set([a["id"] for a in data["data"]])) self.assertIn("i am new", set([a.get("id", "") for a in data["data"]]))
def test_update_some(self): def test_update_some(self):
resp = self.client.post( resp = self.client.post(
+1 -1
View File
@@ -1,5 +1,5 @@
name: Shortumation name: Shortumation
version: v0.7.0 version: v0.7.3
slug: shortumation slug: shortumation
image: "asosnovsky/shortumation-{arch}" image: "asosnovsky/shortumation-{arch}"
url: "https://github.com/asosnovsky/Shortumation" url: "https://github.com/asosnovsky/Shortumation"
+1 -7
View File
@@ -34,15 +34,9 @@ export const makeRemoteAPI = (baseURL: string): API => ({
return response; return response;
} catch (err) { } catch (err) {
console.error(err); console.error(err);
let error = String(err);
if (err instanceof Error) {
error += ` ${err.stack}`;
}
return { return {
ok: false, ok: false,
error, error: `Server error: ${method} ${path}`,
}; };
} }
}, },
@@ -109,7 +109,7 @@ export const MissingAutoInConfig = make({
entity_id: `automation.${auto1.id}`, entity_id: `automation.${auto1.id}`,
attributes: { attributes: {
id: auto1.id, id: auto1.id,
friendly_name: auto1.alias, friendly_name: auto1.alias ?? auto1.id ?? "",
}, },
context: { id: "", parent_id: null, user_id: null }, context: { id: "", parent_id: null, user_id: null },
last_changed: "", last_changed: "",
+4 -2
View File
@@ -29,10 +29,12 @@ export const makeStory = <
}; };
const Template: ComponentStory<T> = (args) => { const Template: ComponentStory<T> = (args) => {
let api: ApiService; let api: ApiService;
const connApi = useConnectedApiService();
const mockApi = useMockApiService([]);
if (useLiveApi) { if (useLiveApi) {
api = useConnectedApiService(); api = connApi;
} else { } else {
api = useMockApiService([]); api = mockApi;
} }
return ( return (
+1 -4
View File
@@ -1,6 +1,5 @@
import React, { FC, useEffect, useState } from "react"; import React, { FC, useEffect, useState } from "react";
import { ComponentMeta, ComponentStory } from "@storybook/react"; import { makeStory } from "devUtils";
import { Page } from "components/Page";
import { useHA } from "haService"; import { useHA } from "haService";
import InputYaml from "components/Inputs/Base/InputYaml"; import InputYaml from "components/Inputs/Base/InputYaml";
import { InputList } from "components/Inputs/InputList"; import { InputList } from "components/Inputs/InputList";
@@ -78,8 +77,6 @@ const Test: FC = () => {
); );
}; };
import { makeStory } from "devUtils";
const { make, componentMeta } = makeStory({ const { make, componentMeta } = makeStory({
Component: Test, Component: Test,
meta: { meta: {