Z-wave door/window sensor configuration

So, I’ve got my Aeon Labs Z-wave USB stick and I hooked up my z-wave door/window sensor and set it up like so:

customize:
    sensor.linear_unknown_type2001_id0102_burglar_2:
      friendly_name: Burglar 1
    sensor.linear_unknown_type2001_id0102_alarm_type_2:
      friendly_name: Alarm Type 2
    sensor.linear_unknown_type2001_id0102_alarm_level_2:
      friendly_name: Alarm Level 2

Question 1:
What I’ve noted is Alarm Level 2 = 0 when it is closed, and 255 when it is open. Also, the alarm type changes if I take the cover off (tamper) the sensor.

So, my question is, how do I get this to show up in the web interface as open and closed instead of 0 and 255?

Closed:

Open:

Question 2:
Also, what are “Linear Unknown type=2001, id-0102 SourceNo…” and “linear unknown type2001 id0102 sensor 2”? I
think maybe the first one might be the z-wave stick itself? And maybe the second one is the door sensor before I gave it a friendly name?

Thanks!!

2 Likes

Answer 1:
Are you sure there is no value between 0 and 255? I have a Smoke Sensor that works almost in the same way. On that device 0 means Off and 255 means “same as previous”. When my alarm is triggered the value changes to 3, then to 255.

To make it show up as Open / Closed you’ll have to use templates https://home-assistant.io/components/sensor.template/

Answer 2:
What are the complete entity-names? Have a look in the developer-tools: http://hass-ip:8123/devState

Awesome. Thank you @henriksjodahl!

  1. I suspect you’re right, I will have a look for another value between 0 and 255.
    Ah, template, sounds good. Thank you!

  2. Awesome, I will have a look. :slight_smile:

Thank you!!

  1. I’m starting to read about templates now. I’m not 100% sure how to get what I want, but I’m still trying to figure it all out. :slight_smile:

  2. The full names from devState are:

Entity ID:
binary_sensor.linear_unknown_type2001_id0102_sensor_2
This entity has no other attributes. I think this must be the z-wave stick itself maybe…

and

Entity ID:
sensor.linear_unknown_type2001_id0102_sourcenodeid_2
State attributes (JSON, optional)

{
  "battery_level": 100,
  "friendly_name": "Linear Unknown: type=2001, id=0102 SourceNodeId",
  "node_id": 2
}

Which must be the battery level for the door/window sensor.

Thanks for the help!

Ok, I just remembered my door/window sensor (GoControl brand which seems to be made by “Linear Retail”) came with instructions which told me the basic operation information:

  • Alarm Type:
    – Internal Switch: 0x07
    – Tamper Switch: 0x07
    – External Switch: 0x07
  • Alarm Event
    – Internal Switch: 0x02
    – Tamper Switch: 0x03
    – External Switch: 0xFE
  • Alarm Level
    – Internal Switch: Close = 0x00; Open = 0xFF
    – Tamper Switch: 0xFF
    – External Switch: Close = 0x00; Open = 0xFF

So I think, basically if I can detect an Alarm Type of 0x02 with an Alarm Level of 0xFF (255) the window/door is open. If the Alarm Type is 0x02 and the Alarm Level is 0x00 (0) then the window/door is closed.

Now I just need to get my template skills up to par. :slight_smile:

I’m trying something like this:

sensor:
  platform: template
  sensors:
      front_door:
        friendly_name: 'Front Door'
        value_template: >-
            {%- if sensor.linear_unknown_type2001_id0102_alarm_level_2 == 0 %}
                closed
            {%  elif sensor.linear_unknown_type2001_id0102_alarm_level_2==255 %}
                open
            {% else %}
                unknown
            {%- endif %}

But get this error message:

ERROR:homeassistant.components.sensor.template:UndefinedError: 'sensor' is undefined

Oh well, I’ll read a little more closely tomorrow and try some other stuff. :slight_smile:

Ok, I figured it out. I created a template in my sensors.yaml (which is included from my configuration.yaml) which looks like this:

- platform: template
  sensors:
    template_front_door:
        value_template: >-
          {%- if is_state("sensor.linear_unknown_type2001_id0102_alarm_level_2", "255") -%}
            {%- if is_state("sensor.linear_unknown_type2001_id0102_burglar_2", "3") -%}
              Tampered
            {%- else -%}
              Open
            {%- endif %}
          {%- else -%}
            Closed
          {%- endif %}
        friendly_name: 'Front Door'

Basically if the alarm_level is 255 then if the “burglar” then the devices has been opened/tampered with. If alarm_level is 255 and “burgler” is not 3 (In my car it would be 2), the door is “open”. Otherwise it’s closed. My template does not use any value from the external sensor port as I’m not using that right now.

I sure hope this helps someone else! :slight_smile:

10 Likes

Can anyone tell me why this is giving me an error:
> - platform: template
> sensors:
> template_front_door:
> value_template: >-
> {%- if is_state(“sensor.vision_unknown_type2022_id2201_alarm_level_5_1”, “255”) -%}
> Open
> {%- else -%}
> {%- if is_state(“sensor.vision_unknown_type2022_id2201_alarm_level_5_1”, “0”) -%}
> Closed
> {%- else -%}
> Error
> {%- endif %}
> friendly_name: ‘Front Door’

Post error messages when asking for help. If you want to test a template though, there is a tool in the webapp to do that under dev tools.

It seems like your value_template tag is indented by 4 spaces instead of 2, everything underneath it will have to be adjusted as well.

Thank you for posting this, it helped me figure out my gocontrol security essentials sensors :smile:

Thanks, I have the same sensor and I think this is exactly what I was looking for. :grinning: