App-OpenHAP

 view release on metacpan or  search on metacpan

bin/openhapd  view on Meta::CPAN

	password => $mqtt_pass,
);

# Try to connect to MQTT with a timeout
if ( $mqtt->mqtt_connect(5) ) {
	$log->info( 'Connected to MQTT broker at %s:%d',
		$mqtt_host, $mqtt_port );
	$hap->set_mqtt_client($mqtt);
}
else {
	$log->warning('MQTT broker not available, will retry in background');
	$hap->set_mqtt_client($mqtt);    # Set it anyway for reconnection
}

# Load the devices from the configuration
my $loader = App::OpenHAP::Devices->new();
$loader->load_devices( $config, $hap, $mqtt );

# Bump c# if the accessory database changed since the last run
$hap->update_config_number();

man/openhap/openhapd.8  view on Meta::CPAN

.Pp
These are some of the log messages:
.Bl -tag -width "Not pairedXX"
.It Dq Starting OpenHAP server
The daemon started correctly and now listens for connections.
.It Dq Not paired - use Home app with PIN: XXX-XX-XXX
The accessory is not paired with a HomeKit controller.
Use the PIN from the message to pair through the iOS Home app.
.It Dq Connected to MQTT broker at host:port
The daemon connected to the MQTT broker.
.It Dq MQTT broker not available, will retry in background
The daemon did not connect to the MQTT broker at startup.
.Nm
continues to try to connect in the background.
.It Dq Paired with controller: identifier
The pairing with a new HomeKit controller was successful.
.It Dq Secure session established
The daemon started an encrypted session with a paired controller.
.El
.Pp
A configuration file that does not parse is a fatal error.
.Nm
writes the file, the line number, and the reason to
.Em stderr ,

man/openhap/openhapd.8  view on Meta::CPAN

.Sh CAVEATS
For correct operation,
.Nm
needs an MQTT broker, for example,
.Xr mosquitto 8 ,
and
.Xr mdnsd 8 .
Both must run.
If one of them is not available, the daemon starts and does what it
can.
The daemon tries the MQTT connection again in the background.
The mDNS discovery is not available until you restart the daemon.
.Pp
At the first startup, if the accessory is not paired, the daemon
writes the HAP PIN code to the log.
Thus, limit the access to the system logs.
.Pp
The pairing data in
.Pa /var/db/openhapd/
holds cryptographic keys.
The owner of the directory must be



( run in 6.424 seconds using v1.01-cache-2.11-cpan-0fb53d1c279 )