CJNE / pymyenergi

An async python library for interfacing with MyEnergi devices
MIT License
19 stars 14 forks source link

app_email/password requested in CLI even if not using libbi #38

Open carlosgalvezp opened 2 months ago

carlosgalvezp commented 2 months ago

Hi!

I'm using the CLI to control my zappi. My understanding is that app_email and app_password are only required for libbi, but still I get prompted for them when using zappi.

I am not able to set dummy values for these, since I get an authentication failure. Is it possible to skip them somehow?

G6EJD commented 2 months ago

You should be using the MyEnergi hub serial for username and the API key for password. But you can’t call the ME servers asynchronously as their security method is session based, then you can log-on once and control all of their products.

carlosgalvezp commented 2 months ago

Yes, I am using hub serial and API key. But still the CLI still asks me to type app_email and app_password, which I don't want to pass. Pressing Enter is not an option, since I want it to run without user interaction in a cron tab.

carlosgalvezp commented 2 months ago

Running the CLI like this solves the problem as a workaround:

echo | myenergi zappi ...

This simulates pressing Enter when prompted for app_email.

trizmark commented 2 months ago

I just added a "--skip-oauth" flag to the cli in PR #43 Once that's merged, you can call the cli with that flag and you won't be prompted for app email/password.

carlosgalvezp commented 2 months ago

Awesome, thanks a lot!

trizmark commented 1 month ago

@carlosgalvezp 0.2.0 has been released today and now you can use the --skip-oauth flag!

carlosgalvezp commented 1 month ago

Awesome, just tried it and works like a charm, thank you!

Btw, I realize that password is also required when running myenergi --version, which sounds unnecessary. Perhaps it should behave just like --help?

trizmark commented 1 month ago

Ah, good catch, but to be fair --version asks for the hub serial number as well if you don't have it in the config. I'll prepare a small PR for this.