Smartthings Motion, Contact and Battery Sensors

Hello, I have finally got ST setup in HA. Now I am trying to get all of my stats to come through. I successfully got my lock and outlet working but I’m having problems with my contact sensor, motion sensor and reporting battery life. Here is my code.

I know it’s probably a formatting issue. Any help would be greatly appreciated. Is there a guide that tells you how to format these?

Note: I know the spaces seem weird but I have spaces in my door lock name and my outlet name and they work just fine.

  • platform: mqtt
    name: “Detect Motion”
    state_topic: “smartthings/Motion Sensor/motion”
    payload_on: “active”
    payload_off: “inactive”

  • platform: mqtt
    name: “Garage Entry Door”
    state_topic: “smartthings/Garage Entry Door Sensor/contact”
    payload_on: “open”
    payload_off: “closed”

  • platform: mqtt
    name: “Front Door Battery”
    state_topic: smartthings/Front Door/battery
    unit_of_measurement: ‘%’

You may have to wait until the sensors send the battery stats to ST, otherwise it would be unknown.

No luck after sitting overnight.

did you get this figured out?

I’ve had mine running for a while but not had any battery indications from the motion or door sensors yet - since the batteries last a long time, they might only drop by a full percentage every few days (if that). To be honest, I’m not sure I’m getting reliable stats even in SmartThings itself - one sensor has been stuck at 89% for a while now!

I have had a presence sensor battery message though, so I can confirm the format looks OK.

I thought I was having trouble with the motion sensor until I realised I hadn’t selected it in the SmartApp configuration, so it’s worth checking that, and the log file for the MQTT bridge which shows the subscriptions.

I submitted a PR to the mqtt-bridge to update it every 15 minutes, the developer was going to implement slightly different but ran into a rate limit so he was rethinking it. Take a look at my repo and you can use the code in the meantime.

Yes, I got it figured out. I found out that most of my syntax was wrong.

I used these two commands to listen to what was being sent to the pi:
mosquitto_sub -h localhost -u pi -P raspberry -t ‘#’ -v
mosquitto_sub -h 192.168.1.50 -t ‘#’ -v

That should tell you the format to set everything up in. Also pay attention to the payload_on / off variable naming. I added the sensor_class: attribute as well but I’m not sure if it did anything.

Yeah i was gonna recommend to you to just pull up the logs on the bridge it will show you the mqtt that is going out from smart things. Just have to make the syntax match in HA. Glad you got it sorted. Mine works great.

I am just contemplating getting rid of ST and getting a Z-wave stick to add strait into HA. If I didn’t have any these smartthings branded zigbee devices i would have already switched over.

Hi
All is working well for me except the battery status. I looking at the logs and I have subscribed to the smartthings/Main Door Lock/battery. It is a zwave schlage lock. However the battery status is never received from smartthings. I can see the battery status in smartthings app. Please see the screenshot. every few minutes I get this data and ofcourse if something changes is recorded right away but no battery status is sent.
Is there a way to poll it from ST? As this data is there in the app.
Thanks

Hello,

Did you ever figure this out? I have had ST up for about a week now and the batteries never update…

Me too. Be very interested in how to get the battery information out of Smartthings

I have a similar problem; my Smartthings multi-sensors always show as 1% battery.