So here’s one way …
I have a “common” mqtt channel for multiple iBeacons and need to extract the battery level for a specific one. I’m using automation to monitor/filter the mqtt channel and extract it’s encoded battery level. I then use the community’s variable component to store and display in the UI:
variable:
ibeacon_battery:
value: 0
automation:
trigger:
platform: mqtt
topic: 'room_presence/#'
condition:
condition: template
value_template: '{{ trigger.payload_json.id == "UUID-1-1" }}'
action:
service: variable.set_variable
data_template:
variable: ibeacon_battery
value: '{{ trigger.payload_json.minor | int // 2**8 }}'