1. Definition:
Services means services, or we say the task is easy to understand.
Hass is a center for managing devices, so the device is a major component in Hass. The device can be a light, a switch or a sensor … We say the representative is a switch layer. You know, the switch is important to turn it on and off. For Hass, turning on as a service and turning off is also a service. Other classes such as lights (light), there are other services such as set mode to select the mode for example. And classes like sensor (sensor), because not only need to bring data continuously up but not perform anything at all so there is no service. So, did you understand the concept of Service?
2. How to search for Services:
Read here, you will raise the question, “How do I know what services each class has?”. Read on to find the answer.
Yep, it’s the services button in Hass’s Developer Tools.
If you try it, you will see something like this:
If you select the Service menu, you will see a list. For example, if we need to see which switches the Services have, just scroll down to the switch. Then we saw three rows is switch.turn_off , switch.turn_on and switch.toogle . You can see that Service is declared in the form of classname.service. This is because when declaring a Service, we also need to tell Hass which class it belongs to.
3. Distinction:
For those of you exposed to Hass for the first time you may see a mistake between entity_id like switch.light1 and service like switch.turn_on . It’s easy to confuse because it’s like structure, it’s all switch But how do we use it correctly? When you declare the item entity_id: then you must declare switch.the name also declared in service: it must be switch.service