Fix eslint errors
This commit is contained in:
parent
856aab41ad
commit
8376f404e4
10 changed files with 44 additions and 46 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
import type { Config } from "config/flowtypes";
|
import type { Config } from "config/flowtypes";
|
||||||
import { hex } from "config/colors";
|
|
||||||
import * as types from "config/types";
|
import * as types from "config/types";
|
||||||
import * as icons from "@mdi/js";
|
import * as icons from "@mdi/js";
|
||||||
import { svg } from "config/icon";
|
import { svg } from "config/icon";
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import * as types from "config/types";
|
||||||
import { hex, rainbow } from "config/colors";
|
import { hex, rainbow } from "config/colors";
|
||||||
import { svg, withState } from "config/icon";
|
import { svg, withState } from "config/icon";
|
||||||
import { esper, tasmota } from "./utils";
|
import { esper, tasmota } from "./utils";
|
||||||
import * as icons from "@mdi/js"
|
import * as icons from "@mdi/js";
|
||||||
|
|
||||||
import * as onkyo from "./onkyo";
|
import * as onkyo from "./onkyo";
|
||||||
import * as olymp from "./olymp";
|
import * as olymp from "./olymp";
|
||||||
|
|
@ -277,7 +277,7 @@ const config: Config = {
|
||||||
name: "LED Stahlträger",
|
name: "LED Stahlträger",
|
||||||
position: [340, 590],
|
position: [340, 590],
|
||||||
icon: svg(icons.mdiWhiteBalanceIridescent).color(({ledStahltraeger}) =>
|
icon: svg(icons.mdiWhiteBalanceIridescent).color(({ledStahltraeger}) =>
|
||||||
ledStahltraeger === "on" ? rainbow : hex("#000000")),
|
(ledStahltraeger === "on" ? rainbow : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -353,8 +353,8 @@ const config: Config = {
|
||||||
name: "Twinkle",
|
name: "Twinkle",
|
||||||
position: [530, 560],
|
position: [530, 560],
|
||||||
icon: withState(({twinkle}) =>
|
icon: withState(({twinkle}) =>
|
||||||
twinkle === "on" ? svg(icons.mdiLedOn).flipV().color(rainbow)
|
(twinkle === "on" ? svg(icons.mdiLedOn).flipV().color(rainbow)
|
||||||
: svg(icons.mdiLedOff).flipV()
|
: svg(icons.mdiLedOff).flipV())
|
||||||
),
|
),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
|
|
@ -369,7 +369,7 @@ const config: Config = {
|
||||||
name: "Ventilator",
|
name: "Ventilator",
|
||||||
position: [530, 440],
|
position: [530, 440],
|
||||||
icon: svg(icons.mdiFan).color(({fan}) =>
|
icon: svg(icons.mdiFan).color(({fan}) =>
|
||||||
fan === "on" ? hex("#00FF00") : hex("#000000")),
|
(fan === "on" ? hex("#00FF00") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -396,7 +396,7 @@ const config: Config = {
|
||||||
name: "Fliegenbratgerät",
|
name: "Fliegenbratgerät",
|
||||||
position: [450, 570],
|
position: [450, 570],
|
||||||
icon: svg(icons.mdiFire).color(({flyfry}) =>
|
icon: svg(icons.mdiFire).color(({flyfry}) =>
|
||||||
flyfry === "on" ? hex("#6666FF") : hex("#000000")),
|
(flyfry === "on" ? hex("#6666FF") : hex("#000000"))),
|
||||||
ui: esper.statistics("flyfry", [
|
ui: esper.statistics("flyfry", [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -431,7 +431,7 @@ const config: Config = {
|
||||||
name: "Lötarbeitsplatz",
|
name: "Lötarbeitsplatz",
|
||||||
position: [205, 455],
|
position: [205, 455],
|
||||||
icon: svg(icons.mdiEyedropperVariant).color(({loetarbeitsplatz4}) =>
|
icon: svg(icons.mdiEyedropperVariant).color(({loetarbeitsplatz4}) =>
|
||||||
loetarbeitsplatz4 === "on" ? hex("#FF0000") : hex("#000000")),
|
(loetarbeitsplatz4 === "on" ? hex("#FF0000") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
|
|
@ -445,7 +445,7 @@ const config: Config = {
|
||||||
name: "Lötarbeitsplatz",
|
name: "Lötarbeitsplatz",
|
||||||
position: [205, 405],
|
position: [205, 405],
|
||||||
icon: svg(icons.mdiEyedropperVariant).color(({loetarbeitsplatz4}) =>
|
icon: svg(icons.mdiEyedropperVariant).color(({loetarbeitsplatz4}) =>
|
||||||
loetarbeitsplatz4 === "on" ? hex("#FF0000") : hex("#000000")),
|
(loetarbeitsplatz4 === "on" ? hex("#FF0000") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
|
|
@ -459,7 +459,7 @@ const config: Config = {
|
||||||
name: "Tür",
|
name: "Tür",
|
||||||
position: [455, 350],
|
position: [455, 350],
|
||||||
icon: svg(icons.mdiSwapVertical).color(({doorStatus}) =>
|
icon: svg(icons.mdiSwapVertical).color(({doorStatus}) =>
|
||||||
doorStatus === "on" ? hex("#00FF00") : hex("#FF0000")),
|
(doorStatus === "on" ? hex("#00FF00") : hex("#FF0000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "link",
|
type: "link",
|
||||||
|
|
@ -526,8 +526,8 @@ const config: Config = {
|
||||||
name: "Pilze",
|
name: "Pilze",
|
||||||
position: [48, 499],
|
position: [48, 499],
|
||||||
icon: withState(({pilze}) =>
|
icon: withState(({pilze}) =>
|
||||||
pilze === "on" ? svg(icons.mdiLedOn) : svg(icons.mdiLedOff)).color(
|
(pilze === "on" ? svg(icons.mdiLedOn) : svg(icons.mdiLedOff))).color(
|
||||||
tasmota.iconColor("pilze", rainbow)),
|
tasmota.iconColor("pilze", rainbow)),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -611,8 +611,8 @@ const config: Config = {
|
||||||
name: "Strom Fablab",
|
name: "Strom Fablab",
|
||||||
position: [613, 537],
|
position: [613, 537],
|
||||||
icon: withState(({nebenraumPowerStatus}) =>
|
icon: withState(({nebenraumPowerStatus}) =>
|
||||||
nebenraumPowerStatus === "on" ? svg(icons.mdiFlash).color(hex("#00FF00"))
|
(nebenraumPowerStatus === "on" ?
|
||||||
: svg(icons.mdiFlashOff)),
|
svg(icons.mdiFlash).color(hex("#00FF00")) : svg(icons.mdiFlashOff))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
|
|
@ -627,7 +627,8 @@ const config: Config = {
|
||||||
position: [1413, 500],
|
position: [1413, 500],
|
||||||
icon: svg(icons.mdiPool).color(
|
icon: svg(icons.mdiPool).color(
|
||||||
({whirlpoolBubbles}) =>
|
({whirlpoolBubbles}) =>
|
||||||
parseInt(whirlpoolBubbles, 10) > 0 ? hex("#00ff00") : hex("#000000")),
|
(parseInt(whirlpoolBubbles, 10) > 0 ? hex("#00ff00")
|
||||||
|
: hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { svg, mdiBattery } from "config/icon";
|
||||||
import { hex } from "config/colors";
|
import { hex } from "config/colors";
|
||||||
import * as types from "config/types";
|
import * as types from "config/types";
|
||||||
import { floalt, tradfri, tasmota } from "./utils";
|
import { floalt, tradfri, tasmota } from "./utils";
|
||||||
import * as icons from "@mdi/js"
|
import * as icons from "@mdi/js";
|
||||||
|
|
||||||
export const topics: Topics = {
|
export const topics: Topics = {
|
||||||
//Kuechen-Floalts
|
//Kuechen-Floalts
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { svg } from "config/icon";
|
||||||
import { hex, rainbow } from "config/colors";
|
import { hex, rainbow } from "config/colors";
|
||||||
import * as types from "config/types";
|
import * as types from "config/types";
|
||||||
import { tasmota, esper } from "./utils";
|
import { tasmota, esper } from "./utils";
|
||||||
import * as icons from "@mdi/js"
|
import * as icons from "@mdi/js";
|
||||||
|
|
||||||
export const topics: Topics = {
|
export const topics: Topics = {
|
||||||
...tasmota.topics("8", "ledOlymp"),
|
...tasmota.topics("8", "ledOlymp"),
|
||||||
|
|
@ -63,7 +63,7 @@ export const controls: Controls = {
|
||||||
name: "Videospiele",
|
name: "Videospiele",
|
||||||
position: [100, 100],
|
position: [100, 100],
|
||||||
icon: svg(icons.mdiGamepadVariant).color(({videogames}) =>
|
icon: svg(icons.mdiGamepadVariant).color(({videogames}) =>
|
||||||
videogames === "on" ? hex("#00FF00") : hex("#000000")),
|
(videogames === "on" ? hex("#00FF00") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -77,7 +77,7 @@ export const controls: Controls = {
|
||||||
name: "Rechner",
|
name: "Rechner",
|
||||||
position: [297, 90],
|
position: [297, 90],
|
||||||
icon: svg(icons.mdiDesktopClassic).color(({olympPC}) =>
|
icon: svg(icons.mdiDesktopClassic).color(({olympPC}) =>
|
||||||
olympPC === "on" ? hex("#00FF00") : hex("#000000")),
|
(olympPC === "on" ? hex("#00FF00") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -91,7 +91,7 @@ export const controls: Controls = {
|
||||||
name: "Rundumleuchte",
|
name: "Rundumleuchte",
|
||||||
position: [310, 275],
|
position: [310, 275],
|
||||||
icon: svg(icons.mdiAlarmLight).color(({rundumleuchte}) =>
|
icon: svg(icons.mdiAlarmLight).color(({rundumleuchte}) =>
|
||||||
rundumleuchte === "on" ? hex("#F0DF10") : hex("#000000")),
|
(rundumleuchte === "on" ? hex("#F0DF10") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import type { ControlUI, Topics } from "config/flowtypes";
|
||||||
import { svg } from "config/icon";
|
import { svg } from "config/icon";
|
||||||
import { hex, type Color } from "config/colors";
|
import { hex, type Color } from "config/colors";
|
||||||
import * as types from "config/types";
|
import * as types from "config/types";
|
||||||
import * as icons from "@mdi/js"
|
import * as icons from "@mdi/js";
|
||||||
|
|
||||||
export const tasmota = {
|
export const tasmota = {
|
||||||
topics: (id: string, name: string): Topics => ({
|
topics: (id: string, name: string): Topics => ({
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import type { Config } from "config/flowtypes";
|
||||||
import * as types from "config/types";
|
import * as types from "config/types";
|
||||||
import { svg, withState } from "config/icon";
|
import { svg, withState } from "config/icon";
|
||||||
import { hex } from "config/colors";
|
import { hex } from "config/colors";
|
||||||
import * as icons from "@mdi/js"
|
import * as icons from "@mdi/js";
|
||||||
|
|
||||||
const topicBulbHomeRust = (bulb: string, argument: string) => ({
|
const topicBulbHomeRust = (bulb: string, argument: string) => ({
|
||||||
[`${bulb}${argument}`]: {
|
[`${bulb}${argument}`]: {
|
||||||
|
|
@ -207,7 +207,7 @@ const config: Config = {
|
||||||
name: "Schlafzimmer",
|
name: "Schlafzimmer",
|
||||||
position: [180, 130],
|
position: [180, 130],
|
||||||
icon: svg(icons.mdiCeilingLight).color(({bedroomState}) =>
|
icon: svg(icons.mdiCeilingLight).color(({bedroomState}) =>
|
||||||
bedroomState === "on" ? hex("#00FF00") : hex("#000000")),
|
(bedroomState === "on" ? hex("#00FF00") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -243,7 +243,7 @@ const config: Config = {
|
||||||
name: "Lüftung Schlafzimmer",
|
name: "Lüftung Schlafzimmer",
|
||||||
position: [140, 25],
|
position: [140, 25],
|
||||||
icon: svg(icons.mdiFan).color(({fanBedroomState}) =>
|
icon: svg(icons.mdiFan).color(({fanBedroomState}) =>
|
||||||
fanBedroomState === "on" ? hex("#00FF00") : hex("#000000")),
|
(fanBedroomState === "on" ? hex("#00FF00") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -278,9 +278,9 @@ const config: Config = {
|
||||||
name: "Lautsprecher",
|
name: "Lautsprecher",
|
||||||
position: [245, 658],
|
position: [245, 658],
|
||||||
icon: withState(({speakerOfficeState}) =>
|
icon: withState(({speakerOfficeState}) =>
|
||||||
speakerOfficeState !== "on" ? svg(icons.mdiVolumeOff)
|
(speakerOfficeState !== "on" ? svg(icons.mdiVolumeOff)
|
||||||
: svg(icons.mdiVolumeHigh).color(hex("#00FF00"))
|
: svg(icons.mdiVolumeHigh).color(hex("#00FF00")))
|
||||||
),
|
),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -375,7 +375,7 @@ const config: Config = {
|
||||||
name: "Büro",
|
name: "Büro",
|
||||||
position: [210, 570],
|
position: [210, 570],
|
||||||
icon: svg(icons.mdiCeilingLight).color(({officeState}) =>
|
icon: svg(icons.mdiCeilingLight).color(({officeState}) =>
|
||||||
officeState === "on" ? hex("#00FF00") : hex("#000000")),
|
(officeState === "on" ? hex("#00FF00") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -397,7 +397,7 @@ const config: Config = {
|
||||||
name: "Flur",
|
name: "Flur",
|
||||||
position: [520, 370],
|
position: [520, 370],
|
||||||
icon: svg(icons.mdiCeilingLight).color(({hallwayState}) =>
|
icon: svg(icons.mdiCeilingLight).color(({hallwayState}) =>
|
||||||
hallwayState === "on" ? hex("#00FF00") : hex("#000000")),
|
(hallwayState === "on" ? hex("#00FF00") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -419,7 +419,7 @@ const config: Config = {
|
||||||
name: "Flur",
|
name: "Flur",
|
||||||
position: [250, 370],
|
position: [250, 370],
|
||||||
icon: svg(icons.mdiCeilingLight).color(({hallway2State}) =>
|
icon: svg(icons.mdiCeilingLight).color(({hallway2State}) =>
|
||||||
hallway2State === "on" ? hex("#00FF00") : hex("#000000")),
|
(hallway2State === "on" ? hex("#00FF00") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -460,7 +460,7 @@ const config: Config = {
|
||||||
name: "NAS",
|
name: "NAS",
|
||||||
position: [550, 100],
|
position: [550, 100],
|
||||||
icon: svg(icons.mdiNas).color(({nasPower}) =>
|
icon: svg(icons.mdiNas).color(({nasPower}) =>
|
||||||
nasPower === "on" ? hex("#00FF00") : hex("#000000")),
|
(nasPower === "on" ? hex("#00FF00") : hex("#000000"))),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -474,7 +474,7 @@ const config: Config = {
|
||||||
name: "Wohnzimmer",
|
name: "Wohnzimmer",
|
||||||
position: [450, 200],
|
position: [450, 200],
|
||||||
icon: svg(icons.mdiCeilingLight).color(({livingroomState}) =>
|
icon: svg(icons.mdiCeilingLight).color(({livingroomState}) =>
|
||||||
livingroomState === "on" ? hex("#00FF00") : hex("#000000")),
|
(livingroomState === "on" ? hex("#00FF00") : hex("#000000"))),
|
||||||
ui: ([
|
ui: ([
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,12 @@ export type AppState = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const App = (props: AppProps) => {
|
*const App = (props: AppProps) => {
|
||||||
const topics = Array.isArray(props.config.topics) ?
|
* const topics = Array.isArray(props.config.topics) ?
|
||||||
Object.assign({}, ...props.config.topics) : props.config.topics;
|
* Object.assign({}, ...props.config.topics) : props.config.topics;
|
||||||
const [mqttConnected, setMqttConnected] = useState(false);
|
* const [mqttConnected, setMqttConnected] = useState(false);
|
||||||
};
|
*};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class App extends React.PureComponent<AppProps & Classes, AppState> {
|
class App extends React.PureComponent<AppProps & Classes, AppState> {
|
||||||
controlMap: React.Node
|
controlMap: React.Node
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import filter from "lodash/filter";
|
||||||
import reduce from "lodash/reduce";
|
import reduce from "lodash/reduce";
|
||||||
import MqttContext from "mqtt/context";
|
import MqttContext from "mqtt/context";
|
||||||
import type { Controls, Control, UIControl, ControlUI } from "config/flowtypes";
|
import type { Controls, Control, UIControl, ControlUI } from "config/flowtypes";
|
||||||
import { renderToString } from 'react-dom/server'
|
import { renderToString } from "react-dom/server";
|
||||||
|
|
||||||
export type Point = [number, number];
|
export type Point = [number, number];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
// @flow
|
// @flow
|
||||||
import type { Color } from "config/colors";
|
|
||||||
import type { Icon } from "config/icon";
|
import type { Icon } from "config/icon";
|
||||||
|
|
||||||
export type TopicType = (msg: Buffer) => string;
|
export type TopicType = (msg: Buffer) => string;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import ReactIcon from "@mdi/react";
|
import ReactIcon from "@mdi/react";
|
||||||
import ReactContext from "mqtt/context";
|
import { type Color } from "./colors";
|
||||||
import { hex, type Color } from "./colors"
|
import * as mdiIcons from "@mdi/js";
|
||||||
import * as mdiIcons from "@mdi/js"
|
|
||||||
|
|
||||||
export type Icon = {
|
export type Icon = {
|
||||||
render: (s: State) => React.Node,
|
render: (s: State) => React.Node,
|
||||||
|
|
@ -36,7 +35,7 @@ export const svg = (data: string, props?: IconPropHelper): Icon => {
|
||||||
horizontal={props?.horizontal ?? false}
|
horizontal={props?.horizontal ?? false}
|
||||||
vertical={props?.vertical ?? false}
|
vertical={props?.vertical ?? false}
|
||||||
color={propColor(state)}
|
color={propColor(state)}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
size: (n: number) => svg(data, {...props, size: n}),
|
size: (n: number) => svg(data, {...props, size: n}),
|
||||||
rotate: (n: number) => svg(data, {...props, rotate: n}),
|
rotate: (n: number) => svg(data, {...props, rotate: n}),
|
||||||
|
|
@ -44,7 +43,7 @@ export const svg = (data: string, props?: IconPropHelper): Icon => {
|
||||||
flipV: () => svg(data, {...props, vertical: !props?.vertical ?? true}),
|
flipV: () => svg(data, {...props, vertical: !props?.vertical ?? true}),
|
||||||
color: (c: Color | (State) => Color) => svg(data, {...props, color: c})
|
color: (c: Color | (State) => Color) => svg(data, {...props, color: c})
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
export const withState = (f: (s: State) => Icon): Icon => {
|
export const withState = (f: (s: State) => Icon): Icon => {
|
||||||
return {
|
return {
|
||||||
|
|
@ -55,7 +54,7 @@ export const withState = (f: (s: State) => Icon): Icon => {
|
||||||
flipV: () => withState(f),
|
flipV: () => withState(f),
|
||||||
color: () => withState(f)
|
color: () => withState(f)
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
export const mdiBattery = (topic: string): Icon => withState((state) => {
|
export const mdiBattery = (topic: string): Icon => withState((state) => {
|
||||||
const rawval = state[topic];
|
const rawval = state[topic];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue