The cloud is a definite no-no.
Since Home assistant chews up sd-cards and screw up your home automation, you better keep it all local and make loads of backups.
I think the only hiccup to local sonoffs is the difficulty to add google assistant (ignoring the fact that flashing is intimidating at first) without paying for HA cloud.
For lot of us beginners, home automation begins with adding smart switches/lights to google assistant and hence routines.
So this lets us benefit from the potential of HA automations & algorithms while making it still easy for the wifey to use Google assistant
Having devices on the local network only they still keep updating the states / writing the db. This component it’s just a matter of preference and usability (just 3 lines in configuration.yaml and you get your devices up and running).
Alternatively one can easily create a ram disk and write the sqlite database there => no increased sd card writes, with periodical backups (an easy script to be done) but out of the scope of this thread.
Hello, @peterbuga, ¡Great job! I have some devices connected to ewelink and I want to use them with home assistant. I have a staadard home assistant installation under Raspbian strech. I have followed your steps at github, moved py files to custom_components dir, created the entrance in configuration.yaml, restarted home assisitant without errors but i can´t find a sonoff basic that I have linked to ewlink. Where is it? Do I have to do anything more? Thanks for your help!
Could you please send some error details from logger/dev-info tab of your HA
Thanks
here’s some debug ideas for starters:
add (temporarily) to your configuration.yaml
logger:
default: warning
logs:
custom_components.sonoff: debug
custom_components.switch.sonoff: debug
and it should spit out at least some info about what is happening there regarding this component if you watch closely the boot logs of HA
the switches should show up by default in your dashboard (depends on your config) or search for it in the Developer Tools > States entities list
ps: always use the latest version of the component - master branch (just pushed some improvements … i hope) last night
Hey while debugging myself early on it seems like
homeasistant.components.switch.sonoff
doesn’t work
You have to add:
custom_components.switch.sonoff
right i’ll edit to reflect the change
Great @peterbuga. They were in the states section. I works fine!!! Can I change the name of it for a friendly one in customize? Another question, I have a 2ch geekcreit device linked. It should work too?
Awesome, glad that it works ;)!
You can easily customize your entities either from built-in customize menu or from customize.yaml
(which is pretty much the same thing).
Or, if by “customize”, you mean the name of the entity itself to be “switch.kitchen” for example, I’m still debating for this case. It has come to my attention that the names that don’t contain valid ascii characters (ex: chinese characters) don’t play nice with entities and i have to default back to device id instead, leaving everything a small mess.
Keep an eye on the project (I don’t have an ETA yet) I’m re-writing the component to rely completely on the websocket for all the to&from updates, it’ll be much faster, probably less cpu intensive and the changes will reflect almost instantly in HA.
I’m unfamiliar with this device but if you can control it eWeLink app it should definitely work. If it’s not working please follow the guidelines for adding a new device mentioned in the 1st post.
Hyped for this.
Working pretty amazing with what the websocket branch has so far.
Also I think your decision to stick with deviceid makes sense.
That way the automations and homekit integration is not affected.
It has two switches but I see only one switch in HA. I will connect it and check what happens
If you can integrate your project directly in home assistant core in future releases it would be great!
@peterbuga I have tried to use sonoff-debug.py in a raspberry getting this message:
Traceback (most recent call last):
File “sonoff-debug.py”, line 87, in
devices_json = get_devices()
File “sonoff-debug.py”, line 69, in get_devices
headers.update({‘Authorization’ : 'Bearer ’ + user_details[‘at’]})
KeyError: ‘at’
Do you know what it means?
@jgyoldi most likely you provided wrong user and/or password double check!
this is just a debug script, i didn’t spent too much time on it catching all the errors
@peterbuga Finally I got it working and I have a device.json file with the information of the following device:
https://www.ebay.es/itm/Geekcreit-2-Channel-AC-85V-250V-APP-Remote-Control-WIFI-Wireless-Switch-Socket-F-/162844446103
It appears at HA with your project as one single switch but it doesn´t work. How can I send you the devices.json containing it?
Regards.
You can post contents of the file here or on GitHub as an issue.
He made sure all sensitive data is already removed.
Still feel free to go through the contents once
Thanks
Have been using the websocket branch with the changes in the pull request for about a day now.
Must I say it’s insanely fast!!
Like blows my mind every time it updates and changes state.
Running Hassio,
Assuming I did this properly maybe?
local/custom_components/sonoff
sonoff.py & .getmore files
and : local/custom_components/sonoff
sonoff.py
the added to the main config.yaml
sonoff:
username: !secret sonoff_username
password: !secret sonoff_password
scan_interval: 60
grace_period: 600
api_region: 'eu'
getting a error : Component not found: sonoff
I must be missing something, any suggestions anyody?