Oh, OK!
I think it’s all coming together now.
You already have a binary_sensor that was automatically created by the door sensor device. And the door sensor was already a “door” device class so it showed up correctly as such in the UI.
BUT…you want it to show as the opposite of what the door sensor usually shows. normally when the sensor is ‘on’ the icon and state are ‘open’. but you want the indication to be reversed from that so if the sensor is ‘on’ you want the state and icon to be ‘closed’.
that part i fairly easy but is kind of more advanced because it uses templates.
I think the problem is that you are trying to create the new template binary sensor under the customize section in your configuration files because:
It looks like you have a file that is split away from your main configuration.yaml file called “customize.yaml”, which is OK but you can’t create the new binary_sensor in that file.
the binary_sensor has to be created in your configuration.yaml file either directly by adding it in there or by using a separate file that uses the !include function.
I’m going to assume that you have no idea how this works to be able to explain it to you so don’t be offended if you already know this.
pretty much everything you manually add to HA goes into the configuration.yaml file.
like this:
/config_directory/
->configuration.yaml
in your configuration.yaml file:
homeassistant:
- stuff here
automation:
- automations here
script:
- scripts here
binary_sensor:
- your manually created binary sensors here
etc......
But you can also split up your configuration by using !include files in the configuration.yaml file
/config_directory/
->configuration.yaml
|
->automations.yaml
|
->scripts.yaml
|
->binary_sensors.yaml
|
-> etc
in your configuration.yaml file:
homeassistant:
- stuff here
automation: !include automations.yaml
script:!include scripts.yaml
binary_sensor: !include binary_sensors.yaml
etc......
then in your binary_sensors.yaml file:
- your manually created binary sensors here
Notices there is no “binary_sensor:” line in this file as it’s already in the configuration.yaml file
So, to make this work to reverse the indicated state of the door lock from the opposite of what a standard door would show (and using @jocnnor’s suggestion as an example) and depending on if you split your config you would do the following.
If using it directly in configuration.yaml:
homeassistant:
- stuff here
automation:
- automations here
script:
- scripts here
binary_sensor:
- platform: template
sensors:
your_door_lock_sensor:
friendly_name: "Your New Sensor"
device_class: door
# Want this to be inverse of the real sensor. So, if it reports off, this will return true (on).
value_template: "{{ is_state('binary_sensor.0x00158d00044b72dd_contact', 'off') }}"
etc...
if you are splitting up the config you would put the following in binary_sensors.yaml:
- platform: template
sensors:
your_door_lock_sensor:
friendly_name: "Your New Sensor"
device_class: door
# Want this to be inverse of the real sensor. So, if it reports off, this will return true (on).
value_template: "{{ is_state('binary_sensor.0x00158d00044b72dd_contact', 'off') }}"
You don’t need to add all of those attributes of the other sensor unless you really want to> but I recommend you don’t just to keep things more simple.
Now when you do that, do a config check an restart HA you should see a new binary sensor in your states page called “binary_sensor.your_door_lock_sensor” and it should always show the opposite state of your original “binary_sensor.0x00158d00044b72dd_contact”. And when you add it to lovelace it should show the opposite state as your original sensor too - if the original state showed “open” then the new one will show “closed”.
I hope I didn’t confuse things too much for you.