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 untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

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