From c7c121182b72169667a93dff8bf96f7bf5486ea8 Mon Sep 17 00:00:00 2001 From: britea Date: Tue, 28 Apr 2020 10:24:58 +0200 Subject: [PATCH] fix dimmer scene state --- smart-hut/src/components/dashboard/devices/Light.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/smart-hut/src/components/dashboard/devices/Light.js b/smart-hut/src/components/dashboard/devices/Light.js index 32786ce..1415c5c 100644 --- a/smart-hut/src/components/dashboard/devices/Light.js +++ b/smart-hut/src/components/dashboard/devices/Light.js @@ -169,7 +169,7 @@ class Light extends Component { return (
- {this.props.stateOrDevice.kind === "dimmableLight" + {this.props.device.kind === "dimmableLight" ? intensityLightView : normalLightView}
@@ -185,7 +185,13 @@ const mapStateToProps = (state, ownProps) => ({ return state.sceneStates[ownProps.id]; } }, - //device: state.devices[ownProps.id], + get device() { + if (state.active.activeTab === "Devices") { + return state.devices[ownProps.id]; + } else { + return state.devices[state.sceneStates[ownProps.id].deviceId]; + } + }, }); const LightContainer = connect(mapStateToProps, RemoteService)(Light);