I’m pretty new to HA (only just over a week) but my smart home is made up of very cheap plugs and bulbs… I love HA and the ability to expose these cheap devices to Alexa but it was missing one thing… and hopefully this will fill that gap.
It will allow you to turn on, off and query the status of any Sonoff device running ESPEasy.
Any feedback would be welcome.
Note : This component is a modification of the Kankun smart plug component.
I would appreciate the feedback if you wouldn’t mind… i appreciate people use MQTT but it’s not something i currently run (although i’m increasingly thinking i may be missing a trick by not using it)
I’ve updated the github to include one for tasmota aswell as espeasy… the only thing i’m not sure on is the state.
If HA can’t see the state, could you issue this http command to one of your switches and paste me the output?
trying to to test with my S20 but i have an error:
this is my config
- platform: sonoff_tasmota
switches:
bedroom:
host: sonoff.lan
username: admin
password: 12345
name: Kodi TV
Update for switch.kodi_tv fails
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 199, in async_update_ha_state
yield from self.async_device_update()
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 306, in async_device_update
yield from self.hass.async_add_job(self.update)
File "/usr/local/lib/python3.6/asyncio/futures.py", line 331, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
future.result()
File "/usr/local/lib/python3.6/asyncio/futures.py", line 244, in result
raise self._exception
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/switch/sonoff_tasmota.py", line 102, in update
self._state = self._query_state()
File "/home/homeassistant/.homeassistant/custom_components/switch/sonoff_tasmota.py", line 81, in _query_state
return req.json()['state'] == "On"
File "/srv/homeassistant/lib/python3.6/site-packages/requests/models.py", line 892, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Interested in following this having literally just gotten into these wonderful things, thanks for sharing.
I went Tasmota and MQTT and have to confess I’m not seeing any immediate advantage with a component like this but as I said I’m still very new to it. MQTT is probably the simplest bit of the setup once it suddenly dawns on you what’s going on and it works instantaneously so no obvious advantage in talking directly other than removing the ‘what’s all this then’ part for total newbs.
Obviously the golden goose egg would be a component that directly controls a factory fresh Sonoff which I have read is possible but a long, long way from simple.
I still see a benefit on not being depended on another piece of software ‘mosquitto’ to control my sonoff
I like running just Home-Assistant to control all my devices.
I do know what you mean and would usually agree but you seem to be overlooking the fact MQTT is a tried and tested built in component like all the other components your using already, your not adding anything and you’ll never see it unless you want to. To be fair you are if you use the hass.io add-on version but that is kind of the point, you’re putting it into its own secure environment, independent of HA and it’ll keep running until you stop it or pull the plug, not restart every time you tweak your config and restart HA.
I’m not taking anything away from @danmed’s hard work, just need to find the usp for my own use.