[RELEASE] Sonoff Tasmota Device Handler

Hello,
I wasn’t able to find any SmartThings Device Handler for Sonoff devices with Tasmota flashed. So I wrote one and wanted to share. It doesn’t require any smartapps, directly uses the Web api. It’s quite basic but it works.

Currently it supports POW R2. It should be easy to add support for others as well. All feedback is welcome.

7 Likes

Awesome!
Forgive my stupid question but in the instructions you say

  1. In the mobile app change the IP and Port of your device

How do I do this in the mobile app…? Or is this something I need to set in the device handler.

Sorry for not being clear here. After you add the device handler on the graph website you will need to manually add a new device of the kind you need.
This will let the new device show up in the mobile app (classic mobile app I’m using)
When the new device shows up in the mobile app, you’ll use the settings button on the right top within the sonoff device screen.

1 Like

Oh gotcha! Add a new device from the website, then adjust in the mobile app.

Well, I can confirm it works perfectly for the basic on/off control I am using it for with a Sonoff Basic. Thanks!!!

1 Like

Congratulations for the initiative.
Is this Device Handler capable of updating the sonoff IP? My router is dynamic DCHP. Will I have to reserve an IP for sonoff?

Thanks!
No it does not change or track the IP. You will need to assign a static IP from your router or reserve one.

Why the delay in feedback ON OFF the Smarttihgs app?
It takes too much time or it does not work.

1 Like

How long is the delay? 1-2 seconds is sometimes normal.

This is definitely an improvement over the original Tasmota DTH as you don’t need to manually specify the relay GPIO settings. While I do not expect the DTH to support live polling without some MQTT link, my devices using this DTH tend to show a false ‘offline’ status when they’ve been left dormant for some time. However, they still respond to on/off via the app and voice control, which for the most part is all I need. It will be interesting to see how this develops.

1 Like

There is polling actually every 5 minutes to check status with checkInterval but I may be doing something wrong. I’ll try to reproduce what you’re seeing. I’d appreciate if you can let me know how to reproduction.

I’m planning to add a stand alone Sonoff Basic DTH just to make it clean. I don’t own one but it seems it would be straight forward to add one by removing the power monitoring pieces. Maybe later a smart app to scan network to auto discover devices etc.

I’m open to suggestions.

1 Like

I have the same behavior with this device handler. My sonoff basic with tasmota 6.6 goes to an unavailable state after some time idle.

Any clues on this ?

Unfortunately I am not that great at programming but I notice my devices show as offline in both the IDE and the app.

Also if you try to voice control any of them, Alexa gives a connection error response, yet like the app, both are still able to “wake the device up” and it does what you want it to do.

I don’t know if there is an issue with the code for polling. It seems like the device just falls asleep (appears offline) after 5 minutes since the last action.

1 Like

I can’t seem to get this to work for me. Is anyone still using it successfully?

I originally didn’t have a password set but since it seems to be required I went ahead and created one and used admin as the username but it still wont connect.

I have the IP address and port correct and I don’t know what else to try. Does it take some time for it to come online after changing the settings?

I get this error in the logs when I hit the refresh button - java.lang.NullPointerException: Cannot invoke method getDataValue() on null object @line 98 (callTasmota)

This is interesting.

device.hub.getDataValue(“localIP”) supposed to be working with all Smartthings Hubs.

What’s the version of the hub and firmware you have?

hub v2, US customer Rev E

Firmware Version: 000.026.00012

I’m not getting a hub error. The error is this:

java.lang.NullPointerException: Cannot invoke method getDataValue() on null object @line 98 (callTasmota)

device.hub Is returning Null for some reason. I’ll check.

I was not able to find substantial hints in regards to why this is happening. I want to make sure this is done right. Just to make sure… Some docs say that device may not be associated with the hub therefore device.hub may return null.

  1. Login to graph site
  2. Hit My Locations
  3. Select the right location
  4. Hit My Device Handlers
  5. Hit Create New Device Handler
  6. Select From code and copy/paste the device handler code from github link up top.
  7. Hit Create
  8. Click Save then Publish, For me.
  9. Hit my devices
    • New Device
  10. Fill in the mandatory parts name, device network id, type, select location, hub.
  11. Hit create.
  12. Go to mobile app
  13. Select new device
  14. Hit options right top
  15. Enter info.

This is exactly how I originally did it. Just to make sure I removed everything and recreated it using your steps but still no success. Any other ideas?

Hi, guys

i had same problems like Jeremy_S
i am follow the instructions but my sonoff basic appear offline in smarttthings mobile app
and appear offline in “My Devices” in smartthings web

  • sonoff R3 with tasmota firmware v 6.6.0
  • with username & password setting complete
  • hub Hardware Version: v2 US
  • firmware 000.026.00012

thks

1 Like

I am using this DHT with a Sonoff Basic. At first I am only able to turn off the device, later the device just goes unavailable permanently. Tasmota firmware 6.6.0.