I tried to avoid to make the request more complicated and wanted to use a templated sensor.
Is there a more elegant solution to push some measurement Values from an old Windows Machinte into a Home Assistant entity? (first time for me writing a python scriptlet)
If you can make the Windows machine respond to requests rather than push values, you could set up a RESTful sensor.
The way you’re trying to do it is at odds with the design of HA. Sensors are not designed to be overwritten with external “push” values, except for special cases like via the REST API or specific “push” integrations. Template sensors are intended to render their template. If you push a new value, it conflicts with the pre-set template (in your example, "0").