I got there in the end.
Still very long winded but it works.
This is setup as a package security.yaml
input_boolean:
master_bedroom_window:
master_bedroom_window_alarm:
automation:
##########
# Start of Master Bedroom Window
##########
- alias: master_bedroom_window_open
trigger:
platform: mqtt
topic: tele/sonoffBridge/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.RfReceived.Data == "1234EE" }}'
action:
service: homeassistant.turn_on
entity_id: input_boolean.master_bedroom_window
- alias: master_bedroom_window_close
trigger:
platform: mqtt
topic: tele/sonoffBridge/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.RfReceived.Data == "1234E7" }}'
action:
service: homeassistant.turn_off
entity_id: input_boolean.master_bedroom_window
- alias: master_bedroom_window_alarm
trigger:
platform: mqtt
topic: tele/sonoffBridge/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.RfReceived.Data == "1234EB" }}'
action:
service: homeassistant.turn_on
entity_id: input_boolean.master_bedroom_window_alarm
binary_sensor:
- platform: template
sensors:
master_bedroom_window:
friendly_name: "Master Bedroom Window"
device_class: window
value_template: >-
{{ is_state('input_boolean.master_bedroom_window', 'on') }}
master_bedroom_window_alarm:
friendly_name: "Master Bedroom Window Alarm"
device_class: problem
value_template: >-
{{ is_state('input_boolean.master_bedroom_window_alarm', 'on') }}
The Yellow Window Open and Problem symbol are the two binary_sensor’s