Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple "read" neoplug status #6

Open
JohnRaynor opened this issue Mar 9, 2019 · 2 comments
Open

Simple "read" neoplug status #6

JohnRaynor opened this issue Mar 9, 2019 · 2 comments

Comments

@JohnRaynor
Copy link

JohnRaynor commented Mar 9, 2019

I know this is a pretty elementary question, but I really struggle understanding "async" programming.
What do I do to just read status of a Neoplug device ("Greenhouse") from a calling program?
I have my program switching the neoplug on and off fine, I just cant work out the syntax to read the status.

Sorry to waste your time with a fairly simple question.

@mibarkway
Copy link

Did you get anywhere with this..? I have just done a similar thing, starting with a similar level of python knowledge... My solution is very hacky, but I do now have some code that does what I need.

Basically, I started with the "neo-cli" library, popped in my hub's IP and port numbers, and hard coded it to run the "list" command, which came out with a beautiful list of all my zones, with temps, so good start.

Then I knife-and-forked the code a bit to take out the functions I wasn't using and change things round a bit so the one command I use became an (async) function call, that was mostly fine, with lots of small changes and re-runs...

Then I added a wrapper function which is done with a regular 'def'. This calls all the async stuff and contains the 'loop', an instance of the neo class and the 'run_until_complete' thing which spits out the usable output which is returned into the normal python world.

If you want it to run multiple times, then cut out the loop.close bit, or it wont run again, otherwise you should end up with a callable function that works like regular code gives you some useful info about your neo system...

Hope that helps..!

Michael

@alexreid42
Copy link

alexreid42 commented Nov 19, 2022

I encountered the same issue, my inelegant solution is attached. .177 is the address of the Neohub, rename the two txt files to .py.

image

Alex

extract.txt
master.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants