[APP][Pro] Flow Utilities

Hello Robbert.

Thanks for you reply. My homey language is on dutch and location in the Netherlands. Still it keeps rounding the numbers.

3,00 becames 3 and 3,40 becomes 3, 4 euro’s. But it seems the problem is not the app, but in the homey?

Hi Pieter,

I’m sorry, I spoke to soon. I did not correctly understand your issue. Thanks for giving extra examples.
So If I understand you correctly when passing a number 3 it will return “3 euro” instead of “3,00 euro”? And “3,40” will return “3,4 euro”?
In that case that is not correct, and is maybe an issue in the app or something to do with JavaScript. But we can debug that.

Is this on Homey Pro or the new Homey Pro 2023?

Hello Robbert. It is the other way around. I want 2 decimals after the comma. I used round(number,2) but sometimes it makes it even numbers. But i like it when it says 3,00 instead of 3. I see this also on the flow utilities app. Even withe euro valuta.

I have the HP2019 pro, but i already ordered the HP2023.

Verzonden vanaf mijn Galaxy

-------- Oorspronkelijk bericht --------

Thanks I will have a look. Will let you know.

Thank you Robbert. Appreciate it.

If I may interfere, as far as I know it is a Homey (201x) issue, it is not (well) prepared for currency numbers, and it removes all trailing zeros from values.
(no clue if v10.x firmware finally fixed this issue)

These are currency values from PowerbytheHour for instance.
This device shows currency values with 4 digits, but Homey removes the trailing zeros:

And with regular currency values, the two digits become 1 or zero when the last figures is/are 0:
Screenshot from 2023-04-11 00-53-35

Hi Pieter,

Unfortunately I can reproduce the issue you are facing. When testing with both numbers homey will remove trailing zero’s (since this is a number value, this is normal behaviour for Javascript/NodeJS what Homey uses as scripting language)

See examples below for:
Homey Pro 2019

Homey Pro 2023

Can you share your flow setup, maybe by using extra code validation the numbers are getting lost?

This sounds more like normal number behaviour for Javascript. If you store a number type value “3.00” it will remove the trailing zero’s.

To resolve this for Flow Utilities I use the toLocaleString method. This also gives the benefit of showing different writing of € for different country’s. Some will show: “€ 3,00” but some countries use: “3,00 €”.

1 Like

Hello Robbert.

I don’t know what i did wrong, but it looks like following your example on the letter helped me. On this moment it seems toe be working.

Thank you for your app and support.
I will sent you a small donation to by you a beer.

1 Like

Hi Robbert,

That’s true, and I now see you have implemented a kind of ‘fix’ (in my eyes) in your app and I didn’t know yet :wink:

What I only tried to say was, I think Athom should implement something for currency cababilities like you did, with toLocaleString (I’m no coder). I’ll send them a request for that.
I understand this changes a float type to a string type, and with string type values no characters are getting removed anywhere in Javascript.
And to be able to do currency value calculations, there should be a set of string and num type variables for every currency value as I understand.

Thanks

To be able to calculate you need a number type of value. A string value is intended for normal text and is therefore untouched, but unable to do calculations with.

So indeed you need to have both types of them. It’s a bit confusing for non developers indeed :sweat_smile: and also complicated to make a good workflow for end users.

Good news from Athom. Improved integration for Hue motion sensors.

1 Like

Hi @RobbertV can you make a action card to set a variable to any number?

Hi @LRvdLinden,

I’m not sure, why that is needed. Most of the app variables are either string type or used for calculations outcomes. Otherwise you could use normal number values or normal variable values to do calculations in action cards.

Maybe you can give me an example use case to understand your feature request better?

@RobbertV @martijnpoppen
Is it possible to make an action card to replace text?

I would like to do some textmarkup in messages sent with Telegram, like make some words bold or italic or underline a part of a string. Or sometimes I want to remove some text in strings I receive (replace with nothing).

Hope you guys can add this to your usefull app!
Thanks in advance.

Hi @JMH,

We can make an action card to replace certain content with something else.
You can then provide a matching string or regex for the targeted string to be replaced. But this means that in order for it to work that incoming string needs to have the same value (part) set every time.

However reading you request, I think you want to have the matching value to be in the new formatted code as well, am I right? Because default behaviour would literally replace the matching text for new.

Example without keeping content:
Input: my string with some content
Replace ‘some content’ → ** (** => bold)
Outcome: my string with **

Example with keeping content:
Input: my string with some content
Replace ‘some content’ → ** (** => bold)
Outcome: my string with **some content**

You know text markup can already be done in strings? * = Bold Same way markup is done here on the forum. So if you can set the string value first time then this card is not needed. If it’s output like our tag values then this can be handy indeed.

1 Like

The way I would like to use the card is to replace the same text every time, aswell for markup as for changing text.

For example:
With the P2000-app I receive a long string, I would like to set the “Prio 1/2/3” to bold text.
→ AND string contains Prio 1 THEN replace Prio 1 with < b >Prio 1< /b >

Same app the ambulance were called from Noord Holland instead of Flevoland in my case. I want to change Noord Holland to Flevoland.

With this option I get a quick and better overview in my Telegram.

Hi @JMH,

Thanks for you response and explanation. I will have a look how we can make this in to an action card. I would like to make it more generally usable, so this requires some thinking and playing around.

I will have a look and let you know when I know more :slight_smile:

Hi @JMH,

I have been tinkering around and I think this should do the trick:

I have pushed this to the test release: Flow Utilities | Homey

1 Like

App update: (Test: 1.5.0 )

  • New Action card for text replace function