SmartThings Integration - Missing Switch and Button

Testing out the new SmartThings Integration.
I have it working :slight_smile: with some of my devices showing up in HA, but
I have a couple of devices not showing up :frowning: :

  1. Aeotec Smart Switch 6
    Using Device Handler jbisson : Aeon Labs Smart Switch 6 Gen5
    It list the capabilities as:
    Actuator, Color Control, Configuration, Energy Meter,
    Polling, Power Meter, Refresh, Sensor, Switch, Switch Level.
  2. AeotecWallmote Quad
    Using Device Handler erocm123 : Aeon WallMote
    It list the capabilities as:
    Actuator, Battery, Button, Configuration, Health Check, Holdable Button, Sensor

It would seem they have the capabilities necessary to be detected.

The only error I get in the logs:

Traceback (most recent call last):
File ā€œ/opt/homeassistant/homeassistant_venv_3.6/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.pyā€, line 248, in _async_add_entity
await entity.async_device_update(warning=False)
File ā€œ/opt/homeassistant/homeassistant_venv_3.6/lib/python3.6/site-packages/homeassistant/helpers/entity.pyā€, line 347, in async_device_update
await self.async_update()
File ā€œ/opt/homeassistant/homeassistant_venv_3.6/lib/python3.6/site-packages/homeassistant/components/smartthings/light.pyā€, line 147, in async_update
convert_scale(self._device.status.hue, 100, 360),
File ā€œ/opt/homeassistant/homeassistant_venv_3.6/lib/python3.6/site-packages/pysmartthings/device.pyā€, line 283, in hue
return float(self._attributes.get(Attribute.hue, 0))
TypeError: float() argument must be a string or a number, not ā€˜NoneTypeā€™

Iā€™m not sure about this log as I do not have Hue lights.
Any suggestions?

Good News! 0.88 solved this. It added these two missing devices :smile:
Butā€¦

  • Smart Switch 6
    Energy sensor doesnā€™t appear to update very well (maybe after reboot)
    Power sensor doesnā€™t update at all. Always 0.

  • Wallmote Quad
    Shows the battery sensor,
    I can get an automation to work using the following:

trigger:
  platform: event
  event_type: "smartthings.button"
  event_data:
    name: "Kitchen Wallmote"
    value: "held" #or "pushed".

Unfortunately the event bus doesnā€™t contain the button number that was pushed or held. :frowning:

Unfortunately, the data payload which some handlers use to pass buttonNumber is not pushed through the new cloud API webhook, so itā€™s not available to us in HASS.

An alternative that does work is to have the Device Handler create child devices for each button, then have them raise the events (sendEvent/createEvent). This changes component_id in the payload from main to the name of the button, allowing you to know which button was pressed.

I implemented this logic in a custom handler I have for my GE Dimmer Switches, which has 2 buttons: https://github.com/andrewsayre/smartthings-custom-items

1 Like

The following solved the problem of the Energy Sensors not getting updated:

Thanks for the hint @wmaker @andrewsayre .
Can you advise me which entity is triggering the event ā€œsmartthngs.buttonā€? How did you make your ā€œKitchen Wallmoteā€?

Two entities are registered in config/.storage/core.entity_registry file as below after integrating smartthings to home assistant.

    {
        "config_entry_id": "e7709566b0a13c9bf4cc08d8ea",
        "device_id": "7aa7e5c58b8ca953d62a8c39b",
        "disabled_by": null,
        "entity_id": "sensor.button_temperature_measurement",
        "name": null,
        "platform": "smartthings",
        "unique_id": "4834f8d2-aeb5-8e714087ec52.temperature"
    },
    {
        "config_entry_id": "e7709566b0a13c9bf4cc08d8ea",
        "device_id": "7aa7e5c58b8ca953d62a8c39b",
        "disabled_by": null,
        "entity_id": "sensor.button_battery",
        "name": null,
        "platform": "smartthings",
        "unique_id": "4834f8d2-aeb5-8e714087ec52.battery"
    },

I think that those have nothing to do with button functionality. I saw context below in HA Docs (https://www.home-assistant.io/components/smartthings/#events)

{
  "component_id": "main",
  "device_id": "42a16cf2-fef7-4ee8-b4a6-d32cb65474b7",
  "location_id": "2a54b9fa-f66c-42d9-8488-d8f036b980c8",
  "value": "pushed",
  "name": "Scene Button"
}

Should I put something like above component in some yaml file?
My alias below doesnā€™t work.

- alias: Light Toggle
  trigger:
    platform: event
    event_type: "smartthings.button" 
    event_data:
      name: "Button1"
      value: "pushed"        
  action:
    - service_template: >
        {%- if is_state("switch.light1","on") -%}
          switch.turn_off
        {%- else -%}
          switch.turn_on
        {%- endif -%}
      data:
        entity_id: switch.light1

The ā€œKitchen Wallmoteā€ is name I use for the quad wallmote I setup in Smartthings and this name automagically shows up in the HA UI->Configuration->Integration SmartThings. If you go looking for the wallmote in HAā€™s ā€œdev-stateā€, you wonā€™t find it (other than maybe a sensor for the wallmote batteryā€¦in my case its sensor.kitchen_wallmote_battery).

The HA SmartThings Integration is publishing the button action as event on the ā€œevent busā€, and the automation is monitoring the event bus and looking for a match based on event_type, event_data information.

Looking at your entity registry (for the battery), I think you have named your device ā€œbuttonā€ and so the event_data.name should probably be ā€œbuttonā€ and not ā€œbutton1ā€.

To know for sure what event data to match on, I turned debugging on in my logger for the smartthings integration to capture events showing up.

You can also go to the events developer tool and temporarily turn on listening for the smartthings.button event to get the data passed on the bus each time the button is pressed.

Have read and re-read this thread 4 times, and still canā€™t figure out exact steps in automation to apply in order to get this to work. I have a similar issue, where I have a zwave Iris button thatā€™s connected to smartthings, and Iā€™ve been able to see the event in the dev-info log

2019-04-20 12:32:54 DEBUG (MainThread) [homeassistant.components.smartthings] Fired button event: {'component_id': 'main', 'device_id': 'abc-masked-abc', 'location_id': 'xzy-masked-xyz', 'value': 'pushed', 'name': 'Front Gate Button', 'data': None}

But Iā€™m unsure what values to put in the automation ā€˜Trigger Typeā€™, ā€˜Event Typeā€™, and ā€˜Event Dataā€™ fields in order to correctly trigger/fire this automation.

Thanks in advance for any help!

automation:
  trigger:
    platform: event
    event_type: smartthings.button
    event_data:
      device_id: abc-masked-abc
      value: pushed
1 Like

Brilliant, thank you so much, this works perfectly!

hey,
can you share the final auotmation code please?
i cant get this to work

- id: LivingRoomButtonPressed
  alias: Living Room Button Pressed
  trigger:
    platform: event
    event_type: smartthings.button
    event_data:
      device_id: xxxxx
      value: pushed
  action:
  - data_template:
      entity_id: light.study_back_light
    service_template: light.turn_off
1 Like

I no longer have this setup, and canā€™t confirm whether it still works with the latest HA version, but here is the original automation yaml:

  - alias: Wallmote Button 1
    trigger:
      platform: event
      event_type: "smartthings.button"
      event_data:
        name: "Kitchen Wallmote"
        value: "pushed" #or held
    action:
      - service: light.turn_on
        entity_id: light.table_lamp

Hereā€™s my code:

- id: '1556158361659'
  alias: Front Gate Button
  trigger:
  - event_data:
      device_id: 4c503d98-0bb5-4e14-93f3-xxxxxxxxxxxxx
      value: pushed
    event_type: smartthings.button
    platform: event
  condition: []
  action:
  - data:
      entity_id: switch.front_drive_gate
    service: switch.toggle
1 Like

thanks for the help

How do you make child devices? I am using the Aqara Magic Cube through smartthings using a custom device handler.

when listening for events I only get ā€œpushedā€ when I am doing multiple different button presses.

Event 2 fired 11:22 AM:
{
    "event_type": "smartthings.button",
    "data": {
        "component_id": "main",
        "device_id": "7d8db8ea-ffc1-4d45-9136-6c9cddb6360c",
        "location_id": "4af4a576-82e6-474e-8dec-1e9f64e7f4d5",
        "value": "pushed",
        "name": "Cube",
        "data": {}
    },
    "origin": "LOCAL",
    "time_fired": "2020-04-09T16:22:29.352913+00:00",
    "context": {
        "id": "0b36e38a5f9b497cacf76ec4a8bae007",
        "parent_id": null,
        "user_id": null
    }
}
Event 1 fired 11:22 AM:
{
    "event_type": "smartthings.button",
    "data": {
        "component_id": "main",
        "device_id": "7d8db8ea-ffc1-4d45-9136-6c9cddb6360c",
        "location_id": "4af4a576-82e6-474e-8dec-1e9f64e7f4d5",
        "value": "pushed",
        "name": "Cube",
        "data": {}
    },
    "origin": "LOCAL",
    "time_fired": "2020-04-09T16:22:09.379437+00:00",
    "context": {
        "id": "44555422e9894ce8a0402196ef854808",
        "parent_id": null,
        "user_id": null
    }
}
Event 0 fired 11:22 AM:
{
    "event_type": "smartthings.button",
    "data": {
        "component_id": "main",
        "device_id": "7d8db8ea-ffc1-4d45-9136-6c9cddb6360c",
        "location_id": "4af4a576-82e6-474e-8dec-1e9f64e7f4d5",
        "value": "pushed",
        "name": "Cube",
        "data": {}
    },
    "origin": "LOCAL",
    "time_fired": "2020-04-09T16:22:03.272197+00:00",
    "context": {
        "id": "934b28c6b7484314b3c675788f60c86e",
        "parent_id": null,
        "user_id": null
    }
}.

@markmghali Any luck with ā€œChild devicesā€ ?

Config: Smartthings with custom device handler: Aqara Switch WXKG02LM

On each button press i am getting two events on home-assistant event logger

Event 55 fired 3:00 AM:
{
    "event_type": "smartthings.button",
    "data": {
        "component_id": "main",
        "device_id": "61693b58-4b05-486e-8513-5815eb207dda",
        "location_id": "6996787a-187c-4b21-9076-29863fdce251",
        "value": "pushed",
        "name": "Aqara Switch WXKG02LM (2018)",
        "data": {}
    },
    "origin": "LOCAL",
    "time_fired": "2020-04-19T00:00:10.003288+00:00",
    "context": {
        "id": "368cb2ac624142a4a5abbf53263cab60",
        "parent_id": null,
        "user_id": null
    }
}
Event 54 fired 3:00 AM:
{
    "event_type": "smartthings.button",
    "data": {
        "component_id": "main",
        "device_id": "61693b58-4b05-486e-8513-5815eb207dda",
        "location_id": "6996787a-187c-4b21-9076-29863fdce251",
        "value": "pushed",
        "name": "Aqara Switch WXKG02LM (2018)",
        "data": {}
    },
    "origin": "LOCAL",
    "time_fired": "2020-04-19T00:00:09.616081+00:00",
    "context": {
        "id": "c5210faf3cb442b3b06045d9555e8b55",
        "parent_id": null,
        "user_id": null
    }
}

The issues are: there is no button number/nothing and two events per actual push

SmartThings is tracking button numbers correctly

No I did not figure out how to make child devices.

EDIT: You are not using the Aqara Cube never-mind

I do know certain cube modes send multiple button presses. I would start by using cube mode simple, which is 7 buttons.

1 Like

Iā€™ve just integrated my SmartThings Hub, I do not use a stand alone Z-Wave transceiver.

Trying to get the Aeotech Quadmote setup to control scenes that include blinds and lights, but I simply canā€™t find where you guys are saving these files.

Thereā€™s tons of information here all of which Iā€™m sure is really useful; Iā€™ve read this thread over and over and over.

Everyone is referring to placing code in certain places but nowhere do I see where you place any of this code.

I understand states and entities and how to trigger them, I do not understand how to get a push button to register so I can see those states and trigger my entities.

Iā€™m obviously a complete beginner here so realise Iā€™m clueless, where do I even start. Iā€™ve searched through the internet for hours on end and canā€™t find anything to help me.

Got it working:

Seems the indentations were getting me.

If you want to find what the button is doing and get the information from it:
Go to Developer Tools > Events, scroll down to ā€œListen to Eventsā€ enter smartthings.button in the field then hit ā€œstart listeningā€ and press the button of your choice.

Grouping lights can be done like this in the configuration.yaml, youā€™ll need to restart the server for it to work, hereā€™s the code for grouping

To find the entity names go to Developer Tools > Services
You can see them all in the drop down list under entities, the Services drop down will also show all the ways to call these entities.

light:
  - platform: group
    name: Kitchen Lights
    entities:
      - light.kitchen_1
      - light.kitchen_2

Final code in Automations.yaml, no other coded needed simple as that, hope this helps someone.

  - alias: LRB1PressedOnce
    trigger:
        platform: event
        event_type: "smartthings.button"
        event_data:
            component_id: "button1"
            name: "LR Aeotec Remote"
            value: "pushed"
    action:
     - service: light.toggle
       entity_id: light.kitchen_lights
1 Like

thank you!!! I had been looking for way to put these buttons to use.