pyenergenie icon indicating copy to clipboard operation
pyenergenie copied to clipboard

Command line shell interface

Open whaleygeek opened this issue 8 years ago • 3 comments

#31 hints at what I think is a command line user interface (i.e. an "energenie shell") that can be called in from other scripts. e.g. the ability to write a simple bash script with energenie commands in it.

Things I'd like to see:

A simple command to turn a device on or off (I have a pull request that does this but it's more a copy&paste than a good example of code re-use. I won't be offended if you don't use it.) A simple command to tell if a device is on or off. (As long as the device supports this, of course.) I like the idea of these simple commands because they can then be composed into bigger scripts. For instance, I like the idea of giving friendly names to devices, so I could call:

turn_on downstairslight

Something would then map the 'downstairslight' to device ID 0x123 and call the appropriate code to turn on device ID 0x123.

This mapping of names to device IDs needn't be part of the pynergenie code - it could be separate as long as there were simple commands for it to call to do the actual device switching.

whaleygeek avatar May 13 '16 07:05 whaleygeek

This is partly implemented in the setup_tool.py that I am working on on the device_classes branch at the moment (to aid with the testing of all the device_classes work). It's menu driven, but it's not far off what a command line 'energenie_shell' might look like.

whaleygeek avatar May 28 '16 17:05 whaleygeek

There is some work done on this over on this fork/pull request, that might influence our thinking on a command line interface:

https://github.com/whaleygeek/pyenergenie/pull/25

I run the command simply as:
sudo python switch.py --name 0xABC --action on

(Where 'name' is the device ID in hex and 'action' is either 'on' or 'off'.)

whaleygeek avatar May 28 '16 18:05 whaleygeek

Also #114 and #113 would provide a way to do this outside of the process

whaleygeek avatar May 05 '19 21:05 whaleygeek