Possible bug with template sensor helper showing incorrect state of 0

I thought I would try using the UI to create a couple of template sensors that are now a type of helper. Worked really well and I think easier than creating them in the yaml config but…

After creating the helper the state looks good in developer

but when I try to use the sensor in the UI, it says the state is 0

Is this a bug or am I just not understanding something?

Made progress on this and I do think it might be my lack of understanding.

When i setup the sensor I set it to a device class of duration and I think that a duration must be > 0

So the solution was just to edit the helper and not include a device class

  1. Duration cannot be < 0, so it is unclear why you defined a template sensor with a negative value.
  2. There are issues related to displaying a duration like this one. But probably this is not your case.

Thanks. Yes it is possible for my situation and calculation to be < 0 so now I understand that I can’t use the device class of duration so all good