properties - Polymer number property assignment changes value -
i have strange problem.
i implemented polymer element heating control , have property actual temperature.
the value of property 23.5 (float value).
when assign transfered 'correct' value property, value changed. show problem added console output:
temperature: 23 - states[id].val: 23.2 temperature type: number states[id].val type: number
as can see in output value rounded during assignment. don't use observers or modify value.
any ideas why value changed?
here's relevant part of polymer element:
<dom-module id="hm-thermostat"> <link rel="import" type="css" href="./styles/materialdesignicons.css"> <template> <style is="thermostatstyle"> .. </style> .. <div class="data"> <div class="flex-display act-vert-align"> <div class="mdi mdi-thermometer mdi-24px margin-right"></div> <div class="text-width" hidden$="{{small}}">aktuelle temperatur:</div> <div class="actualtemp">{{temperature}}°c</div> </div> </div> </template> <script> polymer({ is: 'hm-thermostat', properties: { .. temperature: { type: number }, .. }, .. datacallback: function (states) { (var id in states) { if (id.indexof(this.deviceid) >= 0) { switch (id) { .. case "hm-rpc.0." + this.deviceid + ".1.temperature": this.temperature = states[id].val; console.log("temperature: " + this.temperature + " - states[id].val: " + states[id].val); console.log("temperature type: " + typeof this.temperature + " states[id].val type: " + typeof states[id].val); break; .. } } else { .. } } } }); </script> </dom-module>
Comments
Post a Comment