@iobroker/dm-gui-components 9.1.6 → 9.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/build/Communication.d.ts +5 -5
- package/build/Communication.js +3 -1
- package/build/Communication.js.map +1 -1
- package/build/DeviceControl.d.ts +1 -1
- package/build/DeviceControl.js.map +1 -1
- package/build/DeviceList.d.ts +7 -0
- package/build/DeviceList.js +31 -10
- package/build/DeviceList.js.map +1 -1
- package/build/DeviceStatus.js +18 -3
- package/build/DeviceStatus.js.map +1 -1
- package/build/i18n/de.json +1 -0
- package/build/i18n/en.json +1 -0
- package/build/i18n/es.json +1 -0
- package/build/i18n/fr.json +1 -0
- package/build/i18n/it.json +1 -0
- package/build/i18n/nl.json +1 -0
- package/build/i18n/pl.json +1 -0
- package/build/i18n/pt.json +1 -0
- package/build/i18n/ru.json +1 -0
- package/build/i18n/uk.json +1 -0
- package/build/i18n/zh-cn.json +1 -0
- package/build/protocol/DmProtocolBase.d.ts +3 -3
- package/build/protocol/DmProtocolBase.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceControl.js","sourceRoot":"./src/","sources":["DeviceControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AACnD,OAAO,EACH,MAAM,EACN,GAAG,EACH,WAAW,EACX,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,OAAO,GACV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAmB,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA6B5D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,SAAiD;IACjG,YAAY,KAAyB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,EAAE,IAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAO,CAAC;IACzE,CAAC;CACJ","sourcesContent":["import React, { Component, type JSX } from 'react';\nimport {\n Button,\n Fab,\n FormControl,\n InputLabel,\n MenuItem,\n Select,\n Switch,\n Slider,\n TextField,\n InputAdornment,\n FormControlLabel,\n Divider,\n} from '@mui/material';\n\nimport { type Connection, Icon } from '@iobroker/adapter-react-v5';\nimport type { DeviceId, ControlBase, ControlState, DeviceControl } from './protocol/api';\n\nimport { renderControlIcon, getTranslation } from './Utils';\n\ninterface DeviceControlProps {\n deviceId: DeviceId;\n /** Control object */\n control: DeviceControl;\n socket: Connection;\n /** Control handler to set the state */\n controlHandler: (\n deviceId: DeviceId,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n /** Control handler to read the state */\n controlStateHandler: (deviceId: DeviceId, control: ControlBase) => () => Promise<ioBroker.State | null>;\n colors: { primary: string; secondary: string };\n disabled?: boolean;\n}\n\ninterface DeviceControlState {\n value?: ControlState;\n ts?: number;\n min?: number;\n max?: number;\n step?: number;\n unit?: string;\n options?: { label: string; value: ControlState; icon?: string; color?: string }[];\n}\n\n/**\n * Device Control component\n */\nexport default class DeviceControlComponent extends Component<DeviceControlProps, DeviceControlState> {\n constructor(props: DeviceControlProps) {\n super(props);\n this.state = {\n value: props.control.state?.val,\n ts: props.control.state?.ts,\n unit: props.control.unit || '',\n };\n }\n\n async componentDidMount(): Promise<void> {\n if (this.props.control.stateId) {\n const mayBePromise = this.props.socket.subscribeState(this.props.control.stateId, this.stateHandler);\n if (mayBePromise instanceof Promise) {\n await mayBePromise;\n }\n if (this.props.control.type === 'slider' || this.props.control.type === 'number') {\n if (this.props.control.min === undefined && this.props.control.max === undefined) {\n // read an object to get min and max\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common) {\n const min: number = this.props.control.min ?? obj.common.min ?? 0;\n\n const max: number = this.props.control.max ?? obj.common.max ?? 100;\n\n const step: number = this.props.control.step || obj.common.step || (max - min) / 100;\n\n let unit: string | undefined = this.props.control.unit;\n if (unit === undefined) {\n unit = obj.common.unit;\n }\n\n this.setState({\n min,\n max,\n step,\n unit,\n });\n }\n });\n } else {\n const min = this.props.control.min ?? 0;\n const max = this.props.control.max ?? 100;\n\n this.setState({\n min,\n max,\n step: this.props.control.step === undefined ? (max - min) / 100 : this.props.control.step,\n unit: this.props.control.unit || '',\n });\n }\n } else if (this.props.control.type === 'select') {\n if (!this.props.control.options?.length) {\n // read an object to get options\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common?.states) {\n let options: { label: string; value: ControlState }[] | undefined;\n if (typeof obj.common.states === 'string') {\n const pairs = obj.common.states.split(';');\n options = pairs.map(pair => {\n const parts = pair.split(':');\n return {\n value: parts[0],\n label: parts[1],\n };\n });\n } else if (Array.isArray(obj.common.states)) {\n options = obj.common.states.map((label: string) => ({ label, value: label }));\n } else {\n options = Object.keys(obj.common.states).map(label => ({\n label,\n value: obj.common.states[label],\n }));\n }\n\n this.setState({\n options,\n });\n }\n });\n } else {\n this.setState({\n options: this.props.control.options.map(item => ({\n label: getTranslation(item.label),\n value: item.value,\n icon: item.icon,\n color: item.color,\n })),\n });\n }\n } else if (this.props.control.type === 'info') {\n if (!this.props.control.unit) {\n // read an object to get unit\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common?.unit) {\n this.setState({\n unit: obj.common.unit,\n });\n }\n });\n }\n }\n }\n }\n\n stateHandler = async (id: string, state: ioBroker.State): Promise<void> => {\n if (id === this.props.control.stateId && state) {\n // request new state\n const newState: ioBroker.State | null = await this.props.controlStateHandler(\n this.props.deviceId,\n this.props.control,\n )();\n if (newState?.ts && (!this.state.ts || newState.ts > this.state.ts)) {\n this.setState({\n value: newState.val,\n ts: newState.ts,\n });\n }\n }\n };\n\n componentWillUnmount(): void {\n if (this.props.control.stateId) {\n this.props.socket.unsubscribeState(this.props.control.stateId, this.stateHandler);\n }\n }\n\n static getDerivedStateFromProps(\n props: DeviceControlProps,\n state: DeviceControlState,\n ): Partial<DeviceControlState> | null {\n if (props.control.state?.ts && (!state.ts || props.control.state?.ts > state.ts)) {\n return {\n value: props.control.state.val,\n ts: props.control.state.ts,\n };\n }\n\n return null;\n }\n\n async sendControl(deviceId: DeviceId, control: ControlBase, value: ControlState): Promise<void> {\n const result = await this.props.controlHandler(deviceId, control, value)();\n if (result?.ts && (!this.state.ts || result?.ts > this.state.ts)) {\n this.setState({\n value: result.val,\n ts: result.ts,\n });\n }\n }\n\n renderButton(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value, true);\n\n if (!this.props.control.label) {\n return (\n <Fab\n size=\"small\"\n disabled={this.props.disabled}\n title={tooltip}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, true)}\n >\n {icon}\n </Fab>\n );\n }\n return (\n <Button\n disabled={this.props.disabled}\n title={tooltip}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, true)}\n startIcon={icon}\n variant={this.props.control.variant}\n >\n {getTranslation(this.props.control.label)}\n </Button>\n );\n }\n\n renderSwitch(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n\n if (\n (this.props.control.label || this.props.control.icon) &&\n (this.props.control.labelOn || this.props.control.iconOn)\n ) {\n return (\n <div style={{ display: 'flex', gap: 8 }}>\n <div style={{ color: this.props.control.color, display: 'flex', gap: 4 }}>\n {this.props.control.label ? getTranslation(this.props.control.label) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </div>\n <Switch\n disabled={this.props.disabled}\n title={tooltip}\n checked={!!this.state.value}\n onChange={e => this.sendControl(this.props.deviceId, this.props.control, e.target.checked)}\n />\n <div\n style={{\n color: this.props.control.colorOn || this.props.control.color,\n display: 'flex',\n gap: 4,\n }}\n >\n {this.props.control.labelOn ? getTranslation(this.props.control.labelOn) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </div>\n </div>\n );\n }\n if (this.props.control.label || this.props.control.icon) {\n return (\n <FormControlLabel\n control={\n <Switch\n disabled={this.props.disabled}\n title={tooltip}\n checked={!!this.state.value}\n onChange={e => this.sendControl(this.props.deviceId, this.props.control, e.target.checked)}\n />\n }\n slotProps={{\n typography: {\n style: { color: this.props.control.color },\n },\n }}\n label={\n <span style={{ color: this.props.control.color, display: 'flex', gap: 4 }}>\n {this.props.control.label ? getTranslation(this.props.control.label) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </span>\n }\n />\n );\n }\n return (\n <Switch\n disabled={this.props.disabled}\n title={tooltip}\n checked={!!this.state.value}\n onChange={e => this.sendControl(this.props.deviceId, this.props.control, e.target.checked)}\n />\n );\n }\n\n getColor(): string | undefined {\n let color: string | undefined;\n if (this.state.value) {\n color = this.props.control.colorOn || 'primary';\n } else if (this.props.control.type === 'switch') {\n color = this.props.control.color;\n }\n if (color === 'primary') {\n return this.props.colors.primary;\n }\n if (color === 'secondary') {\n return this.props.colors.secondary;\n }\n return color;\n }\n\n renderSelect(): JSX.Element {\n const anyIcons = this.state.options?.some(option => !!option.icon);\n\n return (\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n {this.props.control.label ? <InputLabel>{getTranslation(this.props.control.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n value={this.state.value}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n >\n {this.state.options?.map((option, i) => (\n <MenuItem\n key={i.toString()}\n value={typeof option.value === 'boolean' ? option.value.toString() : option.value!}\n style={{ color: option.color }}\n >\n {anyIcons ? (\n <Icon\n src={option.icon}\n style={{ width: 24, height: 24 }}\n />\n ) : null}\n {option.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n }\n\n renderSlider(): JSX.Element {\n if (this.state.min === undefined || this.state.max === undefined) {\n return <div style={{ width: '100%' }}>...</div>;\n }\n return (\n <div\n style={{\n width: '100%',\n minWidth: 300,\n paddingTop: 8,\n marginBottom: 8,\n overflow: 'visible',\n display: 'flex',\n }}\n >\n {this.props.control.label ? (\n <div style={{ color: this.props.control.color, marginBottom: 4, whiteSpace: 'nowrap' }}>\n {getTranslation(this.props.control.label)}\n </div>\n ) : null}\n {this.props.control.icon ? (\n <Icon\n style={{ color: this.props.control.color }}\n src={this.props.control.icon}\n />\n ) : null}\n <Slider\n style={{ flexGrow: 1 }}\n value={parseFloat((this.state.value as string) || '0')}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n valueLabelDisplay=\"auto\"\n onChange={(_e, value) => this.sendControl(this.props.deviceId, this.props.control, value as number)}\n />\n {this.props.control.iconOn ? (\n <Icon\n style={{ color: this.props.control.colorOn || this.props.control.color }}\n src={this.props.control.iconOn}\n />\n ) : null}\n {this.props.control.labelOn ? (\n <div\n style={{ color: this.props.control.colorOn || this.props.control.color, whiteSpace: 'nowrap' }}\n >\n {getTranslation(this.props.control.labelOn)}\n </div>\n ) : null}\n </div>\n );\n }\n\n renderColor(): JSX.Element {\n return (\n <TextField\n fullWidth\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n type=\"color\"\n value={this.state.value}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n variant=\"standard\"\n />\n );\n }\n\n renderText(): JSX.Element {\n return (\n <TextField\n fullWidth\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n value={this.state.value}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n variant=\"standard\"\n />\n );\n }\n\n renderNumber(): JSX.Element {\n return (\n <TextField\n fullWidth\n type=\"number\"\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n value={this.state.value}\n onChange={(e): Promise<void> => {\n if (isNaN(parseFloat(e.target.value))) {\n return Promise.resolve();\n }\n return this.sendControl(this.props.deviceId, this.props.control, parseFloat(e.target.value));\n }}\n slotProps={{\n htmlInput: { min: this.state.min, max: this.state.max, step: this.state.step },\n input: {\n endAdornment: this.state.unit ? (\n <InputAdornment position=\"end\">{this.state.unit}</InputAdornment>\n ) : undefined,\n },\n }}\n variant=\"standard\"\n />\n );\n }\n\n renderIcon(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value);\n const color = this.getColor();\n const style: React.CSSProperties | undefined =\n color === this.props.colors.primary || color === this.props.colors.secondary ? {} : { color };\n const colorProps =\n color === this.props.colors.primary\n ? 'primary'\n : color === this.props.colors.secondary\n ? 'secondary'\n : undefined;\n\n if (!this.props.control.label) {\n style.width = 34;\n style.height = 34;\n style.minHeight = 34;\n\n return (\n <Fab\n disabled={this.props.disabled}\n size=\"small\"\n title={tooltip}\n color={colorProps}\n style={style}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, !this.state.value)}\n >\n {icon}\n </Fab>\n );\n }\n return (\n <Button\n disabled={this.props.disabled}\n title={tooltip}\n color={colorProps}\n style={style}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, !this.state.value)}\n startIcon={icon}\n variant={this.props.control.variant}\n >\n {getTranslation(this.props.control.label)}\n </Button>\n );\n }\n\n renderInfo(): JSX.Element {\n let label = this.props.control.label;\n if (this.state.value && this.props.control.labelOn && typeof this.state.value === 'boolean') {\n label = this.props.control.labelOn;\n }\n if (label) {\n label = getTranslation(this.props.control.label!, this.props.control.noTranslation);\n }\n let value = this.state.value;\n if (typeof this.state.value === 'boolean') {\n if (this.props.control.textFalse && !this.state.value) {\n value = getTranslation(this.props.control.textFalse, this.props.control.noTranslation);\n } else if (this.props.control.textTrue && this.state.value) {\n value = getTranslation(this.props.control.textTrue, this.props.control.noTranslation);\n }\n }\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value, true);\n return (\n <div style={{ display: 'flex' }}>\n {icon}\n {label ? (\n <InputLabel>\n {label}\n {this.props.control.showSemicolon ? ':' : null}\n </InputLabel>\n ) : null}\n\n <span>\n {value}\n <span style={{ fontSize: 'smaller', opacity: 0.7, marginLeft: this.state.unit ? 4 : 0 }}>\n {this.state.unit}\n </span>\n </span>\n </div>\n );\n }\n\n renderDivider(): JSX.Element {\n const style: React.CSSProperties = this.props.control.style || {};\n if (this.props.control.color) {\n style.color = this.props.control.color;\n }\n return <Divider style={style} />;\n }\n\n renderHeader(): JSX.Element {\n const style: React.CSSProperties = {\n backgroundColor: this.props.colors.primary,\n width: '100%',\n display: 'flex',\n gap: 8,\n };\n Object.assign(style, this.props.control.style);\n if (this.props.control.color) {\n style.color = this.props.control.color;\n }\n const icon = renderControlIcon(this.props.control, this.props.colors, false, true);\n return (\n <div style={style}>\n {icon}\n {getTranslation(this.props.control.label!)}\n </div>\n );\n }\n\n render(): JSX.Element {\n if (this.props.control.type === 'button') {\n return this.renderButton();\n }\n\n if (this.props.control.type === 'icon') {\n return this.renderIcon();\n }\n\n if (this.props.control.type === 'switch') {\n return this.renderSwitch();\n }\n\n if (this.props.control.type === 'select') {\n return this.renderSelect();\n }\n\n if (this.props.control.type === 'slider') {\n return this.renderSlider();\n }\n\n if (this.props.control.type === 'color') {\n return this.renderColor();\n }\n\n if (this.props.control.type === 'text') {\n return this.renderText();\n }\n\n if (this.props.control.type === 'number') {\n return this.renderNumber();\n }\n\n if (this.props.control.type === 'info') {\n return this.renderInfo();\n }\n\n if (this.props.control.type === 'divider') {\n return this.renderDivider();\n }\n\n if (this.props.control.type === 'header') {\n return this.renderHeader();\n }\n\n return <div style={{ color: 'red' }}>{this.props.control.type}</div>;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DeviceControl.js","sourceRoot":"./src/","sources":["DeviceControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AACnD,OAAO,EACH,MAAM,EACN,GAAG,EACH,WAAW,EACX,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAA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AC,IAAI,KAAK,SAAS,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;QAChC,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC/B,CAAC;QAED,OAAO,6BAAK,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAO,CAAC;IACzE,CAAC;CACJ","sourcesContent":["import React, { Component, type JSX } from 'react';\nimport {\n Button,\n Fab,\n FormControl,\n InputLabel,\n MenuItem,\n Select,\n Switch,\n Slider,\n TextField,\n InputAdornment,\n FormControlLabel,\n Divider,\n} from '@mui/material';\n\nimport { type Connection, Icon } from '@iobroker/adapter-react-v5';\nimport type { DeviceId, ControlBase, ControlState, DeviceControl } from './protocol/api';\n\nimport { renderControlIcon, getTranslation } from './Utils';\n\ninterface DeviceControlProps {\n deviceId: DeviceId;\n /** Control object */\n control: DeviceControl;\n socket: Connection;\n /** Control handler to set the state */\n controlHandler: (\n deviceId: DeviceId,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n /** Control handler to read the state */\n controlStateHandler: (deviceId: DeviceId, control: ControlBase) => () => Promise<ioBroker.State | null>;\n colors: { primary: string; secondary: string };\n disabled?: boolean;\n}\n\ninterface DeviceControlState {\n value?: ControlState;\n ts?: number;\n min?: number;\n max?: number;\n step?: number;\n unit?: string;\n options?: { label: string; value: ControlState; icon?: string; color?: string }[];\n}\n\n/**\n * Device Control component\n */\nexport default class DeviceControlComponent extends Component<DeviceControlProps, DeviceControlState> {\n constructor(props: DeviceControlProps) {\n super(props);\n this.state = {\n value: props.control.state?.val,\n ts: props.control.state?.ts,\n unit: props.control.unit || '',\n };\n }\n\n async componentDidMount(): Promise<void> {\n if (this.props.control.stateId) {\n const mayBePromise = this.props.socket.subscribeState(this.props.control.stateId, this.stateHandler);\n if (mayBePromise instanceof Promise) {\n await mayBePromise;\n }\n if (this.props.control.type === 'slider' || this.props.control.type === 'number') {\n if (this.props.control.min === undefined && this.props.control.max === undefined) {\n // read an object to get min and max\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common) {\n const min: number = this.props.control.min ?? obj.common.min ?? 0;\n\n const max: number = this.props.control.max ?? obj.common.max ?? 100;\n\n const step: number = this.props.control.step || obj.common.step || (max - min) / 100;\n\n let unit: string | undefined = this.props.control.unit;\n if (unit === undefined) {\n unit = obj.common.unit;\n }\n\n this.setState({\n min,\n max,\n step,\n unit,\n });\n }\n });\n } else {\n const min = this.props.control.min ?? 0;\n const max = this.props.control.max ?? 100;\n\n this.setState({\n min,\n max,\n step: this.props.control.step === undefined ? (max - min) / 100 : this.props.control.step,\n unit: this.props.control.unit || '',\n });\n }\n } else if (this.props.control.type === 'select') {\n if (!this.props.control.options?.length) {\n // read an object to get options\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common?.states) {\n let options: { label: string; value: ControlState }[] | undefined;\n if (typeof obj.common.states === 'string') {\n const pairs = obj.common.states.split(';');\n options = pairs.map(pair => {\n const parts = pair.split(':');\n return {\n value: parts[0],\n label: parts[1],\n };\n });\n } else if (Array.isArray(obj.common.states)) {\n options = obj.common.states.map((label: string) => ({ label, value: label }));\n } else {\n options = Object.keys(obj.common.states).map(label => ({\n label,\n value: obj.common.states[label],\n }));\n }\n\n this.setState({\n options,\n });\n }\n });\n } else {\n this.setState({\n options: this.props.control.options.map(item => ({\n label: getTranslation(item.label),\n value: item.value,\n icon: item.icon,\n color: item.color,\n })),\n });\n }\n } else if (this.props.control.type === 'info') {\n if (!this.props.control.unit) {\n // read an object to get unit\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common?.unit) {\n this.setState({\n unit: obj.common.unit,\n });\n }\n });\n }\n }\n }\n }\n\n stateHandler = async (id: string, state: ioBroker.State | null | undefined): Promise<void> => {\n if (id === this.props.control.stateId && state) {\n // request new state\n const newState: ioBroker.State | null = await this.props.controlStateHandler(\n this.props.deviceId,\n this.props.control,\n )();\n if (newState?.ts && (!this.state.ts || newState.ts > this.state.ts)) {\n this.setState({\n value: newState.val,\n ts: newState.ts,\n });\n }\n }\n };\n\n componentWillUnmount(): void {\n if (this.props.control.stateId) {\n this.props.socket.unsubscribeState(this.props.control.stateId, this.stateHandler);\n }\n }\n\n static getDerivedStateFromProps(\n props: DeviceControlProps,\n state: DeviceControlState,\n ): Partial<DeviceControlState> | null {\n if (props.control.state?.ts && (!state.ts || props.control.state?.ts > state.ts)) {\n return {\n value: props.control.state.val,\n ts: props.control.state.ts,\n };\n }\n\n return null;\n }\n\n async sendControl(deviceId: DeviceId, control: ControlBase, value: ControlState): Promise<void> {\n const result = await this.props.controlHandler(deviceId, control, value)();\n if (result?.ts && (!this.state.ts || result?.ts > this.state.ts)) {\n this.setState({\n value: result.val,\n ts: result.ts,\n });\n }\n }\n\n renderButton(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value, true);\n\n if (!this.props.control.label) {\n return (\n <Fab\n size=\"small\"\n disabled={this.props.disabled}\n title={tooltip}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, true)}\n >\n {icon}\n </Fab>\n );\n }\n return (\n <Button\n disabled={this.props.disabled}\n title={tooltip}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, true)}\n startIcon={icon}\n variant={this.props.control.variant}\n >\n {getTranslation(this.props.control.label)}\n </Button>\n );\n }\n\n renderSwitch(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n\n if (\n (this.props.control.label || this.props.control.icon) &&\n (this.props.control.labelOn || this.props.control.iconOn)\n ) {\n return (\n <div style={{ display: 'flex', gap: 8 }}>\n <div style={{ color: this.props.control.color, display: 'flex', gap: 4 }}>\n {this.props.control.label ? getTranslation(this.props.control.label) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </div>\n <Switch\n disabled={this.props.disabled}\n title={tooltip}\n checked={!!this.state.value}\n onChange={e => this.sendControl(this.props.deviceId, this.props.control, e.target.checked)}\n />\n <div\n style={{\n color: this.props.control.colorOn || this.props.control.color,\n display: 'flex',\n gap: 4,\n }}\n >\n {this.props.control.labelOn ? getTranslation(this.props.control.labelOn) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </div>\n </div>\n );\n }\n if (this.props.control.label || this.props.control.icon) {\n return (\n <FormControlLabel\n control={\n <Switch\n disabled={this.props.disabled}\n title={tooltip}\n checked={!!this.state.value}\n onChange={e => this.sendControl(this.props.deviceId, this.props.control, e.target.checked)}\n />\n }\n slotProps={{\n typography: {\n style: { color: this.props.control.color },\n },\n }}\n label={\n <span style={{ color: this.props.control.color, display: 'flex', gap: 4 }}>\n {this.props.control.label ? getTranslation(this.props.control.label) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </span>\n }\n />\n );\n }\n return (\n <Switch\n disabled={this.props.disabled}\n title={tooltip}\n checked={!!this.state.value}\n onChange={e => this.sendControl(this.props.deviceId, this.props.control, e.target.checked)}\n />\n );\n }\n\n getColor(): string | undefined {\n let color: string | undefined;\n if (this.state.value) {\n color = this.props.control.colorOn || 'primary';\n } else if (this.props.control.type === 'switch') {\n color = this.props.control.color;\n }\n if (color === 'primary') {\n return this.props.colors.primary;\n }\n if (color === 'secondary') {\n return this.props.colors.secondary;\n }\n return color;\n }\n\n renderSelect(): JSX.Element {\n const anyIcons = this.state.options?.some(option => !!option.icon);\n\n return (\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n {this.props.control.label ? <InputLabel>{getTranslation(this.props.control.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n value={this.state.value}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n >\n {this.state.options?.map((option, i) => (\n <MenuItem\n key={i.toString()}\n value={typeof option.value === 'boolean' ? option.value.toString() : option.value!}\n style={{ color: option.color }}\n >\n {anyIcons ? (\n <Icon\n src={option.icon}\n style={{ width: 24, height: 24 }}\n />\n ) : null}\n {option.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n }\n\n renderSlider(): JSX.Element {\n if (this.state.min === undefined || this.state.max === undefined) {\n return <div style={{ width: '100%' }}>...</div>;\n }\n return (\n <div\n style={{\n width: '100%',\n minWidth: 300,\n paddingTop: 8,\n marginBottom: 8,\n overflow: 'visible',\n display: 'flex',\n }}\n >\n {this.props.control.label ? (\n <div style={{ color: this.props.control.color, marginBottom: 4, whiteSpace: 'nowrap' }}>\n {getTranslation(this.props.control.label)}\n </div>\n ) : null}\n {this.props.control.icon ? (\n <Icon\n style={{ color: this.props.control.color }}\n src={this.props.control.icon}\n />\n ) : null}\n <Slider\n style={{ flexGrow: 1 }}\n value={parseFloat((this.state.value as string) || '0')}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n valueLabelDisplay=\"auto\"\n onChange={(_e, value) => this.sendControl(this.props.deviceId, this.props.control, value as number)}\n />\n {this.props.control.iconOn ? (\n <Icon\n style={{ color: this.props.control.colorOn || this.props.control.color }}\n src={this.props.control.iconOn}\n />\n ) : null}\n {this.props.control.labelOn ? (\n <div\n style={{ color: this.props.control.colorOn || this.props.control.color, whiteSpace: 'nowrap' }}\n >\n {getTranslation(this.props.control.labelOn)}\n </div>\n ) : null}\n </div>\n );\n }\n\n renderColor(): JSX.Element {\n return (\n <TextField\n fullWidth\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n type=\"color\"\n value={this.state.value}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n variant=\"standard\"\n />\n );\n }\n\n renderText(): JSX.Element {\n return (\n <TextField\n fullWidth\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n value={this.state.value}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n variant=\"standard\"\n />\n );\n }\n\n renderNumber(): JSX.Element {\n return (\n <TextField\n fullWidth\n type=\"number\"\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n value={this.state.value}\n onChange={(e): Promise<void> => {\n if (isNaN(parseFloat(e.target.value))) {\n return Promise.resolve();\n }\n return this.sendControl(this.props.deviceId, this.props.control, parseFloat(e.target.value));\n }}\n slotProps={{\n htmlInput: { min: this.state.min, max: this.state.max, step: this.state.step },\n input: {\n endAdornment: this.state.unit ? (\n <InputAdornment position=\"end\">{this.state.unit}</InputAdornment>\n ) : undefined,\n },\n }}\n variant=\"standard\"\n />\n );\n }\n\n renderIcon(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value);\n const color = this.getColor();\n const style: React.CSSProperties | undefined =\n color === this.props.colors.primary || color === this.props.colors.secondary ? {} : { color };\n const colorProps =\n color === this.props.colors.primary\n ? 'primary'\n : color === this.props.colors.secondary\n ? 'secondary'\n : undefined;\n\n if (!this.props.control.label) {\n style.width = 34;\n style.height = 34;\n style.minHeight = 34;\n\n return (\n <Fab\n disabled={this.props.disabled}\n size=\"small\"\n title={tooltip}\n color={colorProps}\n style={style}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, !this.state.value)}\n >\n {icon}\n </Fab>\n );\n }\n return (\n <Button\n disabled={this.props.disabled}\n title={tooltip}\n color={colorProps}\n style={style}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, !this.state.value)}\n startIcon={icon}\n variant={this.props.control.variant}\n >\n {getTranslation(this.props.control.label)}\n </Button>\n );\n }\n\n renderInfo(): JSX.Element {\n let label = this.props.control.label;\n if (this.state.value && this.props.control.labelOn && typeof this.state.value === 'boolean') {\n label = this.props.control.labelOn;\n }\n if (label) {\n label = getTranslation(this.props.control.label!, this.props.control.noTranslation);\n }\n let value = this.state.value;\n if (typeof this.state.value === 'boolean') {\n if (this.props.control.textFalse && !this.state.value) {\n value = getTranslation(this.props.control.textFalse, this.props.control.noTranslation);\n } else if (this.props.control.textTrue && this.state.value) {\n value = getTranslation(this.props.control.textTrue, this.props.control.noTranslation);\n }\n }\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value, true);\n return (\n <div style={{ display: 'flex' }}>\n {icon}\n {label ? (\n <InputLabel>\n {label}\n {this.props.control.showSemicolon ? ':' : null}\n </InputLabel>\n ) : null}\n\n <span>\n {value}\n <span style={{ fontSize: 'smaller', opacity: 0.7, marginLeft: this.state.unit ? 4 : 0 }}>\n {this.state.unit}\n </span>\n </span>\n </div>\n );\n }\n\n renderDivider(): JSX.Element {\n const style: React.CSSProperties = this.props.control.style || {};\n if (this.props.control.color) {\n style.color = this.props.control.color;\n }\n return <Divider style={style} />;\n }\n\n renderHeader(): JSX.Element {\n const style: React.CSSProperties = {\n backgroundColor: this.props.colors.primary,\n width: '100%',\n display: 'flex',\n gap: 8,\n };\n Object.assign(style, this.props.control.style);\n if (this.props.control.color) {\n style.color = this.props.control.color;\n }\n const icon = renderControlIcon(this.props.control, this.props.colors, false, true);\n return (\n <div style={style}>\n {icon}\n {getTranslation(this.props.control.label!)}\n </div>\n );\n }\n\n render(): JSX.Element {\n if (this.props.control.type === 'button') {\n return this.renderButton();\n }\n\n if (this.props.control.type === 'icon') {\n return this.renderIcon();\n }\n\n if (this.props.control.type === 'switch') {\n return this.renderSwitch();\n }\n\n if (this.props.control.type === 'select') {\n return this.renderSelect();\n }\n\n if (this.props.control.type === 'slider') {\n return this.renderSlider();\n }\n\n if (this.props.control.type === 'color') {\n return this.renderColor();\n }\n\n if (this.props.control.type === 'text') {\n return this.renderText();\n }\n\n if (this.props.control.type === 'number') {\n return this.renderNumber();\n }\n\n if (this.props.control.type === 'info') {\n return this.renderInfo();\n }\n\n if (this.props.control.type === 'divider') {\n return this.renderDivider();\n }\n\n if (this.props.control.type === 'header') {\n return this.renderHeader();\n }\n\n return <div style={{ color: 'red' }}>{this.props.control.type}</div>;\n }\n}\n"]}
|
package/build/DeviceList.d.ts
CHANGED
|
@@ -52,6 +52,13 @@ export default class DeviceList extends Communication<DeviceListProps, DeviceLis
|
|
|
52
52
|
static i18nInitialized: boolean;
|
|
53
53
|
private lastInstance;
|
|
54
54
|
private lastAliveSubscribe;
|
|
55
|
+
/**
|
|
56
|
+
* Synchronous mirror of `state.alive`. `setState` is asynchronous, so the guard in `aliveHandler`
|
|
57
|
+
* cannot rely on `state.alive` being committed yet when `subscribeState` replays the current value.
|
|
58
|
+
* This field is always updated synchronously together with `setState({ alive })` and is the source
|
|
59
|
+
* of truth for the "did alive actually change?" check, which prevents the double device load.
|
|
60
|
+
*/
|
|
61
|
+
private alive;
|
|
55
62
|
private lastTriggerLoad;
|
|
56
63
|
private filterTimeout;
|
|
57
64
|
/** Resolved model value per device (stringified id -> model), reported by the cards to build the model dropdown */
|
package/build/DeviceList.js
CHANGED
|
@@ -32,6 +32,13 @@ export default class DeviceList extends Communication {
|
|
|
32
32
|
static i18nInitialized = false;
|
|
33
33
|
lastInstance;
|
|
34
34
|
lastAliveSubscribe = '';
|
|
35
|
+
/**
|
|
36
|
+
* Synchronous mirror of `state.alive`. `setState` is asynchronous, so the guard in `aliveHandler`
|
|
37
|
+
* cannot rely on `state.alive` being committed yet when `subscribeState` replays the current value.
|
|
38
|
+
* This field is always updated synchronously together with `setState({ alive })` and is the source
|
|
39
|
+
* of truth for the "did alive actually change?" check, which prevents the double device load.
|
|
40
|
+
*/
|
|
41
|
+
alive = null;
|
|
35
42
|
lastTriggerLoad = 0;
|
|
36
43
|
filterTimeout = null;
|
|
37
44
|
/** Resolved model value per device (stringified id -> model), reported by the cards to build the model dropdown */
|
|
@@ -134,6 +141,7 @@ export default class DeviceList extends Communication {
|
|
|
134
141
|
backToInstancesList() {
|
|
135
142
|
window.localStorage.removeItem('dmSelectedInstance');
|
|
136
143
|
this.props.onInstanceChanged?.('');
|
|
144
|
+
this.alive = null;
|
|
137
145
|
this.setState({
|
|
138
146
|
selectedInstance: '',
|
|
139
147
|
devices: [],
|
|
@@ -156,7 +164,7 @@ export default class DeviceList extends Communication {
|
|
|
156
164
|
// show instance selector
|
|
157
165
|
await this.loadAdapters();
|
|
158
166
|
}
|
|
159
|
-
if (this.
|
|
167
|
+
if (this.alive === null && this.state.selectedInstance) {
|
|
160
168
|
try {
|
|
161
169
|
// check if the instance is alive
|
|
162
170
|
const stateAlive = await this.props.socket.getState(`system.adapter.${this.state.selectedInstance}.alive`);
|
|
@@ -167,11 +175,16 @@ export default class DeviceList extends Communication {
|
|
|
167
175
|
catch (error) {
|
|
168
176
|
console.error(error);
|
|
169
177
|
}
|
|
178
|
+
// Update the synchronous mirror BEFORE subscribing. `subscribeState` replays the current
|
|
179
|
+
// value to `aliveHandler`; with `this.alive` already set, that replay is recognized as
|
|
180
|
+
// "no change" and does not trigger a second `loadAllData()` in addition to the one below.
|
|
181
|
+
this.alive = alive;
|
|
170
182
|
this.lastAliveSubscribe = this.state.selectedInstance;
|
|
171
|
-
this.setState({ alive }
|
|
183
|
+
this.setState({ alive });
|
|
184
|
+
await this.props.socket.subscribeState(`system.adapter.${this.state.selectedInstance}.alive`, this.aliveHandler);
|
|
172
185
|
}
|
|
173
|
-
else if (this.
|
|
174
|
-
alive = this.
|
|
186
|
+
else if (this.alive !== null) {
|
|
187
|
+
alive = this.alive;
|
|
175
188
|
}
|
|
176
189
|
if (alive) {
|
|
177
190
|
try {
|
|
@@ -190,10 +203,15 @@ export default class DeviceList extends Communication {
|
|
|
190
203
|
aliveHandler = (id, state) => {
|
|
191
204
|
if (this.state.selectedInstance && id === `system.adapter.${this.state.selectedInstance}.alive`) {
|
|
192
205
|
const alive = !!state?.val;
|
|
193
|
-
|
|
206
|
+
// Compare against the synchronous mirror, not `state.alive` (which may not be committed yet
|
|
207
|
+
// when `subscribeState` replays the initial value). This is what stops the double load.
|
|
208
|
+
if (alive !== this.alive) {
|
|
209
|
+
this.alive = alive;
|
|
194
210
|
this.setState({ alive }, () => {
|
|
195
211
|
if (alive) {
|
|
196
|
-
|
|
212
|
+
// The instance just became alive: (re)load all data directly instead of
|
|
213
|
+
// re-running the whole mount logic.
|
|
214
|
+
this.loadAllData().catch(console.error);
|
|
197
215
|
}
|
|
198
216
|
});
|
|
199
217
|
}
|
|
@@ -213,7 +231,7 @@ export default class DeviceList extends Communication {
|
|
|
213
231
|
loadDeviceList() {
|
|
214
232
|
this.setState({ loading: true }, async () => {
|
|
215
233
|
console.log(`Loading devices for ${this.state.selectedInstance}...`);
|
|
216
|
-
let alive = this.
|
|
234
|
+
let alive = this.alive;
|
|
217
235
|
if (this.state.selectedInstance !== this.lastAliveSubscribe) {
|
|
218
236
|
if (this.lastAliveSubscribe) {
|
|
219
237
|
// unsubscribe from the old instance
|
|
@@ -224,13 +242,15 @@ export default class DeviceList extends Communication {
|
|
|
224
242
|
try {
|
|
225
243
|
// check if the instance is alive
|
|
226
244
|
const stateAlive = await this.props.socket.getState(`system.adapter.${this.state.selectedInstance}.alive`);
|
|
227
|
-
|
|
228
|
-
alive = true;
|
|
229
|
-
}
|
|
245
|
+
alive = !!stateAlive?.val;
|
|
230
246
|
}
|
|
231
247
|
catch (error) {
|
|
232
248
|
console.error(error);
|
|
249
|
+
alive = false;
|
|
233
250
|
}
|
|
251
|
+
// Set the synchronous mirror before subscribing so the replayed initial value
|
|
252
|
+
// does not trigger an extra load on top of the one performed right below.
|
|
253
|
+
this.alive = alive;
|
|
234
254
|
await this.props.socket.subscribeState(`system.adapter.${this.state.selectedInstance}.alive`, this.aliveHandler);
|
|
235
255
|
}
|
|
236
256
|
else {
|
|
@@ -239,6 +259,7 @@ export default class DeviceList extends Communication {
|
|
|
239
259
|
}
|
|
240
260
|
let devices = [];
|
|
241
261
|
try {
|
|
262
|
+
this.alive = alive;
|
|
242
263
|
this.setState({ devices, loading: !!alive, alive });
|
|
243
264
|
if (alive) {
|
|
244
265
|
await this.loadDevices((batch, total) => {
|