HI I am new to HA and trying to integrate a motion sensor via MQTT that either sends a 0 for no motion or 255 for motion. I have the below item configured in my configuration.yml but it constantly shows unavailable. If I look in the topic in MQTT explorer I see that the value is changing between 0 and 255, it doesn’t report in json it just shows either 0 or 255. How should this be setup? thanks.
sensor:
- platform: mqtt
name: "Earl Office Motion"
state_topic: "HomeSeer-Ctrlr/mcsMQTT/main/Earl_Office/Earl_Office_Ceiling_Fan/state"
availability_topic: "HomeSeer-Ctrlr/mcsMQTT/main/Earl_Office/Earl_Office_Ceiling_Fan/state"
value_template: "{{ 'ON' if value_json.motion == '255' else 'OFF' }}"
device_class: motion