I’m unable to find any information on the difference between a hub and a platform. Can someone please point me in the right direction and/or give an explanation that someone who is new to HA will be able to understand.
My goal is to integrate my Python Code that I have written for a Paradox Alarm, using a PRT-3 home automation module, by following the existing alarm platform examples.
Why I am asking is that the Verisure example seem to implement a hub and my alarm would also have control over my lights and electric gate. (Done so as it is more likely to be available than my Pi where I will be tinkering.)
I’m still not sure what the difference is, but it seems that when something lives directly in the components directory even if a similar type of component already exists, it is referred to as a hub, i.e. components/envisalink.py
Whereas if something lives in the component directory that represents it, i.e. components/alarm_control_panel/mqtt.py, it is referred to as a platform.
Alternatively, the level in the yaml file, i.e.
# a hub example
envisalink:
hubitem1:
param1:
hubitem2:
param1:
# a platform example
alarm_control_panel:
platform: mqtt
param1:`indent preformatted text by 4 spaces`
In simple words a component contains the foundation (creating connection, setup devices, and alike) which platforms can used without doing the same for themself. Components can also be independent part.
The term “Hub” is used to to group components which have platforms.
Most of the documentation is still Greek to me and seems to have just a little less information than my current level of experience require. The documentation is good but there are just too many gaps in my understanding as everything (Github, Python, HA, serial comms, etc) is new to me. So it is very slow going as I prefer to first understand what I’m doing and why before doing it.
Is there any conventional wisdom for when to go for the hub approach vs just indepenent components? I asked this over on this thread
Based on some of the components I’ve looked at, it makes sense to start with a component as a platform when it’s only one platform. As an example, the recent fitbit component is a sensor. When there’s multiple components for one device, that’s the point where it’d be good to have a hub that then sets up the other components. Ecobee and Nest are examples of this, where they instantiate thermostats and sensors.
Yes, it can be tricky. For example if an alarm is able to control lights and garage doors. I’m assuming it may be a hub even though it is just an alarm where certain relays on the alarm may control other things.
In my case I won’t necessarily expose my lights via the alarm to HA as HA will be able to get hold of the lights and states via the light server/platform. In this case the alarm just acts as a home automation server in it’s own right.
The garage door is different as it does not have it’s own “server” interface. This I would think needs to be part of the Paradox (alarm) hub where only that pgm/relay and zone/door status is exposed as a garage door component to HA so it can control and report on it directly.