My binary template sensor not working

I just can’t get some binary template sensors to work.

I have one value:
sensor.orcon_current_mode that could have 3 values, 1,2 and 3.
Capture

Now I want to have 3 binary sensors to collor a button card.

binary_sensor:
  - platform: template
    sensors:
      orcon_current_mode_1:
        friendly_name: "Orcon operating mode is 1"
        entity_id:
        - sensor.orcon_current_mode
        value_template: "{{ states('sensor.orcon_current_mode', '1') }}"
      orcon_current_mode_2:
        friendly_name: "Orcon operating mode is 2"
        entity_id:
        - sensor.orcon_current_mode
        value_template: "{{ states('sensor.orcon_current_mode', '2') }}"
      orcon_current_mode_3:
        friendly_name: "Orcon operating mode is 3"
        entity_id:
        - sensor.orcon_current_mode
        value_template: "{{ states('sensor.orcon_current_mode', '3') }}"  

When I switch modes, I see the value of sensor.orcon_current_mode switching between 1, 2 and 3 but all three binary sensors always stays “off”.

What do I overlook?

Did you try your templates in Developer tools -> templates?

Change states() to is_state() and it should work. States returns the value of the entity. is_state checks the state of an entity against a supplied state, which is what you are trying to do.

Edit: you also don’t need the entity_id field. It’s going away next release too. Just remove it now because it should work without it.

binary_sensor:
  - platform: template
    sensors:
      orcon_current_mode_1:
        friendly_name: "Orcon operating mode is 1"
        value_template: "{{ is_state('sensor.orcon_current_mode', '1') }}"
      orcon_current_mode_2:
        friendly_name: "Orcon operating mode is 2"
        value_template: "{{ is_state('sensor.orcon_current_mode', '2') }}"
      orcon_current_mode_3:
        friendly_name: "Orcon operating mode is 3"
        value_template: "{{ is_state('sensor.orcon_current_mode', '3') }}"  

Thanks! That’s it :slight_smile:
It makes senso to.

1 Like

Hi Frank,

Is this for the Orcon ventilation?
How did you set this up?

That was a challenge indeed :slight_smile:

For sending commands I’m using a NodeMCU that is connected to the original remote that I had for the ORCON unit.



Via the band cable and the terminal board (bought on AliExpres) no soldering is required. In only soldered the wires to replace the battery with power from the NodeMCU.

For the readback I use a SONOFF POW2 power monitor and created a template sensor that determines the mode based on power consumption.

Do you need more specifics?

1 Like

Thanks. I think I understand how you managed to get the right readings with the sonoff.
I still have to figure out how to send commands to my Orcon unit…
It looks like a have a different remote unit…
The remote ( CO2 Remote control sensor 15RF ) downstairs looks like this:


And the unit self looks like this…

Already tried to play with the 868 mhz, but no luck. Thinking about to control it maybe somehow with a shelly/sonoff directly, but would not know where to start.

Besides the mains powered unit you show on the picture I also had a secondary battery powered remote.


(Dutch)

The “touch” panel for these buttons are connected via a ribbon cable you can easily replace.

Hi Frank, I have the same unit and I am trying to figure this out but I am running into some trouble when I try to simulate the touch switch with my esp. Do you mind sharing your esphome code? Would be greatly appreciated.

Bort

Sure, here it is.

esphome:
  name: orcon_mcu
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "-"
  password: "-"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "-"
    password: "-"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

sensor:
  - platform: wifi_signal
    name: "MCU_ORCON Signal Strength"
    update_interval: 300s
    
switch:
  - platform: gpio
    pin: D1
    inverted: True
    id: buttonA
  - platform: gpio
    pin: D2
    inverted: True
    id: button1
  - platform: gpio
    pin: D5
    inverted: True
    id: button2
  - platform: gpio
    pin: D6
    inverted: True
    id: button3
  - platform: template
    name: "Orcon Fan Auto"
    icon: "mdi:autorenew"
    turn_on_action:
    - switch.turn_on: buttonA
    - delay: 500ms
    - switch.turn_off: buttonA
  - platform: template
    name: "Orcon Fan 1"
    icon: "mdi:numeric-1-circle-outline"
    turn_on_action:
    - switch.turn_on: button1
    - delay: 500ms
    - switch.turn_off: button1
  - platform: template
    name: "Orcon Fan 2"
    icon: "mdi:numeric-2-circle-outline"
    turn_on_action:
    - switch.turn_on: button2
    - delay: 500ms
    - switch.turn_off: button2
  - platform: template
    name: "Orcon Fan 3"
    icon: "mdi:numeric-3-circle-outline"
    turn_on_action:
    - switch.turn_on: button3
    - delay: 500ms
    - switch.turn_off: button3

Nice! Thanks!

Hi Frank,

You’ve came up with the best solution to control the ORCON unit! All the other solutions are about changing the MVS-15 unit itself.

I’m new into ‘hardware’, so I’ve some questions you hopefully can answer.

I’ve searched on AliExpres for the band cable, cables and terminal board but couldn’t find similar ones. Which ones did you use?

Can you provide a photo of the cables connected to NodeMCU?

This is what I used.

terminal board

8pins, 1.0mm

band cable:

Package: 100mm
Insert Type: Type A
Connector Type: 1.0MM
Pins: 8P

Wiring
image

4 Likes

Thanks for helping me out!

@Frank_R great project description! I was looking for this manual (or only just a part of it) for a very long time!

@Frank_R Great mod, thanks for describing! I suppose you link the state of the ventilation to the start/stop of your showering/cooking or does it serve another purpose? If so, does this provide a lot of extra comfort compared to the “auto” mode in which the ventilation is automatically adjusted based on CO2 and moisture sensors in the device? I suppose the goal is to get rid of a lag phase, during which the “auto” ventilation is not yet adjusted when you just started showering?

Yes, indeed. I’m now in full control when and how much ventilation is required. Especially for showering I feel it’s improved.
But I’m also using this for the toilets. When movement is detected the ventilation starts. The duration even depends on which flush button is used :slight_smile:

1 Like

Thanks for the feedback! How does one monitor flush button pressing? :face_with_raised_eyebrow:

Behind the plastic flush cover stick two xiami tilt/vibration-sensors to the buttons :slight_smile:

1 Like

Does anyone has experience making this work with Homey?