Added cameras menu: one can get image from camera

This commit is contained in:
ftc
2023-09-28 21:47:24 +03:00
parent 2e03e8b747
commit 42482730f5
3 changed files with 127 additions and 1 deletions
+8 -1
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
@@ -10,11 +11,17 @@ namespace ZaoBot.OpenHab
class OpenHabClient
{
private string url;
private string token;
HttpClient http = new HttpClient();
public OpenHabClient(string url)
public OpenHabClient(string url, string token = "")
{
this.url = url;
this.token = token;
if (!string.IsNullOrEmpty(token))
{
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", token + ":");
}
}
public async Task<ItemState> GetItemState(string item)