Georg1
July 16, 2022, 7:39pm
1
Hi,
I get crazy to modify a Homematic window Sensor Typ HM-Sec-RHS-2 into a binary sensor.
I think I need to do so that I can use it in my sensor group.
I tried already
I’m passing the battery state over to HA via MQTT. One of the attributes is the charging status, and to grab this I’m using the following without issues:
- platform: template
sensors:
ls_charge_tablet:
friendly_name: "Tablet Charge State"
value_template: >-
{{ states.sensor.tablet_lstablet_ls_battery_sensor.attributes.charging_state }}
This creates a sensor that returns a value of charging / discharging. However, I’d prefer to convert this to a binary sensor if at all…
but I get no state. I think is is related that the HM Sensor can have 3 state.
0 = CLOSED should be OFF
1 = TILTED should be ON
2 = OPEN should be ON
Can someone guide me how to modify this?
Georg1
July 23, 2022, 11:09am
2
in the meantime I tried several codes, still no success.
Below 2 Ideas, has nobody a hint for me?
template:
- binary_sensor:
- name: Balkontuer_Drehgriffsensor
state: >
{{ is_state('sensor_wz_terrassentuer.CLOSED', "off")
or is_state('sensor_wz_terrassentuer.tilted', "on")
or is_state('sensor_wz_terrassentuer.OPEN', "on") }}
- platform: template
sensor:
- friendly_name: Balkontuer_Drehgriffsensor
value_template "{% if is_state('sensor_wz_terassentuer', 'CLOSED') %}off
{% elif is_state('sensor_wz_terrassentuer', 'TILTED') %}on
{% elif is_state('sensor_wz_terrassentuer', 'OPEN') %}on
{% endif %}"
I don’t know where you find your coding samples, but that should work:
{{ not is_state('sensor.wz_terrassentuer', "CLOSED") }}
Georg1
July 26, 2022, 3:44pm
4
Hi, I entered in /config/configuration.yaml
template:
- binary_sensor:
- name: Balkontuer_Drehgriffsensor
state: >
{{ not is_state('sensor.wz_terrassentuer', "CLOSED") }}
It doesn matter if the window is open or closed, I get always “True” in the Template Editor or “on” in Zustand
Georg1
July 27, 2022, 3:40pm
6
Hi, I entered in /config/configuration.yaml
template:
- binary_sensor:
- name: Balkontuer_Drehgriffsensor
state: >
{{ not is_state('sensor.wz_terrassentuer', "closed") }}
still no change. I get from sensor.wz_terassentuer CLOSED or OPEN but the binary_sensor.balkontuer_drehgriffsensor stay always at “on”
This is working code from my environment:
template:
- name: Türgriffkontakt KU
unique_id: "tuergriffkontakt_ku"
device_class: "door"
state: >
{{ not is_state('sensor.turgriffkontakt_ku', 'closed') }}
Replace “closed” with the relevant return type of your sensor.
Georg1
July 28, 2022, 7:22am
8
Hi, finally it works with
template:
- binary_sensor:
- name: Balkontuer_Drehgriffsensor
state: >
{{ not is_state('sensor.wz_terassentuer_state', "CLOSED") }}
thanks for you patience