Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Allow plugins ability to augment the html displays?
#11
OK, I got your example plugin working. Looks good!
It took a bit of doing to clone your SIP updates:
Code:
git clone https://github.com/jonathan-marsh/SIP.git

and then manually install the plugin files.

By the way, there was a recent pull request that added some changes to the sip_service.sh script in the SIP folder. It sets up a Python virtual environment  and modifies the sip.service to run sip.py using the Python interpreter from the venv. This allows plugins to install dependencies without errors.

I added some code to your diurnal_display.py plugin file:

Code:
try:
    from suncalc import get_times
except ModuleNotFoundError:
    command = "pip install suncalc"
    subprocess.call(command.split())
    from suncalc import get_times


This also requires adding "import subprocess" to the standard library imports.
With this code your plugin installs the required suncalc module on the first run without any user action.

To get this to work you will need to disable any existing system_d sip service:
Code:
systemctl disable sip
and then run the script from the SIP folder:
Code:
bash sip_service.sh
then reboot.
<p><br></p>
Reply
#12
Awesome thanks, I've added that code to my version.

So, If you'd like I think the best way is to create two pull requests:
- SIP with the new capabilities and the updated proto plugin.
- sip_plugins adding diurnal_display and updating the proto plugin to match that in SIP.

If that isn't optimal let me know and I'll follow your lead!

-Jonathan
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)