Round value of a temp sensor in "Then" flow card

I get the value #temperature from the sensor and a Sonos speaker outputs it via a “Then” card. Sometimes the value is periodic, you can imagine how that sounds. Now, I’ d like to round from say 18.88 to 19 or from 18.33 to 18. How would I do this?

Create a variable.
Calculate the variable with this formula:

1 Like

Hmm, currently I just add the temp tag to the “Then” card. I looked a bit around but I struggle to get an idea how to do it.
What would I need to do get this working?
Update: I think I know how to set the variable but how to calculate with it and then use this value is beyond my current capability, I fear

Something like this:

Where ‘Test afronden’ is your variable and where the number 2 is how many decimals you want

Okay, I think I tried it. but how can I reuse the result in another card?

The first variable ‘ Test afronden’ is your variable you can reuse. The second ‘Test afronden’ is the tag you want to round. So in this case call your first variable TempRounded and the second variable us your tag you want to round

1 Like

If the Then card doesn’t support expressions, you can use a logics variable as in between step.

1 Like

TempHimmelpforte is the reusable variable

1 Like

thanks to both of you. It works. Problem was, I used “1” instead of “0”

I got a follow up question, does the “When” card actually matter or could it be any trigger?

It can be any trigger, but then you’ll have to select the temperature tag from the device, and not from the triggercard (called local tag).

Screenshot from 2022-10-01 18-36-34

1 Like

that’s actually great. I can integrate it with an already existing weather flow.

1 Like