Unable to use decimal numbers in the condition on variables

Edit PG: Message moved to a new topic :slight_smile:

Congrats on this PR!
I’m having trouble retrieving the charging states of my Zoe.
I want to create a scene that returns a Text value depending on the numeric value received from Node-RED.
The problem is that I can’t compare the variable (retrieved using the « Get last state » block) with a decimal value.
Indeed, here are the API values:

chargingStatus
Enum for battery-status charge state
NOT_IN_CHARGE = 0.0
WAITING_FOR_A_PLANNED_CHARGE = 0.1
CHARGE_ENDED = 0.2
WAITING_FOR_CURRENT_CHARGE = 0.3
ENERGY_FLAP_OPENED = 0.4
CHARGE_IN_PROGRESS = 1.0
# This next is more accurately "not charging" (<= ZE40) or "error" (ZE50).
CHARGE_ERROR = -1.0
UNAVAILABLE = -1.1

Here is the value retrieved in Node-RED :
Node-RED_BatteryStatus

Hi @gaetanb76,
Isn’t it a problem with . and ,?
Because if it’s a . and Gladys considers it as text, we don’t compare texts yet.

@gaetanb76 Since you do everything in Node-RED, why don’t you do this comparison in Node-RED? :slight_smile:

A simple switch node with all the cases and you’re done!

1 Like

Thanks @mutmut,
In node-red, msg.payload is a number.
I tried in Gladys with the . and the , but in Gladys, it’s impossible to enter those characters in the comparison block.

Thanks @pierre-gilles,
I thought about that but I wanted to create a scene with multiple conditions in Gladys because I thought it was possible.
I find it a shame to have to go through node-red for anything other than retrieving values.
So I’ll handle that in node-red, too bad.

@gaetanb76 Ah I hadn’t understood, indeed there is a bug, I also can’t enter decimal numbers in the « Condition on variables » condition :thinking:

I’ll fix it!

2 Likes

Fixed in this PR:

Thanks for the feedback @gaetanb76 :slight_smile:

2 Likes

The fix is available in Gladys Assistant 4.61:

1 Like