# Follow-up: TotalEnergies contracts

**URL:** <https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314>\
**Category:** Configuration\
**Created:** [October 16, 2026, 2:32pm UTC](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314 "2026-10-16T14:32:54Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![JPPUYB](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/j/a9adbd/32.png) [@JPPUYB](https://community.gladysassistant.com/u/JPPUYB)\
**Post date:** [November 25, 2026, 10:55am UTC](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314/21 "2026-11-25T10:55:11Z")

</div>

I have Gladys+, so no worries …

Next:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/0/f/0f15b16132c9f5ebfc5a3248c4567c01cc1f9aaf.png)

Then 🙂

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/1/9/19cc6e95a86f04dd8cbcef018ee2bc42177063fa.png)

What catches my attention is in the text: ‘Retrieve the last state’.

OK?

If I understand correctly: I have a widget with a graph based on the Gazpar device that directly expresses kWh, which should not be affected, and an energy tracking based on MQTT expressing the cost and consumption converted into kWh.  
I could thus integrate the subscription…

---

<div class="post-metadata">

**Author:** ![prohand](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/prohand/32/15713_2.png) [@prohand](https://community.gladysassistant.com/u/prohand)\
**Post date:** [November 27, 2026, 10:29am UTC](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314/22 "2026-11-27T10:29:52Z")

</div>

Hello @JPPUYB,

Almost there, just two corrections:

1. **Variable: tab « Calculated », not « Text ».** In Text mode, the variable contains the phrase `5000 * 11.2` and not the result: Gladys would receive text instead of a number. Click on « Calculated » and re-enter the formula:  
`{{triggerEvent.last_value}} * 11.2`  
Check the `_` in `last_value`: the safest way is to type `{{` and choose from the list.
2. **MQTT Message: missing closing.** You need `{{ConversionIndexGazpar}}`, with the `}}` at the end.

« Retrieve the last state »: that’s just Gladys’s help. She reminds you that the variable must be created beforehand, either by « Set a variable » (your case), or by the action « Retrieve the last state ». You don’t need to do anything more.

And yes, you understood correctly:

- the Gazpar-based chart doesn’t change, the scene just reads its value;
- the energy tracking on the MQTT meter gives the consumption in kWh, the cost, and the subscription with « Display the subscription » in the « Energy Consumption » widget.

To verify: after the next GRDF reading, the MQTT index card should display a value in kWh (approximately 11 times the index in m³), and no longer « No state in history ».

---

<div class="post-metadata">

**Author:** ![JPPUYB](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/j/a9adbd/32.png) [@JPPUYB](https://community.gladysassistant.com/u/JPPUYB)\
**Post date:** [November 27, 2026, 12:53pm UTC](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314/23 "2026-11-27T12:53:53Z")

</div>

Today (actually, two days ago) I had a consumption but no effect. Also, I noticed that 🙂

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/5/6/56762768a61c20d271c6fa716e99b6101bb42c70.png)

It’s stuck at this second step. It seems the function is not accepted… There is no list offered …

End of MQTT message :vu.

Your opinion, please.

---

<div class="post-metadata">

**Author:** ![prohand](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/prohand/32/15713_2.png) [@prohand](https://community.gladysassistant.com/u/prohand)\
**Post date:** [November 27, 2026, 1:25pm UTC](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314/24 "2026-11-27T13:25:45Z")

</div>

Hello @JPPUYB,

Your scene is good now:

- “Calculated” tab: OK.
- Formula `{{triggerEvent.last_value}} * 11.2`: OK, the `_` is there.
- MQTT message `{{ConversionIndexGazpar}}`: OK.

The red line is not a Gladys error. It’s the browser’s spell checker: it doesn’t know `triggerEvent`. You have the same line under `ConversionIndexGazpar` in the MQTT message. You can ignore it.

No list after `{{` in “Calculated”: no problem. Your manually typed formula is exactly the one the list would have inserted.

Why the consumption from two days ago didn’t work:

- that day, the scene was still in Text mode and the `}}` was missing;
- a scene does not reprocess an already arrived value, it waits for the next one.

For the next steps:

1. Make sure to **Save** the scene.
2. At the next GRDF reading, the MQTT index card must display a value in kWh (about 11 times your index in m³).
3. This first value serves as the starting point. The consumption and cost arrive with the next reading.

Do not manually start the scene with “Start”: without a trigger, `triggerEvent.last_value` is empty and your MQTT index would receive a false value.

Keep me posted after the next reading.

---

<div class="post-metadata">

**Author:** ![JPPUYB](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/j/a9adbd/32.png) [@JPPUYB](https://community.gladysassistant.com/u/JPPUYB)\
**Post date:** [November 27, 2026, 4:00pm UTC](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314/25 "2026-11-27T16:00:51Z")

</div>

Very well, indeed on the browser it’s the spell checker, by the way on Android phones it’s not there.  
I thought that the startup would allow me to check the operation, by the way I added a message send to Telegram and when launching the scene by restarting I don’t receive it, logically it being empty before the first value has no impact… but afterwards empty is a change of value and we lose a day, right?

Out of curiosity, what language is behind it?

I posted a link to this thread on :slight\_ \*\*[External Integration - GRDF GAZPAR](https://community.gladysassistant.com/t/integration-externe-grdf-gazpar/10479)\*\*smile:

Thanks for your patience 😄

---

<div class="post-metadata">

**Author:** ![prohand](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/prohand/32/15713_2.png) [@prohand](https://community.gladysassistant.com/u/prohand)\
**Post date:** [November 27, 2026, 4:14pm UTC](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314/26 "2026-11-27T16:14:28Z")

</div>

Hello @JPPUYB,

**No data lost, good news.** When you launch the scene with « Start »:

- there is no trigger event, so `{{triggerEvent.last_value}}` is empty;
- the formula becomes `* 11.2`, Gladys cannot calculate it;
- the scene **stops abruptly** at the « Set a variable » step.

Result:

- no MQTT message is sent: your MQTT index received nothing, neither empty nor zero;
- no day lost, the counter remains as is;
- that’s also why your Telegram message doesn’t arrive: it is placed after the variable, it is never reached.

I therefore correct my previous message: « Start » does not send a false value, the scene stops before. It remains useless for testing, as it always stops at the same place.

**To see for yourself** , Gladys notes it in its logs:

```auto
docker logs gladys 2>&1 | grep "Set variable"

```

You should see `Set variable: Error evaluating value` at the time you clicked.

**To check at the next trigger event** , keep your Telegram message **after** the MQTT send, with both values:

`Gazpar : {{triggerEvent.last_value}} m³ → {{ConversionIndexGazpar}} kWh`

If you receive it, the whole chain works.

**The language behind:**

- Gladys is written in **JavaScript** (Node.js for the server, Preact for the interface);
- the `{{ }}` are **Handlebars** templates: they replace a name with its value;
- the « Calculated » mode then passes the text to **mathjs** , limited to calculation functions (+, −, ×, ÷, rounding, min, max…);
- the TotalEnergies integration is also in JavaScript (Node.js).

Thank you for the link to the GRDF Gazpar topic, it will help the next ones 🙂

Keep me posted after the next trigger event.

---

<div class="post-metadata">

**Author:** ![JPPUYB](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/j/a9adbd/32.png) [@JPPUYB](https://community.gladysassistant.com/u/JPPUYB)\
**Post date:** [November 27, 2026, 5:59pm UTC](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314/27 "2026-11-27T17:59:41Z")

</div>

Two things: on Android the step remained frozen with a blue outline and a blue bar at the top on Windows…

Found: Set variable: Error evaluating value: EventTrigger.last.value \* 11.2  
Followed by: Undefined symbol EventTrigger

OK as soon as it moves… See you soon.

---

<div class="post-metadata">

**Author:** ![prohand](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/prohand/32/15713_2.png) [@prohand](https://community.gladysassistant.com/u/prohand)\
**Post date:** [November 27, 2026, 6:24pm UTC](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314/28 "2026-11-27T18:24:40Z")

</div>

Hello @JPPUYB,

Good idea to check the logs, it teaches us something.

Gladys writes the formula **as it is recorded** , before replacing the {{ }}. However, your line shows:

EventTrigger.last.value \* 11.2

- no {{ }};
- EventTrigger instead of triggerEvent;
- last.value instead of last\_value.

That’s why you have Undefined symbol EventTrigger: the calculation is looking for a number called « EventTrigger ».

With the formula from your screenshot, a « Start » would rather give:

Set variable: Error evaluating value: {{triggerEvent.last\_value}} \* 11.2

Value expected (char 1)

Two possibilities:

- this line comes from an older attempt (before your correction);
- or the recorded formula is not the one you see on screen (for example a modification made on the phone and not saved).

To find out, display all attempts with their time:

docker logs -t gladys 2\>&1 | grep -A1 “Set variable”

The last line should correspond to your last click on « Start ».

Next:

- reload the scene page (F5);
- check that the « Calculated » field contains {{triggerEvent.last\_value}} \* 11.2;
- if it doesn’t, correct it, then **Save**.

For the step « frozen » in blue: reload the page (F5). If it remains stuck, send me a screenshot.

Keep me posted at the next reading.

---

<div class="post-metadata">

**Author:** ![JPPUYB](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/j/a9adbd/32.png) [@JPPUYB](https://community.gladysassistant.com/u/JPPUYB)\
**Post date:** [November 27, 2026, 10:19pm UTC](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314/29 "2026-11-27T22:19:26Z")

</div>

I’m retaking the last log because I actually did a test, so replay:

scene.actions.js:556 (Object.variable.set) Set variable: Error evaluating value: {{triggerEvent.last\_value}} \* 11.2  
scene.actions.js:557 (Object.variable.set) SyntaxError: Value expected (char 1)

I removed the spaces around \*:

scene.actions.js:556 (Object.variable.set) Set variable: Error evaluating value: {{triggerEvent.last\_value}}\*11.2  
scene.actions.js:557 (Object.variable.set) SyntaxError: Value expected (char 1)

So same punishment…

Other observation: (F5) no effect…  
As a workaround, since I’m on the scene editing page and I save then Start: blue line:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/7/3/732ce4478cbdb1d6ae48b10b0c2052aba4eaf106.png)

To refresh the screen, I go back to the widget, start. Then I re-edit the scene: no blue line.

---

<div class="post-metadata">

**Author:** ![prohand](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/prohand/32/15713_2.png) [@prohand](https://community.gladysassistant.com/u/prohand)\
**Post date:** [November 27, 2026, 10:35pm UTC](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314/30 "2026-11-27T22:35:37Z")

</div>

Hello @JPPUYB,

Good news: this log is exactly the one expected for a « Start ». Your saved formula is therefore the correct one, the old line EventTrigger.last.value came from an earlier test.

Why spaces don’t change anything:

- Gladys removes all spaces before calculation;
- without a trigger, {{triggerEvent.last\_value}} is empty;
- in both cases, the calculation receives \*11.2, hence Value expected (char 1).

You can put the spaces back or leave them as they are, it’s the same.

The blue line: Gladys highlights the current step. When a step stops the scene, the interface does not receive the « step completed » signal, so the frame remains. It’s just a display. Your way of doing it (exiting and then reopening the scene) is the right one.

I have reported this display issue to the Gladys developers: [Scene editor: step stays highlighted when an action aborts the scene · Issue #3456 · GladysAssistant/Gladys · GitHub](https://github.com/GladysAssistant/Gladys/issues/3456)

If you want to test the « Calculated » mode without waiting for GRDF, create a **separate test scene** :

1. « Set a variable » Test, « Calculated » tab: 5000\*11.2;
2. a Telegram message: Test: {{Test}};
3. « Start ».

You should receive Test: 56000. **Do not put any MQTT send** in this test scene: your index would receive a false value.

For the real scene, there is nothing more to do. We wait for the next GRDF reading.

Keep me informed.

[Previous page](https://community.gladysassistant.com/t/suivie-energie-contrats-totalenergies/11314.md?page=1)
