Explicitly pass the new value on the Z-Wave setValue handler in case of binary toggles, since the target element can't be reliably determined

This commit is contained in:
Fabio Manganiello 2021-03-16 19:37:42 +01:00
parent 7f157d0234
commit ce0ca2e9ee
9 changed files with 15 additions and 12 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -55,7 +55,7 @@
</div>
<div class="boolean" v-else-if="['Bool', 'Button'].indexOf(value.type) >= 0">
<ToggleSwitch :value="value.data" @input="onValueChange" />
<ToggleSwitch :value="value.data" @input="onValueChange($event, !value.data)" />
</div>
<div class="value-data" v-else>
@ -194,10 +194,13 @@ export default {
})
},
async onValueChange(event) {
async onValueChange(event, data) {
const target = event.target ? event.target : event.event.target.parentElement
const value = this.node.values[this.value.id_on_network]
let data = target.value != null ? target.value : event.value
if (data === undefined)
data = target.value != null ? target.value : event.value
switch (value.type) {
case 'List':
data = value.data_items[event.target.value]
@ -212,7 +215,7 @@ export default {
case 'Button':
case 'Bool':
data = !parseInt(data)
data = !!parseInt(data)
break
case 'Decimal':