Grafana plot state on a tuya dual meter clamp

Hi
I have a Wifi Tuya dual meter device and I use local tuya.
I have configured all my entity with their respective class (except Direction A and B as I don’t know which one I should use).
Now I would like to see in my grafana dashboard the plot of the state of the direction A (the value is either FORWARD or REVERSE)
In home assistant, I can see it. But can’t make ot work on grafana
Capture d'écran 2024-05-16 091013

2nd question:
I have create a dashboard in home assistant wichi look like this
Capture d'écran 2024-05-16 093046
I would like to see in the 2nd card a negative value if the first card show REVERSE and a positive value if the first card show FORWARD.
how can I make it ?

Were you able to create the script to manage the value if it is forward or reverse?