Hello folks,
I’m on my way to write a component for Asus GPIO (you might see my several discussion), then I need to retrieve the pin assignment information in order to be able to prepare their states during HA boot.
So I thought that there’s a dictionary or json equivalent where the configuration.yaml is converted, please give some code to get the idea…
I can manage for my own setting, but I’d rather want to share my efforts to other tinker board owners.
#EDIT
I’m trying
$ python -q
>>> from homeassistant.core import HomeAssistant
>>> hass = HomeAssistant()
>>> from pprint import pprint as pp
>>> pp(hass.states.entity_ids('switch'))
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/homeassistant/core.py", line 803, in entity_ids
return future.result() # type: ignore
File "/usr/lib/python3.7/concurrent/futures/_base.py", line 427, in result
self._condition.wait(timeout)
File "/usr/lib/python3.7/threading.py", line 296, in wait
waiter.acquire()
KeyboardInterrupt
>>>
With such way I had to interrupt because it’s not responding any longer to the shell.
I can’t help you with that code snippet, because I don’t think that is how HA works.
However, are you aware that there is a whole website dedicated to developing extension for HA? It has detailed information and step-by-step examples on how to create a new integration:
I read a part of it. Digging deeper I could identify the most part of interest. So I’ll keep reading through the following chapters/link.
@nickrout
Thank you (both) very much for your guidance. Perhaps I’m more used to learn by examples. Then I’d take some part of them to rearrange on my way.
Deeper analysis
Perhaps, like nickrout guessed, I’ll find the object hass inside the component I’m trying to get working (imitating the rpi_gpio). But for little step testing I’d rather try to call the python shell and move my course tests from within that. So how I import hass ?
I tried as above shown, but it is not responding.
Definitely I’m not a programmer, I’m just trying my way to solve some problem, which might lead to something inelegant.