RFXCOM: Adding a Alecto SA-33 (security 1 type) smoke sensor to homeassistant

I have trouble to add my recently purchased smoke sensor (Alecto SA-33)

This sensor is supported by the RFXCOM device and i am able the receive the messages from the sensor with RFXCOM

RFXCOM manager message:

Packettype = Security1
subtype = SA30 smoke detector
Sequence nbr = 0
id1-3 = 8D2000 decimal:9248768
status = Panic
Signal level = 8 -56dBm

Connecting the device to my raspberry pi 3 and have looked in the homeassistant log the show that the message is also received by the RFXCOM library within homeassistant.

Log home-assistant:

2017-10-07 17:09:51 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 8d200032 Class: RFXtrxDevice Sub: 9, Pkt_id: 082009018d20000660)

But somehow homeassistant is not able to convert this to one of the following devices: Switch, Light or binary sensor

I have enable auto detection on all 3 rfx devices and no devices is added to homeassistant.

I have tried to add the device manually (082009018d20000660) to Switch and Binary sensor, also without any succes.

Compared the packet with lowlevel.py and should not be a problem

Lenght[0]: 08 (eight bytes)
Type [1]: 20 (security 1)
Subtype [2]:09
seq.nr [3] :0
ID [4,5,6]=8d200
Status[7]=06
Noise level [8]=60

I have some programming knowledge (C#,C++, VB) but not yet in python. After looking at the code i am aware that the binary sensor only support lightning 4 type sensors. The switch however should support it, i think?

Please some suggestions to put me on the right track.

Make sure your config look like this:

switches:
  - platform: rfxtrx
    devices:
      '082009018d20000660':
        name: Smoke
        fire_event: True

Trigger the smoke detector and you should see an event fired in the log.
Make sure debug level is enabled for the logger

I already tried it without the quotes ’ ', with no succes
I tried it with the exact same code as you suggested, also without any succes!

I pressed the test button 3 times, and the library receives the string from RFXCOM, but the switch ‘Smoke’ doesn’t show any state changes or events!

Home assistant log info (Debug info enabled for rfx!):
2017-10-08 21:14:16 INFO (Thread-6) [homeassistant.components.rfxtrx] Add AV_switch rfxtrx
2017-10-08 21:14:16 INFO (Thread-12) [homeassistant.components.rfxtrx] Add Lamp naast bank rfxtrx
2017-10-08 21:14:16 INFO (Thread-6) [homeassistant.components.rfxtrx] Add WCD Buiten rfxtrx
2017-10-08 21:14:16 INFO (Thread-12) [homeassistant.components.rfxtrx] Add Lamp eettafel rfxtrx
2017-10-08 21:14:16 INFO (Thread-6) [homeassistant.components.rfxtrx] Add Smoke rfxtrx
2017-10-08 21:14:16 INFO (Thread-12) [homeassistant.components.rfxtrx] Add Lamp dressoir rfxtrx
2017-10-08 21:14:34 WARNING (Thread-6) [netdisco.ssdp] Error fetching description at http://192.168.39.9:49152/wps_device.xml
2017-10-08 21:15:12 DEBUG (Thread-22) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 8d200032 Class: RFXtrxDevice Sub: 9, Pkt_id: 082009008d20000660)
2017-10-08 21:15:14 DEBUG (Thread-22) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 8d200032 Class: RFXtrxDevice Sub: 9, Pkt_id: 082009018d20000660)
2017-10-08 21:15:58 DEBUG (Thread-22) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 8d200032 Class: RFXtrxDevice Sub: 9, Pkt_id: 082009028d20000660)

The switch will probably not change, but you should see an event fired in the log if you enable debug logging:

logger:
  default: debug

I enabled debug logging.

No events from the Switch ‘Smoke’
The only event i see in my log, related to keypress event on the smoke sensor, is the original RFXCOM receive event.

home-assistant log output:

2017-10-08 21:33:52 DEBUG (Thread-22) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 8d200032 Class: RFXtrxDevice Sub: 9, Pkt_id: 082009008d20000660)

There should be a button_pressed-event also. That is fired from the HA core, so make sure debug is enabled for all components:

logger:
  default: debug

No to Bad no other event! Of course i enabled debugging of al components.

And you have fire_event: True for the smoke switch?

Yes. Exactly as in your suggestion for the configuration file.

Sorry, then I do not have any more suggestions.

To bad, thnx for you help. I will try to look into the python code to find any other suggestions.

Here is the message you see: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/rfxtrx.py#L158

Here should the event be fired: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/rfxtrx.py#L366

I am looking at the debug messages and there it says Device ID=8d200032, while the real device ID=8d2000.
Where does the 32 come from? Could this be the problem?

After inserting extra debug messages in the code, the problem is not the device id. The registerd device id (read from config file) and the device id from the RFXCOM event are equal.

However i found out after receiving the event from the RFXCOM device, the event is not distributed and it seems that the statement <apply_received_command> (callback funtion?) is not executed!

I guess the code below is responsible for distributing the event further after receiving the event from the RFXCOM device?

 # Callback to HA registered components.
    for subscriber in RECEIVED_EVT_SUBSCRIBERS:
        subscriber(event)

Any other suggestions to look further?

After some debugging and code exploration, it appears that the RFTRX switch component not supports devices from the Security1 class. The following statements, is responsible for this.

def switch_update(event):
        """Handle sensor updates from the RFXtrx gateway."""
        if not isinstance(event.device, rfxtrxmod.LightingDevice) or \
                event.device.known_to_be_dimmable or \
                event.device.known_to_be_rollershutter:
            return

        new_device = rfxtrx.get_new_device(event, config, RfxtrxSwitch)
        if new_device:
            add_devices_callback([new_device])

        rfxtrx.apply_received_command(event)

After digging some more in the RFTRX libaries and code, the Alecto SA-33 sensor is only supported by the RFtrx sensor.
The disadvantage of the SA-33 sensor is only sending a “Panic” signal when smoke is detected. It never does send “Normal” signal, so the sensor it self is not direct usable for a practical use.

I have 2 different solutions to solve this problems

1
I made a modification for the code for the RFTRX binary sensor, so that this device could be used as binary sensor.
This is only a modification for the SA-33. When i have some more time i wil make a commit, to support all security 2 devices.

2 (prefered solution until now)
I made a virtual Smoke sensor with the use of the binary_input component and the template binary sensor by using the event that is fired every time a new Panic Signal is fired. The Virtual sensor will be active for a defined time after turning back to the normal state.

Config.yaml

sensor:

  • platform: rfxtrx
    devices:
    082009008d20000660:
    name: Smoke sensor
    fire_event: True
    data_type:
    - Sensor Status

input_boolean:
rooksensor:
name: rooksensor
initial: off

binary_sensor:

  • platform: template
    sensors:
    rookhal:
    device_class: smoke
    value_template: “{{ is_state(‘input_boolean.rooksensor’, ‘on’) }}”

Automation.yaml

  • alias: ‘Virtual Smoke sensor Hallway’
    trigger:
    platform: event
    event_type: signal_received
    event_data:
    entity_id: sensor.smoke_sensor_sensor_status
    action:
    • service: input_boolean.turn_on
      data:
      entity_id: input_boolean.rooksensor
    • delay : 5
    • service: input_boolean.turn_off
      data:
      entity_id: input_boolean.rooksensor

So you just added the smoke alarm manually? I have the same problem but with a different smoke detector

My packet received is

[0]Length  = 0x08 
[1]Type    = 0x20 (Security1)
[2]Subtype = 0x0a
[3]Seqnbr  = 0x03 
[4]ID1	   = 0x82 
[5]ID2	   = 0xd1 
[6]ID3	   = 0x03 
[7]Status  = 0x06 
[8]RSSI    = 0x79

so i am guessing my deviceid would be 08200a0382d1030679? Just add this as a sensor?

Yes, i add it manually. Make sure you are using the RFXtrx sensor and not the switch or binary_sensor variant.

If this does not work, you could try the automatic_add propery for the sensor to look if it is discoverd
.
Make sure that you receive the package with RFXmngr, when you connect the rfxcom to you PC to make sure that the RFXCOM can receive it.

Thanks! Adding it manually as a sensor was the only way of getting it to work it seems

Hello guys,
which RFXCOM receiver are you using for this?

M.