Skip to content

Commit

Permalink
In scene, trigger device state change should parse number as float
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Gilles committed Sep 6, 2021
1 parent 7ab2115 commit 92032be
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ class TurnOnLight extends Component {
if (value.includes(',')) {
value = value.replaceAll(',', '.');
}
this.props.updateTriggerProperty(this.props.index, 'value', value);
const lastCharacter = value.length > 0 ? value[value.length - 1] : '';
if (!isNaN(parseFloat(e.target.value)) && lastCharacter !== '.') {
this.props.updateTriggerProperty(this.props.index, 'value', parseFloat(value));
} else {
this.props.updateTriggerProperty(this.props.index, 'value', value);
}
};
handleValueChangeBinary = newValue => () => {
this.props.updateTriggerProperty(this.props.index, 'value', newValue);
Expand Down

0 comments on commit 92032be

Please sign in to comment.