Struggling to read state from MQTT for zigbee device behiind Sonoff bridge

I have defined an MQTT based switch in my configuration.yaml and I’m struggling to get it to read the current state, it always remains in the OFF state.

Definition of the switch:

switch:
  - platform: mqtt
    command_topic: "cmnd/tasmota_956F6D/ZbSend"
    device_class: "outlet"
    name: "Plug_1"
    object_id: "zb_0xD14A_Plug_1"
    unique_id: "zb_0xD14A_Plug_1"
    payload_on: '{"Device": "0xD14A", "Send":{"Power": 1}}'
    payload_off: '{"Device": "0xD14A", "Send":{"Power": 0}}'
    state_topic: "tele/tasmota_956F6D/SENSOR"
    state_off: 0
    state_on: 1
    value_template: '{{ json_value["ZbReceived"]["0xD14A"]["Power"] }}'

I can see the switch in HA, and if I activate it to turn the switch on, all the correct MQTT messages are send and the outlet turns on.

However, after a few seconds, the HA state reverts to OFF (no new MQTT messages generated). The logbook for the switch never shows it turning on.

I’m able to subscribe to the MQTT state topic in the HA MQTT settings page , and see the messages published there after a state change, e.g.:

Message 151 received on tele/tasmota_956F6D/SENSOR at 5:40 PM:

{
    "ZbReceived": {
        "0xD14A": {
            "Device": "0xD14A",
            "Name": "Plug_1",
            "Power": 1,
            "Endpoint": 1,
            "LinkQuality": 115
        }
    }
}

QoS: 0 - Retain: false 

Testing the value_template in the Developer Tools template editor makes me think the template is ok:

{% set json_value = {
    "ZbReceived": {
        "0xD14A": {
            "Device": "0xD14A",
            "Name": "Plug_1",
            "Power": 1,
            "Endpoint": 1,
            "LinkQuality": 115
        }
    }
} 
%}

{{ json_value["ZbReceived"]["0xD14A"]["Power"] }}

Returns

Result type: number

1

as expected.

I’ve tried various values of state_on and state_off as both string and numeric types in the configuration.yaml (restarting HA between each change), but to no avail.

Anyone have any ideas what I can try next?

Thanks.

Figured it out.

json_value is not a thing. Should have been using value_json instead.

Needed to step away from the screen for a while to see it when I came back.