<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\HomeAssistantAPI;

class HomeAssistantAPIController extends Controller
{
    // Connessione RestAPI di HomeAssistant

    public function getContatore()
    {
        $kwh = HomeAssistantAPI::getSensorState('sensor.contatore_casa');
        return $kwh->state;
    }

    public function getStatoPompa()
    {
        $statoPompa = HomeAssistantAPI::getSensorState('switch.pompa_pozzo');
         return $statoPompa->state;
        //dd($statoPompa);
    }
}
