What prgogram lang I will use?

Hi there all,
I’m obviously new at the HA… this cause I arrive from another platform and I want to try
this wonderful HA
I just install the Hassbian and I already make work my first SonOff POW

Now I want to make the first automation, so I want to ask witch language to use.
I don’k know python and I don’t know yaml… so I must learn from the beginning anyway.

So what I must do in the first time is:

  • when the SonOff POW register more than 20W consume
    I must begin to count the minutes in a variable1
    and if the consume is < 20W must stop count

  • the variable 2 must have e number of minutes in base of day ow week
    (example monday 180 mins, saturday 300 mins… etc)

  • when the variable1 > variable2
    must send a message some minutes before to an android phone (or TTS)
    and then shut down the SonOff POW

So can be this make it using yaml ? or is too complex and is better to try it
via python ?

Thanks all
Denis

Personally, I found using yaml frustrating because it felt like a dead end. I was not likely to use the knowledge I gained from it anywhere else.

Whereas Python is a very popular language used commercially all over the world.

The Python scripts in HA are rather limited. If you really want to learn Python, you really need to install Appdaemon.

1 Like

What do you mean please ?
Can I make a program like in my post using python ?

Appdaemon or Python component ?

Witch is the diference please ?

Thanks a lot
Denis

@denisj,

What you wanting to do is quite simple, and a simple .yaml file will do it for you.

I am in the process of learning AppDaemon myself, for as noted by @gpbenton python is just almost industry standard.

But I will suggest instead of going steep down into core python for now, just use a simple automation script and you are up and running in no time. That’s part of the beauty of HASS.

From what you wrote, for your first point I will use the Mqtt sensor, Counter.

As for having the minutes of base of day, I will personally use a custom component Variables, which will allow for storing things that way.

Lastly use something like the Telegram component to send info.

Regards

1 Like

The biggest restriction on Python scripts is that you cannon use import to include any other libraries. Some are included by default, but only what the developers have decided is safe. There are some other restrictions, that may have been lifted since I tried it.

Appdaemon is a separate Python program and you can use all the facilities available to Python programs.

You probably can do what you want to do with the Python Scripts module, but it would be difficult using it to learn Python, because of the restrictions.

1 Like

Ok … I’ll think about and decide
Thanks again

Thanks a lot for your help
Do you know if all this can stay in only one file ?

Thanks again

@denisj,

Yes it can, on the configuration.yaml file

Regards

I think I’ll go in the python direction… maybe I’ll learn a lang
that can be useful in the future :slight_smile:

I see yaml too difficult… I don’t know way.

Denis