Hi,
I'm begginer at Python and Enigma 2 programming so I ask You about forbearance.
I try to write a sctipt which will detect (I hope) if DM is in standby mode.
At the moment I' m on autorun stage.
My code looks like below:
ZitatAlles anzeigenclass Lampki:
def __init__(self):
self.session = session
bb = pylibftdi.BitBangDevice()
while True:
""" wile I want to add if condition which will chcect isStandby
global wariable and will change bitbang mode. At the moment the
code it so chceck if autorun works properly"""
bb.port = 0b00000001
time.sleep(1)
bb.port = 0b00000010
time.sleep(1)
def autostart(reason, **kwargs):
# aa = Lampki ()
if reason == 0 and kwargs.has_key("session"):
session = kwargs["session"]
session.open(Lampki)
def main(session, **kwargs):
print "\n[MyMenu] start\n"
session.open(MyMenu)
###########################################################################
def Plugins(**kwargs):
list = [
PluginDescriptor(
name="Standby Energy Saver",
description="Manage Your Power Distribution Unit to save energy",
where = PluginDescriptor.WHERE_AUTOSTART,
fnc = autostart),
PluginDescriptor(
name="Standby Energy Saver",
where = PluginDescriptor.WHERE_PLUGINMENU,
icon="standysaver.png",
fnc=main)]
return list
The problem is that:
- if I un# line aa = Lampki () during rebooting enigma hungs up (simple BitBang device works porperly),
- if I # aa = .... line and un# f reason == 0 and kwargs.has_key("session"): and it' s body enigma reboots properly but device don't work.
Can someone help me. As I wrote I'm begginer.
P.S. The ideal state is if Lampki class behaves as daemon or detects standby switch event but I don't know how to do this (so maybe at the beginning infinitive while loop idea is anough).