Activate multiple relays in evok api
-
Hello,
I'm trying to activate a few relays on one push button connected to digital input.
but for a moment to flick on and the last one stays on.
If I try with just one relay it works fine.here is my code
I placed it in the evok.pycallback generators for devents
def gener_status_cb(mainloop, modbus_context):
def status_cb_modbus(device, *kwargs):
modbus_context.status_callback(device)
if registered_ws.has_key("all"):
map(lambda x: x.on_event(device), registered_ws['all'])
passdef status_cb(device, *kwargs): if device.devtype == 1: print(device.bitvalue) # On DI Create Reaction # e.g. Toggle Relay if device.bitvalue == 1: for x in range(1,5): time.sleep(1) dr = Devices.by_name('relay',str(x)) time.sleep(1) dr.set(value=1) time.sleep(1) if registered_ws.has_key("all"): map(lambda x: x.on_event(device), registered_ws['all']) pass if modbus_context: return status_cb_modbus return status_cbi cannot figure it out
thx
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login