Hi folks, I’m fairly new to HA (couple of months now) and in the last couple of weeks I’ve installed HACS (using various Youtube contributors) so I can use Sonoff Minis and avoid firmware flashing. HACS installed successfully and it picked up my single Sonoff Mini which I can switch via the HA “Overview” page.
When I try to kick off an automation however I find that whilst I have an entity for the Sonoff, I don’t seem to have a device listed for it. This seems to mean I can’t use the UI to create another automation for it. Also, my other devices appear in the overview by “Area”, the Sonoff Mini appears under “Switch” - ideally I’d like it to be listed under the area I’ve set for it, i.e. “Outside”. I’m still using the default layout for the Overview, I haven’t (yet?) ventured into editing the Lovelace dashboard.
I tried to create an automation “long hand” using YAML but on inspection of the automations created by the UI, I seem to need a device identity and not having a corresponding device for my Sonoff entity, I suspect I won’t be able to without this identity.
I certainly don’t mind editing the YAML (retired software engineer…) but I think my newbie status and a lack of understanding somewhere (on my part) is causing me these problems. Do all HACS added items (e.g. Sonoff Minis) have to have their automations created and maintained via the YAML?
Have I done something wrong, or do I need more information? Please help, I’m getting bored with having to switch my outside lights (connected to the Sonoff) by hand every night.
Hi there…Just FYI HACS is just the custom component store just like google store or apple store. If you are able to use the sonoff mini without flashing you mostly would be using the custom component SonoffLAN https://github.com/AlexxIT/SonoffLAN#tested-devices .
Now with the lack of device, Its totally normal not to have a device for each entity. Instead you can create automations or scripts or do anything with just entity_id through calling services. And this can be done in UI also. For eg: in your case. There must be an entity for the sonoff mini which would be represented by an entity_id, something like switch.<some_name>. This entity id can be used in conjunction with various services. Since our entity is of type switch we can use the services switch.turn_on to turn on and switch.turn_off to turn off. You can test these in the services tab in the developer console.
Now with automations. In the automation UI, if you want to switch on the light we can to select the action type call service and then in the service tab select “switch.turn-on”. In the entities tab select the entity_id of the switch. In case of turning off, change service to switch.turn_off
First, HACS doesn’t do anything to allow you to use a Sonoff.
HACS is the custom integration in HA that allows you to easily install and update other custom integrations and plugins.
Unless there is another (unfortunately named) HACS integration for Sonoffs that I’m not aware of?
Second, you don’t need a device to use the UI to create automations.
If you have an entity then you just use a service call type action instead of a device type action.
I assume that your Sonoff is brought in to HA as a switch so select “call service” then select the service as “switch.turn_on” or “switch.turn_off” as desired.
and if you create automations manually then you will never use device triggers/actions so you will never use all of that extra extraneous info provided by the device. Device triggers/actions aren’t meant to be programmed manually.
Very many thanks. Needed the prompt for the “Call Service” thing and I had’t realised the “Developer Tools” bit allows a quick test. You’ve been very helpful and a life saver!
My other reply to sheminasalam applies similarly to you. Thanks for (in both cases) the clear and simple answer. Certainly the thing works at the moment but the real proof of the pudding is when my four new automations trigger! Thank you both. Mark B.