diff --git a/config/uwap-home/index.js b/config/uwap-home/index.js index 56490ad..73f94a3 100644 --- a/config/uwap-home/index.js +++ b/config/uwap-home/index.js @@ -493,6 +493,11 @@ const config: Config = { min: 0, max: 255, text: "Helligkeit", + marks: [ + { value: 1, label: "Dunkel" }, + { value: 120, label: "Medium" }, + { value: 254, label: "Hell" } + ], icon: svg(icons.mdiBrightness7), topic: "livingroombrightness" }, diff --git a/src/components/App.js b/src/components/App.js index b696647..d0dade5 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -125,7 +125,7 @@ class App extends React.PureComponent { const topic = topics[i]; const stateTopic = this.topics[topic].state; const typeConversion = stateTopic?.type?.from ?? stateTopic?.type; - const val = (typeConversion ?? ((x) => x.toString()))(message); + const val = (typeConversion ?? ((x: Buffer) => x.toString()))(message); this.setMqttStateDebounced( {mqttState: Object.assign({}, merge(this.state.mqttState, { [topic]: val}))}); @@ -152,7 +152,7 @@ class App extends React.PureComponent { return; } const rawTopic = commandTopic.name; - const typeConversion = commandTopic.type?.to ?? commandTopic.type; + const typeConversion = commandTopic?.type?.to ?? commandTopic.type; const value = (typeConversion ?? Buffer.from)(val); this.state.mqttSend(rawTopic, value); } catch (err) { diff --git a/src/components/UiItems/Slider.js b/src/components/UiItems/Slider.js index 5c021da..6565d61 100644 --- a/src/components/UiItems/Slider.js +++ b/src/components/UiItems/Slider.js @@ -16,10 +16,12 @@ const BaseComponent = ({Icon, Label}, item, state, changeState) => (