Ejemplo n.º 1
0
def finish():
    # get one last pull from homeassistant
    from frontend.util import collect_data_from_hass
    collect_data_from_hass()

    # deassociate dataset
    srv = get_server()
    ds = srv.dataset
    srv.dataset = None
    srv.save()

    # wrap up dataset
    ds.logging = False
    ds.end_time = get_current_time()
    ds.save()

    # dissacosiate person statistics from persons
    for person in Person.objects.all():
        person.person_statistic = None
        person.save()

    # copy stuff activity files persons to dataset folder
    copy_actfiles2dataset(ds)

    stop_updater_service()
Ejemplo n.º 2
0
    def generate_analysis_for_exp(self, request):
        name = request.POST.get("dataset_name", "")
        ds = Dataset.objects.get(name=name)

        copy_actfiles2dataset(ds)
        collect_data_from_hass()
        collect_dataset_statistics(ds)

        set_placeholder_images(ds)
        start_plot_gen_service(ds)
Ejemplo n.º 3
0
    def generate_analysis(self, request):
        name = request.POST.get("dataset_name", "")
        ds = Dataset.objects.get(name=name)

        srv = get_server()
        if srv.dataset is not None and srv.dataset.id == ds.id:
            copy_actfiles2dataset(ds)
            collect_data_from_hass()
        collect_dataset_statistics(ds)
        set_placeholder_images(ds)
        start_plot_gen_service(ds)
Ejemplo n.º 4
0
    def export_data(self, request):
        name = request.POST.get("dataset_name", "")
        ds = Dataset.objects.get(name=name)
        srv = get_server()

        try:
            if ds.id == srv.dataset.id:
                copy_actfiles2dataset(ds)
                collect_data_from_hass()
        except AttributeError:
            pass

        return ds.get_fileResponse()
Ejemplo n.º 5
0
 def get(self, request):
     srv = get_server()
     srv.webhook_count += 1
     srv.save()
     if not srv.hass_comp_installed:
         self.enable_hass_comp()
         resp = {'state':'success'}
     elif experiment.get_status() == "running":
         collect_data_from_hass()
         resp = {'state':''}
     else:
         resp = {}
     return JsonResponse(resp)
Ejemplo n.º 6
0
def debug(request):
    from frontend.util import collect_data_from_hass
    collect_data_from_hass()
Ejemplo n.º 7
0
 def generate_analysis_for_exp(self, request):
     name = request.POST.get("dataset_name", "")
     ds = Dataset.objects.get(name=name)
     copy_actfiles2dataset(ds)
     collect_data_from_hass()
     generate_device_analysis(ds)