Skip to content

Commit

Permalink
Merge pull request #127 from madmicio/typescript-minimal
Browse files Browse the repository at this point in the history
Typescript minimal
  • Loading branch information
madmicio authored Nov 13, 2023
2 parents 93a864b + 394b34e commit f075f45
Show file tree
Hide file tree
Showing 16 changed files with 1,872 additions and 1,106 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: ["buymeacoffee.com/madmicio"]
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Build'

on:
push:
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- uses: actions/setup-node@v3
with:
node-version: 14

- name: Build
run: |
npm install
npm run build
- name: Archive built file
uses: actions/upload-artifact@v3
with:
name: lg-remote-control
path: dist/lg-remote-control.js
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

on:
release:
types: [published]

jobs:
release:
name: Prepare release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- uses: actions/setup-node@v3
with:
node-version: 14

- name: Build the file
run: |
npm install
npm version --git-tag-version=false --commit-hooks=false "${{ github.event.release.tag_name }}"
npm run build
- name: Upload build result to release
uses: svenstaro/upload-release-action@v1-release

with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/lg-remote-control.js
asset_name: lg-remote-control.js
tag: ${{ github.ref }}
overwrite: true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules/
/.rpt2_cache/
/dist
.idea
61 changes: 61 additions & 0 deletions Override_buttons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
## Overriding key actions

Example config:
```yaml
type: custom:lg-remote-control
av_receiver_family: anthemav
entity: media_player.lg_webos_smart_tv
is_smart_tv: 'true'
colors:
buttons: red
text: blue
background: blue
projectorentity: ''
mac: '00:11:22:33:44:66'
keys:
LEFT:
service: light.toggle
data:
entity_id: light.tv
VOLUME_UP:
service: light.toggle
data:
entity_id: light.tv
```
available keys:
- `"1"`
- `"2"`
- `"3"`
- `"4"`
- `"5"`
- `"6"`
- `"7"`
- `"8"`
- `"9"`
- `"0"`
- `"UP"`
- `"LEFT"`
- `"ENTER"`
- `"RIGHT"`
- `"BACK"`
- `"DOWN"`
- `"EXIT"`
- `"RED"`
- `"GREEN"`
- `"YELLOW"`
- `"BLUE"`
- `"HOME"`
- `"CHANNELUP"`
- `"MUTE"`
- `"INFO"`
- `"CHANNELDOWN"`
- `"PLAY"`
- `"PAUSE"`
- `"STOP"`
- `"REWIND"`
- `"RECORD"`
- `"FAST_FOWARD"`
- `"POWER"`
- `"VOLUME_UP"`
- `"VOLUME_DOWN"`
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ browser_mod is required for this channel panel (you can find it [here](https://g

custom card: "card-channel-pad" is required (you can find it [here](https://github.com/madmicio/channel-pad))

# New features
### - editor cart
### - ovverride buttons services




Expand All @@ -34,7 +38,7 @@ resources:
### Manual install
1. Download and copy `lg-remote-control.js` from (https://github.com/madmicio/LG-WebOS-Remote-Control) into your custom components directory.
1. Download and copy `lg-remote-control.js` from (https://github.com/madmicio/LG-WebOS-Remote-Control/releases/latest) into your custom components directory.

2. Add a reference `lg-remote-control.js` inside your resources config:

Expand Down Expand Up @@ -99,7 +103,13 @@ channels:
number: '503'
```

## AV receiver volume control Options
## Ovverride buttons services

with version 2.0 the possibility of overriding the functionality of the button is introduced. you therefore have the possibility of calling a Home assistant service at your convenience

here are the [override keys](https://github.com/madmicio/LG-WebOS-Remote-Control/blob/typescript-minimal/Override_buttons.md) and the yaml configuration.

## AV receiver volume control Options

option dedicated to all those with problems controlling the volume of the AV Receiver through HDMI-cec commands.
if the ampli_entity item is configured, and when the sound output is set to external_arc (HDMI) or external_optical (optical output) then the remote control buttons will no longer act on the volume of the television, but on the volume of your receiver.
Expand Down
1,104 changes: 0 additions & 1,104 deletions lg-remote-control.js

This file was deleted.

47 changes: 47 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "lg-remote-card",
"version": "v1.1.3-typescript",
"description": "LG Remote card",
"keywords": [
"home-assistant",
"homeassistant",
"hass",
"automation",
"lovelace",
"custom-cards"
],
"module": "lg-remote-card.js",
"repository": "[email protected]:madmicio/LG-WebOS-Remote-Control.git",
"author": "Maurizio <[email protected]>",
"license": "MIT",
"dependencies": {
"custom-card-helpers": "^1.9.0",
"home-assistant-js-websocket": "^8.0.1",
"lit": "^2.0.0"
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-decorators": "^7.14.5",
"@rollup/plugin-json": "^4.1.0",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"cross-var": "^1.1.0",
"prettier": "^2.4.1",
"replace-in-file": "^6.3.5",
"rollup": "^2.58.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"typescript": "^4.4.3"
},
"scripts": {
"start": "rollup -c rollup.config.dev.js --watch",
"build": "npm run rollup && npm run add-version",
"add-version": "cross-var replace-in-file \"@LG_REMOTE_CONTROL_CARD_VERSION_PLACEHOLDER@\" \"$npm_package_version\" \"dist/lg-remote-control.js\"",
"rollup": "rollup -c"
}
}
42 changes: 42 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import typescript from "rollup-plugin-typescript2";
import commonjs from "rollup-plugin-commonjs";
import nodeResolve from "rollup-plugin-node-resolve";
import babel from "rollup-plugin-babel";
import { terser } from "rollup-plugin-terser";
import serve from "rollup-plugin-serve";
import json from "@rollup/plugin-json";

const dev = process.env.ROLLUP_WATCH;

const serveopts = {
contentBase: ["./dist"],
host: "0.0.0.0",
port: 5000,
allowCrossOrigin: true,
headers: {
"Access-Control-Allow-Origin": "*",
},
};

const plugins = [
nodeResolve({}),
commonjs(),
typescript(),
json(),
babel({
exclude: "node_modules/**",
}),
dev && serve(serveopts),
!dev && terser(),
];

export default [
{
input: "src/lg-remote-control.ts",
output: {
dir: "dist",
format: "es",
},
plugins: [...plugins],
},
];
3 changes: 3 additions & 0 deletions src/const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const CARD_VERSION = "v@LG_REMOTE_CONTROL_CARD_VERSION_PLACEHOLDER@";
export const CARD_TAG_NAME = "lg-remote-control";
export const EDITOR_CARD_TAG_NAME = "lg-remote-control-editor";
Loading

0 comments on commit f075f45

Please sign in to comment.