hubitat2prom/Controllers/HubitatController.cs
/// <summary>
/// Get the current status of the Hubitat hub and data about the exporter.
/// </summary>
/// <returns>
/// A valid response looks something like this:
/// <example>
/// {
///     "status": {
///         "CONNECTION": "ONLINE"
///     },
///     "config": {
///         "HE_URI": "http://192.168.50.22/apps/api/712/devices",
///          "HE_TOKEN": "00000000-0000-0000-0000-000000000000",
///          "HE_METRICS": [
///              "battery",
///              "humidity",
///              "level",
///              "switch",
///              ...
///          ]
///     }
/// }
/// </example>
/// </returns>
Get the current status of the Hubitat hub and data about the exporter.
Get the current status of the Hubitat hub and data about the exporter .
[HttpGet]
    [Route("/info")]
    public async Task<ExporterInfo> GetInfo()
    {
        var statusCode = await _hubitat.StatusCheck();
        return new ExporterInfo
        {
            status = new ExporterInfoStatus
            {
                CONNECTION = statusCode == HttpStatusCode.OK
                    ? "ONLINE"
                    : "OFFLINE"
            },
            config = HubitatEnv.Instance
            with
            {
                HE_TOKEN = Guid.Empty
            }
        };
    }
[ HttpGet ] [ Route ( " " ) ] public async Task < ExporterInfo > GetInfo ( ) { var statusCode = await _hubitat . StatusCheck ( ) ; return new ExporterInfo { status = new ExporterInfoStatus { CONNECTION = statusCode == HttpStatusCode . OK ? " " : " " } , config = HubitatEnv . Instance with { HE_TOKEN = Guid . Empty } } ; }
Get the current status of the Hubitat hub and data about the exporter.
Get the current status of the Hubitat hub and data about the exporter .
A valid response looks something like this.


A valid response looks something like this .