# Change float value

**URL:** https://discourse.nodered.org/t/change-float-value/68774
**Category:** General
**Created:** [9 October 2022 17:49 UTC](https://discourse.nodered.org/t/change-float-value/68774 "2022-10-09T17:49:35Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Andre009](https://avatars.discourse-cdn.com/v4/letter/a/41988e/32.png) [@Andre009](https://discourse.nodered.org/u/Andre009)
#### Post date: [9 October 2022 17:49 UTC](https://discourse.nodered.org/t/change-float-value/68774/1 "2022-10-09T17:49:36Z")

</div>

Hi,

i want to convert values that I read from my PV system and receive as e.g. fl\_450FF801 so that a correct value is displayed. fl\_450FF801 should become something like 0.34 kW.  
How can i change this values and what means fl\_ is it a float value? and to which value must i change it to become the real values behind it? same with value u8, what to do with this value?  
i read many topics here but didn't find the right solution, if it's already there please tell me where to find it 😉

![values](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/c/ac59b6c34363ddf5319f528ad41bb57a35700ccf.png)

Thanks for your help, regards, Andre

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [9 October 2022 17:56 UTC](https://discourse.nodered.org/t/change-float-value/68774/2 "2022-10-09T17:56:46Z")

</div>

It would help if you told us the make and model of the device. What does the manual say about values?

---

<div class="post-metadata">

### Author: ![Andre009](https://avatars.discourse-cdn.com/v4/letter/a/41988e/32.png) [@Andre009](https://discourse.nodered.org/u/Andre009)
#### Post date: [9 October 2022 18:11 UTC](https://discourse.nodered.org/t/change-float-value/68774/3 "2022-10-09T18:11:08Z")

</div>

Hi Steve,

its a SENEC Home v3 and i got these values from an website ([http://ipaddress/lala.cgi](http://ipaddress/lala.cgi)):

 ![senec](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/6/f60fb328d56410535339d6b1f33f1a3148ec1b6c.png)  
 ![senec2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/5/b5820d2144cd4feab826580742ee8265a5790dd0.png)

i want to work with the values and automat something...

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [9 October 2022 19:46 UTC](https://discourse.nodered.org/t/change-float-value/68774/4 "2022-10-09T19:46:22Z")

</div>

This page gives info on types [Query the hidden API of your SENEC photovoltaic appliances](https://blog.odenthal.cc/query-the-hidden-api-of-your-senec-photovoltaik-appliance/)  
According to this site this should work] for fl\_ and u8\_

```auto
msg.payload.fl = Buffer.from("fl_42A2E5E4".split("_")[1], 'hex').readFloatBE() // fl_
msg.payload.u8 = Buffer.from("u8_64".split("_")[1], 'hex').readUInt8() //u8_

```

Test flow

```auto
[{"id":"18144789e95d8588","type":"inject","z":"366a43adb328cf95","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"fl\":\"fl_450FF801\",\"u8\":\"u8_64\"}","payloadType":"json","x":110,"y":460,"wires":[["8a5128bec0bd3db6"]]},{"id":"aefc713a35661715","type":"debug","z":"366a43adb328cf95","name":"debug 11","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":920,"y":380,"wires":[]},{"id":"8a5128bec0bd3db6","type":"function","z":"366a43adb328cf95","name":"function 11","func":"msg.payload.float = Buffer.from(msg.payload.fl.split(\"_\")[1], 'hex').readFloatBE() // fl_\nmsg.payload.uint = Buffer.from(msg.payload.u8.split(\"_\")[1], 'hex').readUInt8() //u8_\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":500,"wires":[["aefc713a35661715"]]}]

```

---

<div class="post-metadata">

### Author: ![Andre009](https://avatars.discourse-cdn.com/v4/letter/a/41988e/32.png) [@Andre009](https://discourse.nodered.org/u/Andre009)
#### Post date: [10 October 2022 06:30 UTC](https://discourse.nodered.org/t/change-float-value/68774/5 "2022-10-10T06:30:00Z")

</div>

Hi E1cid, thanks for your help, ok that worked for me.. but only if i have a fixed value in this function node, how can i change this to a variable..

i tried:  
msg.payload.fl = Buffer.from("msg.payload.ENERGY.GUI\_HOUSE\_POW".split("_")[1], 'hex').readFloatBE() // fl_

but this didn't work?

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [10 October 2022 06:35 UTC](https://discourse.nodered.org/t/change-float-value/68774/6 "2022-10-10T06:35:14Z")

</div>

Try without quotes

```auto
msg.payload.fl = Buffer.from(msg.payload.ENERGY.GUI_HOUSE_POW.split("_")[1], 'hex').readFloatBE()

```

---

<div class="post-metadata">

### Author: ![Andre009](https://avatars.discourse-cdn.com/v4/letter/a/41988e/32.png) [@Andre009](https://discourse.nodered.org/u/Andre009)
#### Post date: [10 October 2022 07:08 UTC](https://discourse.nodered.org/t/change-float-value/68774/7 "2022-10-10T07:08:10Z")

</div>

small mistake big effect 😉

Now it's working, thanks so much.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [9 December 2022 07:08 UTC](https://discourse.nodered.org/t/change-float-value/68774/8 "2022-12-09T07:08:44Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
