I'm not sure where else to post this, but others may find this useful.
I wrote a SmartThings device handler to support Sonoff devices running the Sonoff-Tasmota firmware. It implements the Momentary, Switch, Refresh, and Polling capabilities by making HTTP requests to the Sonoff device from the SmartThings hub. Currently you can turn on, turn off, and toggle the output of the Sonoff as well as read the current state of the Sonoff (on or off).
For those already invested in the SmartThings ecosystem, you can use the device handler to control the Sonoff devices from the SmartThings app.
The device handler can be found here:
https://github.com/BrettSheleski/SmartThingsPublic/blob/master/devicetypes/BrettSheleski/sonoff-tasmota.src/sonoff-tasmota.groovy
My Device Handlers
Create New Device Handler
From Code
tab paste in the code from https://github.com/BrettSheleski/SmartThingsPublic/blob/master/devicetypes/BrettSheleski/sonoff-tasmota.src/sonoff-tasmota.groovyCreate
Publish
--> For Me
My Devices
New Device
Create
edit
link next to Preferences.Save
Now the device is added to your account and you should be able to control your device from the SmartThings app on your phone.
@BrettSheleski, How do i know if switch is running Sonoff-tasmota, is there any url from where you bought them from pls ?
Thnx. Did add it to the Wiki.
I ended up copying and pasting the instructions to a readme.md file in my GitHub repo.
Since you're just adding a link in the wiki to this issue, it may be better to have the link point to my readme.md file instead.
I noticed someone has forked the repo already and looks to be adding a reboot option. If they submit a pull request to me then I can update the readme.md file with additional info.
Thnx again. Just updated the wiki to your readme.md
The device handlers works well and creating a new device works, but when turning the sonoff on/off the little indicator ON symbol on the app always stays in the ON/Green mode and not off, in saying this the actuall sonoff does switch on and off as per pushing the button on the app, but when pushing the app button it doesnt change state to off, it just keeps staying on the the whole time even when the relay does come in and out. any ideas?
I think I know what you're trying to say, but I'm not 100% certain. Let me first try to restate the issue so we're on the same page.
You are able to turn on/off the Sonoff as you would like using the SmartThings app, however the status it is reporting is not updating appropriately. Therefore when you turn the Sonoff On, it still shows that it is Off after successfully turning On.
Here's some background:
When turning the Sonoff On/Off with the SmartThings app it is actually issuing the Toggle command to the Sonoff. Therefore it should correctly turn it from On to Off, or from Off to On regardless of what the current status SmartThings reports. It does this by issuing an HTTP command to Sonoff and attempts to parse the response JSON (within the Parse() method of the SmartThings device handler). This happens sometime after issuing the toggle command to the Sonoff. The JSON that is returned by the Sonoff includes the current state which gets should get parsed and update the status of the Sonoff reported by the SmartThings app.
The Device Handler also implements the Polling capability (see the Poll() method in the device handler). The SmartThings hub will call the Poll() method periodically (exactly when and how often is unknown) which send another HTTP command to the Sonoff and that response again gets parsed by the Parse() method. This is done to update the status of the Sonoff in SmartThings app in case it's status has been set by some other means. The Parse() method reads the response of the HTTP command and updates the status of the Sonoff indicated by the SmartThings app.
It sounds like the Parse() method is not behaving correctly. However I just did some testing while writing this and it appears to be working correctly for me. If you press the refresh tile/button in the SmartThings app is the status updated appropraitely?
Do you happen to have a PulseTime set on your Sonoff? I have a Sonoff 1-Channel relay attached to my garage door opener set with a PulseTime of 200 milliseconds and its status is sometimes reported incorrectly by the SmartThings app.
Yes it it now working it took awhile for the time delay, but it is now showing correctly when sonoff is on and off,
While in talking to you, would you know of any good wifi dimmer devices that the sonoff has or any out there in the market that supports the smartthings? I'm in need of a wifi dimmer for my lounge room to dim my incandescent lights,
Regards Anthony
Sent from my iPhone
On 18 Sep 2017, at 11:31 pm, Brett Sheleski <[email protected]notifications@github.com> wrote:
I think I know what you're trying to say, but I'm not 100% certain. Let me first try to restate the issue so we're on the same page.
You are able to turn on/off the Sonoff as you would like using the SmartThings app, however the status it is reporting is not updating appropriately. Therefore when you turn the Sonoff On, it still shows that it is Off after successfully turning On.
Here's some background:
When turning the Sonoff On/Off with the SmartThings app it is actually issuing the Toggle command to the Sonoff. Therefore it should correctly turn it from On to Off, or from Off to On regardless of what the current status SmartThings reports. It does this by issuing an HTTP command to Sonoff and attempts to parse the response JSON (within the Parse() method of the SmartThings device handler). This happens sometime after issuing the toggle command to the Sonoff. The JSON that is returned by the Sonoff includes the current state which gets should get parsed and update the status of the Sonoff reported by the SmartThings app.
The Device Handler also implements the Polling capability (see the Poll() method in the device handler). The SmartThings hub will call the Poll() method periodically (exactly when and how often is unknown) which send another HTTP command to the Sonoff and that response again gets parsed by the Parse() method. This is done to update the status of the Sonoff in SmartThings app in case it's status has been set by some other means. The Parse() method reads the response of the HTTP command and updates the status of the Sonoff indicated by the SmartThings app.
It sounds like the Parse() method is not behaving correctly. However I just did some testing while writing this and it appears to be working correctly for me. If you press the refresh tile/button in the SmartThings app is the status updated appropraitely?
Do you happen to have a PulseTime set on your Sonoff? I have a Sonoff 1-Channel relay attached to my garage door opener set with a PulseTime of 200 milliseconds and its status is sometimes reported incorrectly by the SmartThings app.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/arendst/Sonoff-Tasmota/issues/656#issuecomment-330221298, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aduyw-3yZt0Gc7ZnCHuRyKB9fjBW-GEqks5sjnCegaJpZM4Om78a.
I got a bunch of GE Z-wave smart dimmers.
https://www.amazon.com/dp/B01MUCZA1C/ref=cm_sw_r_cp_apa_cggWzbT94W0R9
They're Z-wave, not WiFi, but SmartThings works great with them. They're about $40 each though.
Yer I looked at them I don't really want to replace the wall switch with that, I'm thinking a push button and the device hides behind the wall, I was looking at these
https://aeotec.com/z-wave-light-dimmer-switch
Have you had them or know anyone that has? I live in Australia and I'm pretty sure the z-wave frequency is illegal here lol, that's why I was hoping to get a wifi device dimmer?
Sent from my iPhone
On 19 Sep 2017, at 10:17 am, Brett Sheleski <[email protected]notifications@github.com> wrote:
I got a bunch of GE Z-wave smart dimmers.
https://www.amazon.com/dp/B01MUCZA1C/ref=cm_sw_r_cp_apa_cggWzbT94W0R9
They're Z-wave, not WiFi, but SmartThings works great with them. They're about $40 each though.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/arendst/Sonoff-Tasmota/issues/656#issuecomment-330391731, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aduyw2i_Uy_Vq-EIvQUDCvPN2LBvYof7ks5sjwf-gaJpZM4Om78a.
I have got the same problem like @djtonyd it still ON symbol on the smartthings app and always stays in the ON/Green mode and not off but when pushing the app button it doesnt change state to off, it just keeps staying on the whole time. Any idea?
And another question is it can control on/off via the app?
It sounds the SmartThings app is not communicating at all to the Sonoff. Make sure the IP address of the Sonoff is correct in the SmartThings app.
The device handler does implement the switch capability (see http://docs.smartthings.com/en/latest/capabilities-reference.html#switch) so there are distinct on() and off() methods. Therefore if you are using Alexa to control the Sonoff via SmartThings you can say "Turn On ..." or "Turn Off ..." and it will turn the device on/off accordingly (not just toggle).
However when using the SmartThings app it simply tells the Sonoff to toggle it's state when pressing the button. Therefore it shouldn't matter if the SmartThings app is reporting the wrong current state.
The only time I've seen the app report the wrong status is if the Sonoff is toggled from outside the SmartThings app (manual toggle, from the Sonoff-Tasmota web interface, MQTT command, etc.). The SmartThings app does periodically poll the status of the Sonoff therefore it should update the status when that happens. Therefore it is possible it is reporting the wrong status within the SmartThings app until it decides to poll the device again.
Also, within the SmartThings app you can press the refresh button (bottom-left) to manually update the status of the Sonoff.
Is it possible to use the device handler for a dual device like a Sonoff Touch 2 gang, where you have 1 IP address but 2 switches.
By the way Brett, fantastic job, it works great with my single devices.
It may be possible, I do not know since I don't have such a device.
I have a feeling it may currently operate one of the outputs, but not the other.
I plan on rewriting the device handler some day where one would add a single "logical" device to smart things which may spawn child devices depending on the module type. It could also read how the GPIO pins are configured and spawn child devices for those capabilities as well.
Hi Brett... The device handler works great and what you have done here is awesome. I do have the same problem as mentioned previously though. I can turn on and off from smartthings, or we interface, but it always reports status as a green "on".
Any ideas?
Thanks in advance
Blokey
Even when off!
Since Tasmota changed the format of the HTTP responses to be "true" json (see #1363 ), I have not yet updated the SmartThings device handler to accomodate this change yet.
However @diablodale has forked my repo and made a change to handle the updated format that Tasmota now responds with. This change will be merged into my code base sometime soon to account for this change, and also be backwards compatible with "legacy" deployments of Tasmota devices. See here for more detail on the issue.
hi Brett
Thanks for fast response. Look forward to the edit!
Real Newbie question here (Rea Newbie I am!!). What do you mean by "forked" and "Changed Handle"?
Thanks again.
Hello, i flashed my sonoff pow to Sonoff-Tasmota firmware and everything works fine, but
Smartthings switch always shows that sonoff is ON
and in graph.api.smartthings.com/device for this sonoff :
Data | No data found for device
Current States | No states found
So can anybody help me to correct this problem?
OK! I test @diablodale vertion and the result is the same.
hi brett
I see that @diablodale and yourself have done some more editing to the device handler over the last few days, but unfortunately I still cannot get an accurate status returned from the ST hub.
I am using Tasmota firmware version 5.11.1 and this latest handler but it still returns as "on" when it is off and also with the refresh button.
I hope that you can find a solution or guide me in the right direction as I really would like this direct connection; I know I haven't currently got the skills to code it!!
In the meantime, I have found a workaround that works for me, and may work for others....
My sonoffs are wired into my mains lights by room and work fine apart from the status issue; I have found the following will return a correct status, and is a bit of a temporary workaround:
1) Go to your Sonoff device on your local network to bring up the sonoff's Tasmota "homepage" by putting the IP address into your browser.
2) click on "Configuration"
3) click on "Configure Other"
4) Click on "Hue Bridge" emulation and "Save". The sonoff device will then restart.
5) Click on "Add Thing" on your Smartthings App on your mobile.
6) The Smartthings Hub will then find 2 new devices after a little wait of about 30 seconds.
a) Hue Bridge ######
b) Sonoff Device
7) As the Hue Bridge is just an emulator, and a "Dummy" parent device, I rename it for instance to "ZZ Kitchen Light Hue Bridge" in the "new Device Page" on the ST App so that it appears at the bottom of the Home Page on the ST App and doesn't get in the way/clutter things up.
8) I rename the Sonoff Device to "Kitchen Lights" or whatever.
9) Save it
10) Now on the ST app, I have my "Kitchen Lights" showing their correct status. It shows up in the graph device list as a "Lan Hue Extended colour", but I'm sure this can be changed by user if required. Seeing as the only function that is required with a sonoff switch is to turn the device on and off I don't see that this will really matter.
11) Now, I if I ask Google Home to turn off the Kitchen Lights etc then it works great and reports correctly. The only drawback I can see to this work around is If I as Google Home to "Turn off all the lights" it turns off all my lights including the emulated Hue Bridge attached Sonoff's.
Great for me, but if anyone had their TV connected this way, then this single phrase would also turn off their TV.
You can still use this workaround for any appliance and change the Icon and name in ST to a "TV" etc; but if you do and then ask Google/Alexa to turn off "all" your lights then your TV will turn off for instance.
It's a compromise maybe until perhaps the Device Handler works for me; not to detract from all of the hard work going on here as I know that I really would like this to work, but maybe something in this that helps with the device handlers coding??
Thanks
Blokeyuk72
Do you happen to have multiple Sonoff devices configured using the same IP address?
There's a side effect of the device handler changing the Network Device ID of the device to the hexadecimal value of the configured IP address. If you have multiple configured with the same IP address there would be a collision here and may explain why the status is not getting updated properly.
If using the simulator, make sure to uninstall the device from there too.
Hi
2 devices at moment, both sonoff basic, both with individual ip's!
Thanks
hello. i have very big problem with sonoff flashing. every time then i try flashing sonoff basic all times i get this problem:
C:\Windows\system32>cd\Users\Mantas\Desktop\New folder
C:\Users\Mantas\Desktop\New folder>esptool.exe -vv -cb 115200 -cp COM3 -ca 0x000
00 -bz 1M -bm dout -cf tasmota.bin
esptool v0.4.12 - (c) 2014 Ch. Klippel ck@atelier-klippel.de
setting baudrate from 115200 to 115200
setting port from to COM3
setting address from 0x00000000 to 0x00000000
setting flash size from 512K to 1M
setting flash mode from qio to dout
espcomm_upload_file
espcomm_upload_mem
setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
Uploading 495808 bytes from tasmota.bin to flash at 0x00000000
erasing flash
size: 0790c0 address: 000000
first_sector_index: 0
total_sector_count: 122
head_sector_count: 16
adjusted_sector_count: 106
erase_size: 06a000
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
setting serial port timeouts to 15000 ms
setting serial port timeouts to 1000 ms
espcomm_send_command: receiving 2 bytes of data
writing flash
.......................................................................................................................... read 0, requested 1
warning: espcomm_send_command: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed
warning: espcomm_send_command: wrong direction/command: 0x01 0x03, expected 0x01
0x04
closing bootloader
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
error: espcomm_upload_mem failed
Hello, I am having the same issue with the current status of the Sonoff switch not being reported correctly in the ST app. The app switches the Sonoff on and off but the app shows that the switch is on no matter what the true state of the Sonoff is. I have only one Sonoff configured so there are no conflicting ip addresses. When I flash the Sonoff with Eric Maycock's firmware, the ST app reports the status correctly. I want to use the Tasmota firmware so please help us since a few of us have the same problem. I have flashed 8 Sonoff Basics with both Tasmota and Erick's firmware using the NODEMCU flasher with no problems at all.
Try opening the Simulator in the SmartThings online IDE and select your actual device. After the device is installed/updated click the on/off/toggle buttons and see if there's any errors that appear in the log.
Also, I'll add a configurable refresh interval to the device handler that will update the status from the device.
Two questions. I see now that certain Tasmota files were updated yesterday to 5.11.1e. Has the sonoff.bin file been updated too? Second question. Since I use the bin file for flashing, can I change the project name and topic name of each Sonoff that I flash by logging into the web interface after?
ok I reflashed again and went into the simulator mode. I started with the switch in the off position, hit refresh, the app still indicates "on" even though switch is off. then hit the "on" button on the app and turn the switch on, hit the refresh button, app still reads "on". hit the "on" button on the app again to turn the switch off again. Still no change of the status of the switch in the app. Below is a log printo out of what I did.
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:22 AM: debug parse()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:22 AM: debug 0050
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:22 AM: debug IP address entered is 192.168.1.70 and the converted hex code is c0a80146
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:22 AM: debug sendCommand(Status:null)
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:22 AM: debug getStatus()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:22 AM: debug POLL
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:20 AM: debug parse()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:20 AM: debug 0050
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:20 AM: debug IP address entered is 192.168.1.70 and the converted hex code is c0a80146
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:20 AM: debug sendCommand(Power:Off)
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:20 AM: debug OFF
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:20 AM: debug parse()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:19 AM: debug parse()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:18 AM: debug 0050
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:18 AM: debug IP address entered is 192.168.1.70 and the converted hex code is c0a80146
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:18 AM: debug sendCommand(Status:null)
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:18 AM: debug getStatus()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:18 AM: debug POLL
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:18 AM: debug 0050
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:18 AM: debug IP address entered is 192.168.1.70 and the converted hex code is c0a80146
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:18 AM: debug sendCommand(Status:null)
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:18 AM: debug getStatus()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:18 AM: debug POLL
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:13 AM: debug parse()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:13 AM: debug 0050
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:13 AM: debug IP address entered is 192.168.1.70 and the converted hex code is c0a80146
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:13 AM: debug sendCommand(Power:On)
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:51:13 AM: debug ON
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:47 AM: debug parse()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:47 AM: debug 0050
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:47 AM: debug IP address entered is 192.168.1.70 and the converted hex code is c0a80146
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:47 AM: debug sendCommand(Status:null)
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:47 AM: debug getStatus()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:47 AM: debug REFRESH
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:46 AM: debug parse()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:45 AM: debug 0050
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:45 AM: debug IP address entered is 192.168.1.70 and the converted hex code is c0a80146
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:45 AM: debug sendCommand(Power:Toggle)
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:45 AM: debug TOGGLE
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:45 AM: debug PUSH
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:44 AM: debug parse()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:43 AM: debug 0050
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:43 AM: debug IP address entered is 192.168.1.70 and the converted hex code is c0a80146
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:43 AM: debug sendCommand(Status:null)
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:43 AM: debug getStatus()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:43 AM: debug REFRESH
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:41 AM: debug parse()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:41 AM: debug 0050
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:41 AM: debug IP address entered is 192.168.1.70 and the converted hex code is c0a80146
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:41 AM: debug sendCommand(Power:Toggle)
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:41 AM: debug TOGGLE
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:41 AM: debug PUSH
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:37 AM: debug parse()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:37 AM: debug 0050
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:37 AM: debug IP address entered is 192.168.1.70 and the converted hex code is c0a80146
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:37 AM: debug sendCommand(Status:null)
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:37 AM: debug getStatus()
1cabbb78-30bf-4178-86e3-64eb56e058ee 6:50:37 AM: debug REFRESH
I also pushed the toggle on and off and the refresh from the simulator with the same results
It looks like it's hitting the parse() method, which is good. This means that the device handler is getting the response from Tasmota which contains the JSON string of the current status of the device.
Actually, the latest code for the device handler, which was modified recently to support #1363 , does not have this debug line in it any longer.
You're running old code for the device handler.
Update your device handler code to the latest. https://github.com/BrettSheleski/SmartThingsPublic/blob/master/devicetypes/BrettSheleski/sonoff-tasmota.src/sonoff-tasmota.groovy
ok deleted device and device handler, replaced with the one you pointed me
to and created a new device .... the same thing is still happening....
could it be my bin file? What method do you use to flash your switches..
could you zip the folder you use and send it to me via www.wetrransfer.com.
. Thanks. There is something different going on if your Tasmota flashing
and Smartthings integration works as it should for you and not for me. I
will probably eventually move over to a Raspberry PI using Openhab but I
want to get it working here first.
On Thu, Jan 25, 2018 at 8:24 AM, Brett Sheleski notifications@github.com
wrote:
It looks like it's hitting the parse() method, which is good. This means
that the device handler is getting the response from Tasmota which contains
the JSON string of the current status of the device.Actually, the latest code for the device handler, which was modified
recently to support #1363
https://github.com/arendst/Sonoff-Tasmota/issues/1363 , does not have
this debug line in it any longer.You're running old code for the device handler.
Update your device handler code to the latest. https://github.com/
BrettSheleski/SmartThingsPublic/blob/master/devicetypes/BrettSheleski/
sonoff-tasmota.src/sonoff-tasmota.groovy—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/arendst/Sonoff-Tasmota/issues/656#issuecomment-360451827,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AhXPCCj1dtxpHRKtq_eBAIzDFVCGIombks5tOHJrgaJpZM4Om78a
.
anyone helps my? I brick 2 sonnof devices. every time when I try flashing its stock in "writing flash" state. everytime firmware it's more it's less stops when writing flash. anyone can help?
writing flash
.......................................................................................................................... read 0, requested 1
warning: espcomm_send_command: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed
warning: espcomm_send_command: wrong direction/command: 0x01 0x03, expected 0x01
0x04
closing bootloader
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
error: espcomm_upload_mem failed
Hello, I am having a similar problem to the other commenters with the status of the sonoff basic as reported in the SmartThings App. I am using Tasmota 5.11.1 and the latest device handler code. My installed configuration has GPIO14 set to "09 Switch 1" to work with a standard on/off light switch. In my case, sending the toggle command via the app will correctly turn the sonoff on and off and also show the correct status in the app. However, the status in the app will not update when using the physical on/off switch to toggle the sonoff. Using the refresh button in the app will correct the status, but it will not update automatically. Any ideas? Thx!
Hello everyone.... It gets weird now. After reading stringpark's post , I
changed my GPIO 14 to 09 switch 1 and saved. Using the Smartthings app to
control my switch, I now get a status change at each tap and the switch
responds. The only problem is that if I control the switch from the black
button i get no status change within the app, The only way to get the
correct status in the app is by hitting the refresh button in the app, just
as stringpark has stated. I went one step further and returned my GPIO 14
setting to 00 NONE which was the setting that was set with the Tasmota
flash. Remember that before the app was not changing its status no matter
where you controlled the switch from. Well now it is still only showing a
status change when controlled from the app. if controlled from the switch
the status will only change if you hit the refresh button.
Brett could you not add a refresh command to occur after each switch
command received or sent from the app, the black button and any GPIO
connected switch?.I still do not understand why all of a sudden the status
actually started to work in the app after I changed the setting of GPIO
On Sat, Jan 27, 2018 at 8:10 PM, stringpark notifications@github.com
wrote:
Hello, I am having a similar problem to the other commenters with the
status of the sonoff basic as reported in the SmartThings App. I am using
Tasmota 5.11.1 and the latest device handler code. My installed
configuration has GPIO14 set to "09 Switch 1" to work with a standard
on/off light switch. In my case, sending the toggle command via the app
will correctly turn the sonoff on and off and also show the correct status
in the app. However, the status in the app will not update when using the
physical on/off switch to toggle the sonoff. Using the refresh button in
the app will correct the status, but it will not update automatically. Any
ideas? Thx!—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/arendst/Sonoff-Tasmota/issues/656#issuecomment-361026671,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AhXPCHoFYCjNB_D7527hN0NCkWZBcdBKks5tO7sGgaJpZM4Om78a
.
Just for extra information, figured I'd mention that when using the device handler simulator, it appears that "poll" and "refresh" both produce the same result of correcting the status in the app. I'm not really educated on how this stuff works, but would the device handler code need to instruct the hub to "poll" the device every so often to get it's current status (in case it was changed locally via GPIO)? Maybe it already does that, I don't know.
same problem with the status of Sonoff being reported incorrectly as always on. Curiously, I have linked ST to google home, and when I ask google home, it correctly reports that the switch is off, all the while ST app shows a green "On" in front of it. Also, I have flashed Tasmota on some Lyasi wall switches (https://community.smartthings.com/t/lyasi-wifi-wall-switches-sonoff-plus-ewelink-cloud/97244) and added them with this device handler and have zero issues with status reporting in ST. Any ideas?
I noticed that hitting the web interface tends to slow down the switch until eventually it hangs, I think it runs low on system resources. Mine works ok if I disable MQTT (which I don't use anyway). Better is to remove it from the firmware on compile I guess.
Also I have noticed that pinging the sonoff on its IP addrrss results in two replies indicating a conflict on the network, though no conflict exists. Anyone else seen this? Mine work regardless but could be a clue.
I will check that ping scenario.... I also noted earlier that having the
MQTT enabled slows the response of the switch.
On Sun, Feb 4, 2018 at 12:39 PM, Andy Jenkinson notifications@github.com
wrote:
I noticed that hitting the web interface tends to slow down the switch
until eventually it hangs, I think it runs low on system resources. Mine
works ok if I disable MQTT (which I don't use anyway). Better is to remove
it from the firmware on compile I guess.Also I have noticed that pinging the sonoff on its IP addrrss results in
two replies indicating a conflict on the network, though no conflict
exists. Anyone else seen this? Mine work regardless but could be a clue.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/arendst/Sonoff-Tasmota/issues/656#issuecomment-362920506,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AhXPCNnVqQc_K5F7biFGQBQ6bicLZxZJks5tRd04gaJpZM4Om78a
.
Hey Brett (and all),
I have a Sonoff Touch (US) and I am trying to flash it with Tasmota. I am struggling with what needs to be done with the GPIO0 to get it into maintenance mode. I see some pictures where folks have soldered a wire to GPIO0, stating that it need to be grounded. Does that mean it needs to connect to the GND pin header I soldered on? Any help would be appreciated. I'm a bit of a newbie at this so please be specific. Thanks!
I just get GND from the programmer and hold it on GPIO0 until pluging the
cabel in USB port, then i relece the wire.
On Tue, Feb 6, 2018 at 5:08 PM ledfortr notifications@github.com wrote:
Hey Brett (and all),
I have a Sonoff Touch (US) and I am trying to flash it with Tasmota. I am
struggling with what needs to be done with the GPIO0 to get it into
maintenance mode. I see some pictures where folks have soldered a wire to
GPIO0, stating that it need to be grounded. Does that mean it needs to
connect to the GND pin header I soldered on? Any help would be appreciated.
I'm a bit of a newbie at this so please be specific. Thanks!—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/arendst/Sonoff-Tasmota/issues/656#issuecomment-363451069,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AXMUEzNybHm0LIZeI-z5_EiV0jo4nLX0ks5tSGsFgaJpZM4Om78a
.
Perfect! Thanks @enchoss
[image: 20180110_142540.jpg]
On Tue, Feb 6, 2018 at 5:23 PM ledfortr notifications@github.com wrote:
Perfect! Thanks @enchoss https://github.com/enchoss
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/arendst/Sonoff-Tasmota/issues/656#issuecomment-363455824,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AXMUEz9JZ8jLv4OHTHyXS4itI3QBE_nzks5tSG5ygaJpZM4Om78a
.
Can the Sonoff running Tasmota + Smarthings Hub using this handler be controlled locally when Internet goes down while you are in the same wifi network? without having to setup a pi running a server and Home Assistant ...
This is a SmartThings device handler. SmartThings needs the internet to function. No internet --> no SmartThings
However, you should still be able to control your Tasmota device by other means, just not by SmartThings without an internet connection.
hi all did anyone find out if the GPIO14 to GRND pin on a manual switch updates on the smart things app?
Due to limits of SmartThings, the SmartThings app will not update automatically.
I've done some work with a new set of SmartThings device handlers and a SmartThings SmartApp to go with it. The SmartApp exposes an http endpoint which can be called externally to trigger the devices to update. I've done some testing with Node-Red where Node-Red listens to the mqtt topic of the Sonoff device and calls the http endpoint of SmartApp and it works.
However I need to do some more testing and I seldom have the time.
Hi, great device handler!
Is it possible to make the smartthings app react when i turn off the b1 with power?
Like this scenario. The bulb is on(also in the app) But i decide to turn it off with a pshyical switch so it loose all connection, because it got no power. But in the app it still is on, is it possible to make a command or something to send to smartthings app when it loose connection?
I'm fully aware of the scenario you're talking about. This is mainly due to a limitation with the way SmartThings works.
I built a SmartApp which exposes an HTTP endpoint which can be used to trigger status updates in situations like you describe.
This can be used with something like Node-Red which could listen to MQTT traffic for your Tasmota device(s) and call the SmartApp endpoint.
This process is not fully tested yet and in a state of (very slow) development.
Thank you so much for that quick answer.
As i am a really amateur, i will try to read me up on the node-red And i will try this out!
Do the node-red need another device to run it all the time or is it only on the web?
I actually misread your initial question.
If the device is off, meaning there is no power going to the sonoff device at all, I don't know of a good way of handling that within SmartThings.
Obviously if you cut the power to the sonoff there is no way for it to send a message to SmartThings. So the only way to do this would be to constantly poll for the device from SmartThings and set the status off if not found (though it should really be set to disconnected).
Brett, I too am interested in local switches being pushed to SmartThings though. I really would prefer it to happen via a direct HTTP call from the device though. I will have to modify the firmware.
My use case is actually for the T1 devices, and those devices really do need to update the handler when the button is pressed. I would also like to configure one of the buttons to control a different SmartThings device instead (one of the lights in the room is a zigbee colour light) but that's just my own particular peculiarity.
Check out my SmartThings SmartApp (https://github.com/BrettSheleski/SmartThingsPublic/tree/master/smartapps/BrettSheleski/tasmota.src).
Currently the SmartApp works. However SmartThings requires going through OAuth to get a valid token (which needs to be passed in the HTTP headers) in order for requests to be made to the SmartApp.
If someone can get this working and provide instructions, feel free to make a pull request on my repo with the instructions in the markdown document (https://github.com/BrettSheleski/SmartThingsPublic/blob/master/smartapps/BrettSheleski/tasmota.src/readme.md).
I may create a simple HTML page which would do the OAuth handshake and obtain the info needed. From there one could make the calls however they like. One solution that I had working is create a flow in Node-Red to listen to MQTT traffic, and make HTTP calls to the SmartApp whenever .
I think it would be awesome if the Sonoff-Tasmota firmware were modified to call this directly. This would eliminate needing external tools (like Node-Red).
Hi, I'm really keen to get a few sonoff devices going with the latest firmware and smartthings, when I click on your link to the device handler I get a 404 error, do you have an updated link to the device handler code please?
I had to rename stuff in my GitHub repo (has to be lower case) for better SmartThings integration.
I updated the link on the wiki, where else also need be updated?
Does anyone know how to change the LED to be ON when the Relay is OFF?
Hi Brett, thanks for your work!
Can you explain what i have to add in preferences "Power channel" to view the actual Energy Consumption?
Or did i misunderstood this setting?
BTW: I use a Blitzwolf SHP2 and added "Case 45" to your code. Works great so far. Except it does not show the energy consumption.
"Power Channel" has nothing to do with monitoring energy consumption. It is used for devices that have several relays attached to it (like the 4CH) where each "Power Channel" corresponds each output.
Please submit a pull request for "case 45" and corresponding handler needed.
In order to get energy monitoring working "properly" one would need to create a new SmartThings child Device Handler and implement the energy monitor capability. Doing so will however would still require the Tasmota device to send telemetry to SmartThings, which currently requires the help of Node-Red.
Ah thanks for clarification. Don´t mind the energy monitoring yet ;)
I have created a pull request...
Links appear to be dead?
Many thanks, is this not the old one though. I was trying to find the version that feeds back "real" status.
The handler:
https
://github.com/BrettSheleski/SmartThingsPublic/blob/master/devicetypes/brettsheleski/tasmota.src/readme.md
https://github.com/BrettSheleski/SmartThingsPublic/blob/master/devicetypes/brettsheleski/tasmota.src/readme.md
And you will need the smartapp if you want status changes from the device
itself to be updated in smartthings:
Note this smartapp does work, but is not much use unless you have some
other workflow in place to integrate with it, such as an MQTT server and
nodered. So it adds quite a lot of complexity and more things to configure
and go wrong, and does require that you have to hand infrastructure you can
use for this and IMO a lot more technical knowledge than regular
smartthings device handler stuff.
On Mon, 17 Dec 2018, 17:30 davidjac <[email protected] wrote:
Many thanks, is this not the old one though. I was trying to find the
version that feeds back "real" status.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/arendst/Sonoff-Tasmota/issues/656#issuecomment-447929121,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABxn0n-8DUmLsIFFt8bLsD_1bm_q-P-Tks5u59StgaJpZM4Om78a
.
Great thanks and agree little too complicated.
Check out my SmartThings SmartApp (https://github.com/BrettSheleski/SmartThingsPublic/tree/master/smartapps/BrettSheleski/tasmota.src).
Currently the SmartApp works. However SmartThings requires going through OAuth to get a valid token (which needs to be passed in the HTTP headers) in order for requests to be made to the SmartApp.
If someone can get this working and provide instructions, feel free to make a pull request on my repo with the instructions in the markdown document (https://github.com/BrettSheleski/SmartThingsPublic/blob/master/smartapps/BrettSheleski/tasmota.src/readme.md).
I may create a simple HTML page which would do the OAuth handshake and obtain the info needed. From there one could make the calls however they like. One solution that I had working is create a flow in Node-Red to listen to MQTT traffic, and make HTTP calls to the SmartApp whenever .
I think it would be awesome if the Sonoff-Tasmota firmware were modified to call this directly. This would eliminate needing external tools (like Node-Red).
hey was this ever implemented? i'm interested in using tasmota rules to update smartthings via http.
thanks for everything you have done already getting this working.
I made a simple Node app for getting necessary OAuth info from SmartThings. See https://github.com/BrettSheleski/SmartThings-SmartApp-OAuth-Helper
However I haven't done anything with getting that working within Tasmota.
I made a Windows Service that takes Mqtt messages from Tasmota and send them to your devices through the newer rest api. My device handlers are based off Brett's good work above. If you're interested, I'll post it on my Github (the device handlers are already there).
I'm not sure which path to go. I dont have a home server set up with node red or mqtt. I was hoping to get a pi set up but the wife blocked that, lol. I do have an old laptop I could probably use.
I would like to see what you have Davin. Could you explain how to use it as well?
Ok, I've posted it all in GitHub.
Source code is here.
https://github.com/DavinKD/SmartThings/tree/master/SmartThings%20MQTT%20Bridge
Compiled zip is here.
https://github.com/DavinKD/SmartThings/blob/master/SmartThingsMQTT.zip
To install the service, download the zip and put the files in a folder. Then use InstallUtil.exe from the .net framework to install the .exe as a service. InstallUtil.exe should be in C:\Windows\Microsoft.NET\Framework\v4.0.30319>.
There are 2 .cfg files needed to be modified.
deviceList.cfg - One line per device in the format of MQTTTopic=SmartThingsDeviceId
SmartThingsMQTT.cfg - One line in the format of smartthingstoken=yourPersonalOauthToken
To get the SmartThings Device IDs go to the SmartThings IDE and go to the devices. When you click on one the URL will have a guid. That's the device ID.
For your personal oAuth token, see here.
https://account.smartthings.com/tokens
Now, for each device you will need to create a device in the SmartThings IDE. I have a few device handlers for different types of devices here.
https://github.com/DavinKD/SmartThings/tree/master/devicetypes/davindameron/tasmota-plug.src
https://github.com/DavinKD/SmartThings/tree/master/devicetypes/davindameron/tasmota-rgb-bulb.src
https://github.com/DavinKD/SmartThings/tree/master/devicetypes/davindameron/tasmota-rgbw-bulb.src
After adding them, go into the device in the SmartThings Classic Mobile app and click on settings. You'll need to enter the device's IP address and turn on "Use MQTT for Updates". For most, you'll also need to set the "Power Channel" which would typically be 1, but it depends on how many relays your Tasmota device has.
I wanted to add that this is very much a work in progress.
i don't have access to the smartthings classic. can i do this without that app? the app will not let me sign in. i think because i started on the new app first.
I have a mqtt broker setup now.
Edit: i found the settings in the smartthings ide. but in the "use mqtt for updates" line i typed "yes" but it doesn't seem to update power state on the smartthings app. what string do i need to enter there? I will try "1" and "true"
Edit2: looks like in the code for your handler it is looking for a "true" so i am using that.
now i have the smartthingsmqtt service running. When i use the smartthings app to cycle the light i get a network or server error. if the light is off and the app says its off, when i press the button it turns on, but the app hangs and stays in the off state then gives me the error.
only one device set up for now. i pulled the guid from the url of the device
devicelist.cfg
LivingRoomLamp=e0f8cdcf-834b-4e5c-84cb-24362c679bfe
In the folder where you are running the SmartThings Mqtt.exe,create a subfolder called logs. After that, the service should create a log. Post what you get in there.
Also double check you have the two cfg files setup correctly.
still not having any luck Davin. I created the folder, but it isn't generating logs. i can see the service running, and i can see it is running in the folder where i placed the logs folder.
i managed to get this https://github.com/stjohnjohnson/smartthings-mqtt-bridge to communicate with my mqtt server. i havent seen it post any messages to the smartthings yet. still working on it.
Did you try restarting my service after you added the logs folder?
yes
Thanks,
Cory
From: DavinKD notifications@github.com
Sent: Wednesday, March 27, 2019 10:38:52 PM
To: arendst/Sonoff-Tasmota
Cc: clsferguson; Comment
Subject: Re: [arendst/Sonoff-Tasmota] SmartThings device handler (#656)
Did you try restarting my service after you added the logs folder?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/arendst/Sonoff-Tasmota/issues/656#issuecomment-477445032, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AunKqUGpFrfiCgT2M4Be1wzA9cibwVbeks5vbEdcgaJpZM4Om78a.
Hmm, it should at least be logging the startup method assuming there is a logs subfolder under the folder where the. Exe resides. Tell me what folder you have it in and maybe I can hard code the logging for you temporarily.
exe's c:\save\smartthingsmqtt\
so the logs folder is c:\save\smartthingsmqtt\logs
I do have that other mqtt bridge working with two way communication. i just need to figure out how to get it to subscribe to additional topics from my mosquitto broker. i can control zwave devices with mqtt now
I found the issue with the logging, but I did create a .exe for you that has a hard coded log folder.
https://github.com/DavinKD/SmartThings/blob/master/SmartThingsMQTT.exe
11:14:40 PM : onStart(): In - c:\save\smartthingsmqtt
11:14:40 PM : ReadConfig(): Could not find a part of the path 'C:\SmartThingsMQTT\SmartThingsMQTT.cfg'.
11:14:40 PM : readDeviceList(): Could not find a part of the path 'C:\SmartThingsMQTT\deviceList.cfg'.
there's the problem
Ah, I see. It's looking in the wrong place for the config files. One sec.
Ok, I released a new .zip that fixes the log location and the config file location.
https://github.com/DavinKD/SmartThings/blob/master/SmartThingsMQTT.zip
still doesn't seem to update the device during status change on the app/or manually. it isn't outputting anything in the log either.
11:27:02 PM : onStart(): In - c:\save\smartthingsmqtt
Ok, we're getting there. I assume you configured mqtt on the tasmota device to the IP address of this Windows PC? Firewall is open for the MQTT port?
yep. i've been watching the mosquitto stream. windows firewall is disable on the machine.
If the device is sending MQTT messages to the Windows PC, you should see them in the log.
I"m not sure what you mean by Mosquitto, though. You should change the MQTT IP address directly in the tasmota device.
the smartthingsmqtt must not be seeing my broker then,
mosquitto is a mqtt broker
It wouldn't. It doesn't work that way. It simply listens for MQTT messages from the devices directly. I don't use a MQTT broker.
are you saying the smartthingsmqtt.exe is also a broker?
ooohhhh
Kind of. One way only.
SmartThings Device Handler --> Device http message
Device --> My MQTT Service -->SmartThings API
that did it. its working now.
Cool. Not sure it does what you need, but it works how I wanted it to. Everything updates in SmartThings real time. You can also use the device handlers without the MQTT service, but it won't be real time in SmartThings if you turn the devices on physically.
i'll give it a run. although it would be nice if it subscribed to a actual mqtt broker. this would be great for people who want to run tasmota on hassio and smartthings.
but for me, presently, i think this is exactly what i need. thanks a lot for the work.
actually it is picking up zwave messages from the smartthings bridge too.
Hey DavinKD, is there a way to get that running on a pi?
Hey DavinKD, is there a way to get that running on a pi?
yes. yes there is. quite simple too.
installed rasbian lite ran these commands.
sudo apt-get install mono-complete
sudo apt-get install mono-vbnc
sudo apt-get install libcanberra-gtk-module
now the problem I have it the directory to the config files are hard coded. so the pi can't find them. but otherwise the exe file will run and all my mqtt devices can communicate with it,
Hey DavinKD, is there a way to get that running on a pi?
yes. yes there is. quite simple too.
installed rasbian lite ran these commands.
sudo apt-get install mono-complete
sudo apt-get install mono-vbnc
sudo apt-get install libcanberra-gtk-modulenow the problem I have it the directory to the config files are hard coded. so the pi can't find them. but otherwise the exe file will run and all my mqtt devices can communicate with it,
Sorry I didn't see your earlier post. The .exe should be looking in the directory of the .exe for the config file. It was only hard coded in a very early version. If you want, I can upload a new .exe to github.
Yes please. lol. I have the exe running, but it doesnt seem to find the cfg files. It isn't communicating with smartthings.
Edit: all the mqtt stuff is working though
Thanks,
Cory
From: DavinKD notifications@github.com
Sent: Monday, September 30, 2019 9:37:39 AM
To: arendst/Sonoff-Tasmota Sonoff-Tasmota@noreply.github.com
Cc: clsferguson Corpo_@hotmail.com; Comment comment@noreply.github.com
Subject: Re: [arendst/Sonoff-Tasmota] SmartThings device handler (#656)
Hey DavinKD, is there a way to get that running on a pi?
yes. yes there is. quite simple too.
installed rasbian lite ran these commands.
sudo apt-get install mono-complete
sudo apt-get install mono-vbnc
sudo apt-get install libcanberra-gtk-module
now the problem I have it the directory to the config files are hard coded. so the pi can't find them. but otherwise the exe file will run and all my mqtt devices can communicate with it,
Sorry I didn't see your earlier post. The .exe should be looking in the directory of the .exe for the config file. It was only hard coded in a very early version. If you want, I can upload a new .exe to github.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/arendst/Sonoff-Tasmota/issues/656?email_source=notifications&email_token=ALU4VKIR5YCQKQ6KUS4M6WLQMIMMHA5CNFSM4DU3X4NKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD76CWVY#issuecomment-536619863, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALU4VKLRAJW2E6UMDDA67F3QMIMMHANCNFSM4DU3X4NA.
Does it work with sonoff pow2? That is, can it read voltage etc from that device?