Support sensor value reported both on value as well as _value fields.

This commit is contained in:
Fabio Manganiello 2023-03-22 14:11:13 +01:00
parent bfc87e0f7b
commit 486f37a45e
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -13,8 +13,8 @@
</div>
<div class="col-s-3 col-m-2 pull-right"
v-if="value.value != null">
<span class="value" v-text="value.value" />
v-if="computedValue != null">
<span class="value" v-text="computedValue" />
<span class="unit" v-text="value.unit"
v-if="value.unit != null" />
</div>
@ -30,6 +30,14 @@ export default {
name: 'Sensor',
components: {EntityIcon},
mixins: [EntityMixin],
computed: {
computedValue() {
if (this.value.value != null)
return this.value.value
return this.value._value
},
},
}
</script>