Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024.9.0 #146

Merged
merged 3 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Use an official Node runtime as a parent image
FROM node:latest

# Set the working directory in the container
WORKDIR /flower-card

# Copy the rest of the project
COPY . .

# Expose ports for frontend and backend
EXPOSE 3000 3001

CMD ["/bin/bash"]
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "FLowercard Dev Container",
"dockerFile": "Dockerfile",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"dbaeumer.vscode-eslint"
]
}
},

"forwardPorts": [3000, 3001],
"postCreateCommand": "npm install",
"remoteUser": "node"
}

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ share/python-wheels/
*.egg
MANIFEST
release.sh
flower-card.js
flower-card.js.gz

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
320 changes: 0 additions & 320 deletions flower-card.js

This file was deleted.

Binary file removed flower-card.js.gz
Binary file not shown.
350 changes: 211 additions & 139 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flower-card",
"version": "2024.9.0-beta2",
"version": "2024.9.0-beta1",
"description": "Custom flower card for https://github.com/Olen/homeassistant-plant",
"keywords": [
"home-assistant",
Expand Down
3 changes: 2 additions & 1 deletion src/flower-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ export default class FlowerCard extends LitElement {
}

static getStubConfig(ha: HomeAssistant) {
// There must be an easier way to do this
const isPlant = (entity: HomeAssistantEntity | unknown): entity is HomeAssistantEntity => {
if (entity.entity_id.indexOf('plant.') === 0) {
if (typeof entity == 'object' && 'entity_id' in entity && typeof entity.entity_id == 'string' && entity.entity_id.indexOf('plant.') === 0) {
return !!entity;
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HomeAssistant, fireEvent } from "custom-card-helpers";
import { default_show_bars } from "./constants";
import FlowerCard from "../flower-card";
import { HomeAssistantEntity } from "../types/flower-card-types";

export const getConfigElement = (): HTMLElement => {
return document.createElement("flower-card-editor");
Expand All @@ -9,8 +10,9 @@ export const getConfigElement = (): HTMLElement => {
/* eslint-disable @typescript-eslint/no-explicit-any */

export const getStubConfig = (hass: HomeAssistant) => {
// There must be an easier way to do this...
const isPlant = (entity: HomeAssistantEntity | unknown): entity is HomeAssistantEntity => {
if (entity.entity_id.indexOf('plant.') === 0) {
if (typeof entity == 'object' && 'entity_id' in entity && typeof entity.entity_id == 'string' && entity.entity_id.indexOf('plant.') === 0) {
return !!entity;
}
}
Expand Down