I’m not sure if what you want to do is possible with this payload.
Be aware, the below works only if the desired number is always the first element and the text the last element of the payload.
This should work to extract the first number
value_template: "{{ value_json.split(";")[0] }}"
And this for the text
value_template: "{{ value_json.split(";")[-1] }}"
However, I think you need to either to create two sensors, one for the text and one for the number or if possible change the payload to a proper JSON payload, where “ok” is an attribute.
When I remove the “” from ; - it is also giving error…
Invalid config for [sensor.mqtt]: invalid template (TemplateSyntaxError: unexpected ';') for dictionary value @ data['value_template']. Got '{{ value_json.split(;)[0] }}'. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/mqtt/
Do you see a value when you cut the .split part and only leave "{{ value_json }}"? I think the issue could be that your sensor doesn’t publish the state in JSON format.
This MQTT “scan” that you did, was this made in home assistant? Your issue is either that the published data is not in JSON format or that home assistant is not connected to the MQTT Broker.
Well, the data isn’t coming through as JSON formatted data, so it would be value only. JSON requires key:value, and the data showing up on his message bus is not JSON.