Can I manipulate the contents of trigger from state in an automation?

I have a bunch of triggers that looks like this in an automation:

sensor.termostat8_temperature

There are several different thermostats in the house that sends, and by using triggers with the different numbers I get them all. Then I use that to get info from the device into another program (EventGhost), where I run some rather heavy scripts on them:

payload_template: '{{trigger.from_state.attributes.node_id}}'

I also need some info that is not in sensor. but climate. for the same number (in this case 8). Can I in some way manipulate this so I get something like this (of course not working) example:

payload_template: '{{(climate.termostat+**only the number from trigger**.attributes.temperature}}'

So a form of split, which takes the 10th character from the trigger and puts it in where I have only the number from trigger here. That would save one of the few remaining kinks in my setup.