Ejemplo n.º 1
0
def recordatorioTomar(e, intentMessage):
    global Snips
    if (e.user == Snips.usr):
        if (e.veces < 6):
            Reminder(e)
            mqttClient.publish_start_session_action(
                site_id=intentMessage,
                session_init_text=e.user + '¿ te has tomado ' + e.med + '?',
                session_init_intent_filter=[
                    "caguilary:Confirmar", "caguilary:Negar"
                ],
                session_init_can_be_enqueued=False,
                session_init_send_intent_not_recognized=True,
                custom_data=None)
            msg = ""
            print(e.user + '¿te has tomado ' + e.med + '?:Vez ' + str(e.veces))
            Snips.Incrementar(e)
            e.IncrementarVeces()
            mqttClient.publish_end_session(intentMessage, msg)
        else:
            msg = e.user + 'ha ignorado el evento tomar ' + e.med
            say(intentMessage, msg)
            Snips.scheduler1.remove_job('recordando tomar ' + e.med + ' a ' +
                                        e.user)
            if (not e.rep):
                Snips.FinishEvent(e)
            else:
                Snips.NingunaVeces(e)
            mqttClient.publish_end_session(intentMessage, msg)
    else:
        print("Usuario actual distinto al del evento")
        Snips.scheduler1.remove_job('recordando tomar ' + e.med + ' a ' +
                                    e.user)
Ejemplo n.º 2
0
def action_wrapper_Confirmar(hermes, intentMessage, conf):
    global Snips
    #msg="Evento aceptado por "+e.user
    msg = "Evento aceptado"
    AceptedReminder('Voz')
    event = lastEventReminder()
    if (event):
        if (Snips.eventActive(event)):
            if (not event.rep):
                Snips.FinishEvent(event)
            else:
                Snips.NingunaVez(event)

        job = 'recordando tomar ' + event.med + ' a ' + event.user
        if (exist_Job(job)):
            Snips.scheduler1.remove_job('recordando tomar ' + event.med +
                                        ' a ' + event.user)
            hermes.publish_end_session(intentMessage.session_id, msg)
Ejemplo n.º 3
0
    def run(self):
        while True:
            state = GPIO.input(self.BUTTON)
            if state:
                global Snips
                #msg="Evento aceptado por "+e.user
                msg = "Evento aceptado"
                AceptedReminder('Botón')
                event = lastEventReminder()
                if (event):
                    if (Snips.eventActive(event)):
                        if (not event.rep):
                            Snips.FinishEvent(event)
                        else:
                            Snips.NingunaVez(event)

                job = 'recordando tomar ' + event.med + ' a ' + event.user
                if (self.exist_Job(job)):
                    Snips.scheduler1.remove_job(job)
                    say('default', msg)

            time.sleep(1)