Looking for a way how to trigger an action (automation) on sensor change to any new state (I have on/off/offline of my electrical boiler). Currently, I can solve by adding 3 separate automation with triggering by each of the states. But what if there maybe better way?
Yes, you can change it up to make it 1 automation, but you don’t really need to unless you just really want to.
You remove the part of your trigger that says to or from or state so it instead is triggered by any change in the sensor. Then, in your action you do can use sevice_template and use a template to call a script based on the state of the sensor. So now you would have 1 automation that can trigger different scripts based on the value of the sensor anytime the sensor value is updated.
Honestly though, id recommend just keeping what you have. You can separate the 3 automations into their own file if you want to clean things up.
Out of curiosity - how did you integrate speedtest.net (I believe) in HA? Is this a script which is running from time to time and setting a sensor state? (if this is possible form within a python script)