Do not force type cohercion on bool values - !!parseInt(true) = false in JavaScript, for some reason
This commit is contained in:
parent
b9738d88df
commit
fdd46edb6a
9 changed files with 8 additions and 28 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
2
platypush/backend/http/webapp/dist/static/js/chunk-462cbb8c.99201267.js
vendored
Normal file
2
platypush/backend/http/webapp/dist/static/js/chunk-462cbb8c.99201267.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
platypush/backend/http/webapp/dist/static/js/chunk-462cbb8c.99201267.js.map
vendored
Normal file
1
platypush/backend/http/webapp/dist/static/js/chunk-462cbb8c.99201267.js.map
vendored
Normal file
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
|
@ -195,23 +195,11 @@ export default {
|
|||
},
|
||||
|
||||
async onValueChange(event, data) {
|
||||
console.debug('DATA (1)')
|
||||
console.debug(data)
|
||||
|
||||
const target = event.target ? event.target : event.event.target.parentElement
|
||||
console.debug('TARGET')
|
||||
console.debug(target)
|
||||
|
||||
const value = this.node.values[this.value.id_on_network]
|
||||
console.debug('VALUE')
|
||||
console.debug(value)
|
||||
|
||||
if (data === undefined)
|
||||
data = target.value != null ? target.value : event.value
|
||||
|
||||
console.debug('DATA (2)')
|
||||
console.debug(data)
|
||||
|
||||
switch (value.type) {
|
||||
case 'List':
|
||||
data = value.data_items[event.target.value]
|
||||
|
@ -224,19 +212,11 @@ export default {
|
|||
data = parseInt(data)
|
||||
break
|
||||
|
||||
case 'Button':
|
||||
case 'Bool':
|
||||
data = !!parseInt(data)
|
||||
break
|
||||
|
||||
case 'Decimal':
|
||||
data = parseFloat(data)
|
||||
break
|
||||
}
|
||||
|
||||
console.debug('DATA (3)')
|
||||
console.debug(data)
|
||||
|
||||
this.commandRunning = true
|
||||
try {
|
||||
this.request('zwave.set_value', {
|
||||
|
|
Loading…
Reference in a new issue