As I mentioned before… HA completly ignores definition of sensor.bazen_filtrace_doba_behu_cerpadla.
In log is possible to find out this. But it is error log automation… not for… declaration of platform: history_stats >> name: bazen_filtrace_doba_behu_cerpadla
Logger: homeassistant.components.homeassistant.triggers.numeric_state
Source: components/homeassistant/triggers/numeric_state.py:137
Integration: Home Assistant Core Integration (documentation, issues)
First occurred: July 3, 2023 at 22:33:11 (26 occurrences)
Last logged: 10:54:13
Error initializing 'websocket_api' trigger: In 'numeric_state' condition: unknown entity sensor.bazen_filtrace_doba_behu_cerpadla
Error initializing 'websocket_api' trigger: In 'numeric_state' condition: entity switch.tasmota_filtrace_bazenu state 'off' cannot be processed as a number
Error initializing 'Filtrace bazénu - automaticky vypnutí' trigger: In 'numeric_state' condition: entity switch.tasmota_filtrace_bazenu state 'off' cannot be processed as a number
Error initializing 'Filtrace bazénu - automatické vypnutí' trigger: In 'numeric_state' condition: entity switch.tasmota_filtrace_bazenu state 'off' cannot be processed as a number
Error initializing 'Filtrace bazénu - automatické vypnutí' trigger: In 'numeric_state' condition: unknown entity sensor.bazen_filtrace_doba_behu_cerpadla
You should forget about automation and focus on creating your entity first.
Enable debug logging for history stats integration, restart your HA instance and look for debug logs after changing the state of source switch couple of times.