Skip to content

Commit

Permalink
Merge pull request #146 from Olen/2024.9.0
Browse files Browse the repository at this point in the history
2024.9.0
  • Loading branch information
Olen authored Sep 22, 2024
2 parents 007bafd + de2136a commit 65dc966
Show file tree
Hide file tree
Showing 9 changed files with 251 additions and 462 deletions.
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

0 comments on commit 65dc966

Please sign in to comment.