Compare commits

...

3 commits

7 changed files with 32 additions and 12 deletions

4
Cargo.lock generated
View file

@ -1155,7 +1155,7 @@ dependencies = [
[[package]]
name = "homekit-controller"
version = "0.5.5"
version = "0.6.2"
dependencies = [
"chacha20poly1305",
"ed25519-dalek",
@ -1178,7 +1178,7 @@ dependencies = [
[[package]]
name = "homekit-exporter"
version = "0.6.1"
version = "0.6.2"
dependencies = [
"chrono",
"clap",

View file

@ -1,6 +1,6 @@
[package]
name = "homekit-controller"
version = "0.5.5"
version = "0.6.2"
edition = "2021"
license = "Apache-2.0"
description = "Partial implementation of the HomeKit controller protocol"

View file

@ -311,15 +311,17 @@ impl DeviceConnection {
self.characteristics_request(true),
)
.await
.map_err(|_| HomekitError::Timeout)
.flatten_result()
{
Ok(r) => r,
Err(_) => {
Ok(r) => Ok(r),
Err(e) => {
log::warn!(
"{}failed to update characteristics",
"{}failed to update characteristics: {e:?}",
formatted_name(&self.name)
);
self.socket = None;
Err(HomekitError::Timeout)
Err(e)
}
}
}
@ -432,6 +434,24 @@ pub enum HomekitError {
NoData,
}
trait FlattenResult {
type T;
type E;
fn flatten_result(self) -> Result<Self::T, Self::E>;
}
impl<T, E> FlattenResult for Result<Result<T, E>, E> {
type T = T;
type E = E;
fn flatten_result(self) -> Result<Self::T, Self::E> {
match self {
Ok(v) => v,
Err(e) => Err(e),
}
}
}
#[derive(Debug, Error)]
pub enum ConnectionError {
#[error("http")]

View file

@ -686,7 +686,7 @@ impl From<CharacteristicTypeInner> for CharacteristicType {
fn from(value: CharacteristicTypeInner) -> Self {
match value {
CharacteristicTypeInner::Unknown(v) => {
log::info!("unknown characteristic type: {v}");
log::debug!("unknown characteristic type: {v}");
Self::Unknown
}
CharacteristicTypeInner::AccessControlLevel => Self::AccessControlLevel,
@ -1206,7 +1206,7 @@ impl From<ServiceTypeInner> for ServiceType {
fn from(value: ServiceTypeInner) -> Self {
match value {
ServiceTypeInner::Unknown(v) => {
log::info!("unknown service type: {v}");
log::debug!("unknown service type: {v}");
Self::Unknown
}
ServiceTypeInner::AccessControl => Self::AccessControl,

View file

@ -1,6 +1,6 @@
[package]
name = "homekit-exporter"
version = "0.6.1"
version = "0.6.2"
edition = "2021"
license = "Apache-2.0"
description = "Prometheus exporter for HomeKit sensors"

View file

@ -1,7 +1,7 @@
# Maintainer: Alex Janka <alex@alexjanka.com>
pkgname=homekit-logger
pkgver=0.6.1
pkgver=0.6.2
pkgrel=1
pkgdesc="Prometheus exporter for HomeKit sensors"
arch=('x86_64' 'aarch64')

View file

@ -7,7 +7,7 @@ StartLimitIntervalSec=0
Type=simple
Restart=always
RestartSec=10s
Environment="RUST_LOG=error,warn,mdns=off,homekit_controller::pairing_data::characteristics=off"
Environment="RUST_LOG=warn,mdns=off"
Environment="LOG_TIMESTAMP=false"
ExecStart=/usr/bin/homekit-exporter watch