Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95414

Create sensor or binary_sensor from switch (unavailable)

$
0
0

@ronny06 wrote:

Hello,
I need a binary sensor that tell the state of my sonoff switch if ON or OFF.
I create a following but in home assistant is always “unavailable”

  - platform: mqtt
    state_topic: "stat/sonoff4pro2/POWER1"
    name: "Tapparella_stato"
    availability_topic: "tele/sonoff4pro2/LWT"
    payload_on: ON
    payload_off: OFF
    value_template: "{{ value_json.state }}"
    device_class: "door"

The result of the sensor in the home assistant is “unavailable”
Perhaps there is something wrong in value_json and in the device_class.
Can someone help me?

Posts: 8

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95414

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>