ReneTode / My-AppDaemon

My apps, my helpfiles, all about AppDaemon for Home Assistant
113 stars 50 forks source link

Clarify interaction between appdaemon and HASSIO #17

Closed danielo515 closed 4 years ago

danielo515 commented 5 years ago

Hello, Thanks for taking the time to put this into written form. There is one small detail I still don't understand. It's about this last part:

That's it. We made an app and we let AppDaemon use it. So go on! Make an input boolean in HA and let it put 1 of your lights on, but only if your mobile is home.

Does that mean that I have to create an input boolean in HA or that our app will behave automatically like that? If we need to do something in HA I think it will be very helpful to have that little extra information also explained on the same article. It assumes a good knowledge about how appDaemon interacts with HA and it may not be the case for most beginners.

Thanks!!

ReneTode commented 5 years ago

hi @danielo515

yes it does mean that you have to create an input_boolean in HA, just as it says.

i did write this tutorial assuming that people know what to do in HA. its an AD tutorial not an HA tutorial. if people dont know how to work with HA, they will not be able to work with AD at all.

the interaction between HA and AD is not really relevant. so you dont need to worry about that.

danielo515 commented 5 years ago

the interaction between HA and AD is not really relevant. so you dont need to worry about that.

Well, it is for me 😅 I know how to properly create items and even write automations on HA. And now thanks to your tutorial I have a brief idea of ow appdaemon works. However, what I'm missing is the ability to connect both. How should I reference appdaemon classes from HA? How can I call them with params? Those, to me key, questions remain unanswered, and I was hoping to get some guidance here.

Thanks.

ReneTode commented 5 years ago

How should I reference appdaemon classes from HA?

you cant

How can I call them with params?

you cant

you have certain expectations, that are not there. the tutorial shows you how you can see values from home assistant in appdaemon, and it shows you how you can do stuff inside home assistant with appdaemon commands.

it works the other way around as you think. you do stuff in AD that effects HA, not the other way around.

thats why you need to create an input_boolean (as trigger) in my tutorial.

and i think that its your view of things that is standing in your way. something most beginners dont have a problem with, thats why so many have stated that my tutorial is so helpfull (and even translated it to chinese)

i am happy to talk about it and help you understand things more. you can reach us at any time on our discord channel:

https://discord.gg/pHsjADY

danielo515 commented 4 years ago

Sure, I'll reach you there because albeit I think your tutorial is awesome, I think there are some parts that are not clear for everyone. Notice that appdaemon seems to be a completely independent thing from HA, but when you install it as a HA plugin you don't expect/understand that separation. The only part that was not clear for me on the tutorial is how HA and AD interact with each other. Sure you cover some of that on your tutorial but I think it is not clear why it needs to be that way or if there is any other way. Probably that should be clarified on AD main page or HA main page, but the thing is that nobody wants to take that responsibility, and for sure it is not yours. Thank you for your help so far.

it works the other way around as you think. you do stuff in AD that effects HA, not the other way around.

Well, if you read stuff from HA and act accordingly, I think some level of interaction is happening. I guess that's why you need an input boolean on the first place 😃

and i think that its your view of things that is standing in your way. something most beginners dont have a problem with,

Yes, I never said the opposite, I was 100% aware that it was my own problem.

thats why so many have stated that my tutorial is so helpfull (and even translated it to chinese)

And I also consider it very helpful. Sorry if my issue made it look any other way.

ReneTode commented 4 years ago

The only part that was not clear for me on the tutorial is how HA and AD interact with each other my tutotial is written so that people with little to no experience in programming have a starting point. and i tried to leave out all complicated parts. sure i can start explaining that HA has an API and that AD connects to HA using websocket. and then i could start to try to explain the HA event bus and the AD event bus. but then i would only confuse people and it is not needed information to work with it. it like that you dont need to know how TV signals are send to your TV, if you just want to watch it.

i tried to explain what is needed to start to write the most basic apps. after that people should find their way to the AD docs, and discord.

should it be in the AD docs? i think in some small way it is somewhere mentioned in the docs. but because AD is way more then just an extention from HA nowadays, that explenation is going to dissapear more and more. should it be in the HA docs? it is. in the development docs there is a section that tells about HA api and how to connect to it. but like i said. its not needed information.

all you need to know is that if you create an input boolean, that you can listen to it in AD. same with any state change or event that you generate in HA.

i do understand where you are coming from. my wife also always wants to know how things work in the background. but in most cases it confuses more then it clears things.

and to be true, i dont even know the details about how things work on the background (and i am an AD dev ;) )

the only important interaction for me is self.listen_state(self.do_stuff, "input_boolean.mine", new= "on") which makes that when i switch the boolean to on the function do_stuff is called.

danielo515 commented 4 years ago

all you need to know is that if you create an input boolean, that you can listen to it in AD. same with any state change or event that you generate in HA.

This sentence made it click. Thank you very much for your time and patience