I have a Hassbian installation on a Pi and is bit confused concerning the place to put the files. I have no “config” folder and have created the “custom_components” folder myself just below the .homeassistant folder.
It seems that the sonoff component loads ok bug I get errors trying to load sensor and switch Components. I am running 0.88.1
Any help?
The .homeassistant directory is the right place.
@peterbuga I’m wondering if you considered using MQTT as an abstraction layer between Sonoff devices and HA? As a point of reference, Tasmota supports MQTT (see: https://github.com/arendst/Sonoff-Tasmota/wiki/MQTT-Overview). Personally I gave up on using HASS and instead I made a few home automation scripts based on MQTT (and currently I use a very simplified version of your code with websockets). I’m sure support for MQTT would be also appreciated by openhab and domoticz communities.
Peter, want to thank you for this. I already had several Sonoffs installed before discovering HA and did not want to pull them all out to flash. This works perfectly for me. I have TH16 showing as a switch and sensors, several basic, two 3Ts and two off brand dimmers that were e-Welink compatable. They work too, only they show as a switch and I have no dimming capability.
Great work and thanks again!
@Contraption_Maker would you be willing to provide some debug data related to the dimmers so i can integrate them also? someone else “complained” about this missing feature but never follow up
i’m sure you have your own reasons to give up on HA but the way i see it in order to have kind of MQTT will mean to run some sort of standalone server to do all this tasks and take care of all the publlish/subscribe states.
also i’m not totally a fan of MQTT, does a great job but it’s a lot of manual configuration which i usually try to avoid and this is why this component was born in the first place
would you be kind enough to share the scripts you have running so far so i can get an idea how are trying to bring MQTT into this picture? (i work better if i see real life examples and this way maybe we can meet halfway) ps: i have literally no idea how it works/never touched openhab/domoticz software so far, HA does and outstanding job
ya, would be glad to contribute something, just tell me what you need.
If your interested, I have a video of my Lovelace and Floorplan setup here: Share your Floorplan
I’d just like to say your component has been working great, thanks! One thing I’d like that ask though, is it possible to shorten the scan interval some how? I have a basic switch that’s triggered by a Sonoff RF Bridge, and I can’t seem to get the scan interval any lower than 5 seconds or so and have it pick up the state change of my switch. Any lower than that and it doesn’t seem to update the state of the switch at all. If I set it to 5 seconds, I still end up with an 8-10 second delay between my switch being triggered, and HA picking up the event. If I could somehow get it down to even 2 or 3 seconds it would be perfect for what I need!
websocket
branch does exactly what you need with instant changes/updates, but i’ve been lazy to move into master
ps: websocket
branch it’s not optimized for HA 0.88+ (yet)
I’m on 0.88.1, will the websocket branch work on this version? I tried installing it, and it seems my sonoff entities aren’t being found now for some reason.
EDIT: Nevermind, it seems the ID’s just changed from “Switch.Sonoff_(ID Number)” to “Switch.(ID Number)”.
I think some changes in API, but i see here some users where it work…ok… any logic explanation.
thanks for the great work
is it possible to change the entity_id of the sonoff ?
to change switch.sonoff_100057d3b9 to switch.bedroom_plug for exemple
right now, no. i could probably add an optional switch to use the name for a device instead its ID, but i find it safer to have unique entity names, who knows what weird setups people might have where the names start overlapping and cause problems.
if you it makes it easier to edit your automations, you could convert/copy your entities and use the prettier names https://www.home-assistant.io/components/switch.template/#copy-switch
great idea, thanks !
Could you help us with tips on how we should fixs our certificates…we are clueless…
only if i knew myself too unfortunately ssl related problems are never my strong suit.
if you’re not very technical the best approach would be to start from scratch and (re)install HA in container/virtual env etc as there are many options available
Apologies for the late reply!
I like HASS in principle (and I prefer it over other home automation systems) but I encountered multiple issues with it. I figured I can either overcome them (and keep overcoming new problems with every consecutive update) or I can just make my own tiny system
Configuring and using MQTT is super easy and quick (at least if you stick with mosquitto as a broker and paho as a Python client). I have the broker (server) on my Raspberry PI, so the automation scripts connect with it locally. I’m new to MQTT myself and so far I only used this plugin: https://github.com/cflurin/xiaomi-mqtt and my own Sonoff integration for T2 switches (based on your plugin, but way more primitive). So far I really like it.
At this stage my automation scripts using MQTT were made in just two nights so they are messy, but maybe at least they’ll help to illustrate how this protocol may be actually used. Other scripts I’m using are not yet ported to MQTT (but I plan on doing it):
-
https://gist.github.com/quarxpl/9c25ee8a45e9d00a6145562090cfac51 -> this is a script to control my Sonoff devices (based on your code, but it is less flexible)
-
https://gist.github.com/quarxpl/1927156503f0b5e9e3e978e1706647d0 -> this is a tiny script that turns on and off lights in my bathroom using a motion sensor and a door sensor. It works quite well even in this simple form.
Most of my HA scripts are systemd services and they are started at boot and restart automatically if there is a crash.
Hi. @peterbuga Can you advice how to create fan speed toggle for iFan02 in homeassistant. Right now from the 4 switch entity only 2 works, 1 for light, and other one toggle speed to 3. The rest do not work. Can you share the code used for this on home assistant.