39 lines
955 B
Plaintext
39 lines
955 B
Plaintext
def ugasni_levo()
|
|
tasmota.set_power(0, false)
|
|
end
|
|
|
|
def ugasni_desno()
|
|
tasmota.set_power(1, false)
|
|
end
|
|
|
|
# payload = kako dolgo naj bo vklopljen, v milisekundah
|
|
def pojdi_levo(cmd, idx, payload, payload_json)
|
|
print("payload!")
|
|
print(payload)
|
|
tasmota.set_power(0, true)
|
|
tasmota.set_timer(int(payload), ugasni_levo)
|
|
end
|
|
|
|
# payload = kako dolgo naj bo vklopljen, v milisekundah
|
|
def pojdi_desno(cmd, idx, payload, payload_json)
|
|
tasmota.set_power(1, true)
|
|
tasmota.set_timer(int(payload), ugasni_desno)
|
|
end
|
|
|
|
def ugasni_vse()
|
|
ugasni_levo()
|
|
ugasni_desno()
|
|
end
|
|
|
|
# payload = kako dolgo naj bo vklopljen, v milisekundah
|
|
def pojdi_ravno(cmd, idx, payload, payload_json)
|
|
tasmota.set_power(0, true)
|
|
tasmota.set_power(1, true)
|
|
tasmota.set_timer(int(payload), ugasni_vse)
|
|
end
|
|
|
|
tasmota.add_cmd('PojdiLevo', pojdi_levo)
|
|
tasmota.add_cmd('PojdiDesno', pojdi_desno)
|
|
tasmota.add_cmd('PojdiRavno', pojdi_ravno)
|
|
tasmota.add_cmd('UgasniVse', ugasni_vse)
|