How to add and update a custom binary sensor?

I want to add a own binary sensor , which can shown the status of example
if screens are UP/ DOWN or status of controlleris OK./NOK
I can use a helper as text and add a UP or DOWN text in it
But i actually what a manual made binary , but how to ?
testt

Use a “threshhold sensor” - that will be a binary sensor.

Have you looked at dashboard features?

How to do that?

i added in in configuration.yaml

binary_sensor:
  - platform: threshold
    entity_id: sensor.random
    lower: 20

You mean at helpers ? but that is only ON /OFF i think

First breathe.

You have a couple ways you can do this and it depends on what you’re trying to accomplish.

Are you trying to just consolidate the view of the status or are you trying to create a synthetic control from the entities you have.

Please describe EXACTLY what those entities are. And what your end game is else we’re all just guessing at your intent and throwing out options.

(hint: if you just want pretty controls you may not need to ‘make’ anything)

i now have at text helper
and when i detecting screen are ging UP or DOWN
i write a text in it that is UP or DOWN

I prever a custom binary , where i can select UP or DOWN
or just toggle
But i have more of these, it would be easy that i could make a custom binary for UP/DOWN and another ON/OFF of OK/NOK

1 Like

Maybe a language problem here? How about writing this out in your first language and then putting that through Google Translate and posting the result.

1 Like

How does this get detected. Show us exactly where this comes from.

this is the code

I have no sensors on the screen itself. But i can read the power usage(shelly_1pm) . if the power is above 50 and with in 15sec , then it is moving the opposite direction. If it is Up then it is going down , etc

alias: Screen (motion check)
description: "check if screens are running "
trigger:
    - platform: numeric_state
    entity_id: sensor.shelly_1pm_screen_power
    for:
      hours: 0
      minutes: 0
      seconds: 15
    above: 50
    id: Screen_active
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_text.screen_status
            state: UP
        sequence:
          - service: input_text.set_value
            data:
              value: DOWN
            target:
              entity_id: input_text.screen_status
      - conditions:
          - condition: state
            entity_id: input_text.screen_status
            state: DOWN
        sequence:
          - service: input_text.set_value
            data:
              value: UP
            target:
              entity_id: input_text.screen_status
 ``

Perfect use for a trend sensor.

that is one of the helpers, i will test

how to add a value to the "trend helper " ?

at an automation >action

There’s no need to add a value. It calculates it based upon your power sensor. If the sensor is above a value, it will be “on”. If it’s below a value, it will be off. If you create two trend sensors, when the screen is going up, it will be on. On the second sensor, if the screen is going down, that sensor will be on. Then you just test which sensor is on and off and you have your up/down status. You could even do a simple template sensor to do it.

1 Like

mmh , but i do not need a ON/OFF text, but a UP/DOWN text stored at the helper

A simple template would take care of that.

{{ iif(states(‘sensor.screen’) == ‘on’, ‘UP’, ‘DOWN’) }}

Don’t over complicate it. :blush:

1 Like

Sorry , i do not understand

{{ iif(states(‘sensor.screen’) == ‘on’, ‘UP’, ‘DOWN’) }}

I think it is a template helper and with this code you can check if it is on , UP or DOWN ?

I can trigger it in an automation “template helper”
But how to set the template to the value , Up , down or on ?

It might be helpful to know how the screen stops at its UP & DOWN limits and what is the thing you call controller.
I’m understanding the screens operate independent of HA and the Shelly outputs power 0 to some positive value. From the Shelly sensor you want to display “Screen UP or DOWN” and “Controller OK or NOK”.
Could you please confirm or clarify?

The screens are from sompfy , so wireless
by using a shelly PM1, i can see it is running(using power) and when it has stopped. Normally it is up or down( never in beween/half away stopping)
So i have no sensor (end switch) . at first time i have to define if it is UP or DOWN
Then when it is moving and stopped again, i assome it is in the opposite direction
So i want to display in this case at the dasboard if it is UP or DOWN

HA operates in 1/0, on/off, true/false fashion. You wish to display HA stuff in human readable form as i see it. Bill’s above template sensor accomplishes just that for on/off to UP/DOWN conversion. Use another template sensor and replace ‘UP’ with ‘OK’ and ‘DOWN’ with ‘NOK’
Each screen gets a binary_sensor (on/off) that sensor is used in a template sensor that translates on/off to UP/DOWN or OK/NOK. You then use the template sensor to display the screen’s status as desired.
Please note there likely are more efficient methods but the above will do the deed.

1 Like