Skip to content

Commit

Permalink
Merge pull request #252 from jakowenko/beta
Browse files Browse the repository at this point in the history
v1.13.1
  • Loading branch information
jakowenko authored Oct 27, 2022
2 parents 41b7a98 + b353068 commit ae80f7c
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 12 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.13.1-beta.1](https://github.com/jakowenko/double-take/compare/v1.13.0...v1.13.1-beta.1) (2022-10-27)


### Bug Fixes

* **mqtt:** only retain state and configuration, not events. ([#249](https://github.com/jakowenko/double-take/issues/249)) ([d5de0ee](https://github.com/jakowenko/double-take/commit/d5de0ee8fb60229aa1cf0d4ad974e72009afbff7))

## [1.13.0](https://github.com/jakowenko/double-take/compare/v1.12.1...v1.13.0) (2022-10-21)


Expand Down
4 changes: 2 additions & 2 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "double-take-api",
"version": "1.13.0",
"version": "1.13.1-beta.1",
"description": "Unified UI and API for processing and training images for facial recognition",
"scripts": {
"start": "node server.js",
Expand Down
17 changes: 14 additions & 3 deletions api/src/util/mqtt.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module.exports.connect = () => {
};

module.exports.available = async (state) => {
if (CLIENT) this.publish({ topic: 'double-take/available', message: state });
if (CLIENT) this.publish({ topic: 'double-take/available', retain: true, message: state });
};

module.exports.subscribe = () => {
Expand Down Expand Up @@ -196,18 +196,21 @@ module.exports.recognize = (data) => {

messages.push({
topic: `${MQTT.TOPICS.CAMERAS}/${camera}/person`,
retain: true,
message: counts.person.toString(),
});

if (unknowns.length) {
messages.push({
topic: `${MQTT.TOPICS.MATCHES}/unknown`,
retain: false,
message: JSON.stringify(payload.unknown),
});

if (MQTT.TOPICS.HOMEASSISTANT) {
messages.push({
topic: `${MQTT.TOPICS.HOMEASSISTANT}/sensor/double-take/unknown/config`,
retain: true,
message: JSON.stringify({
name: 'double_take_unknown',
icon: 'mdi:account',
Expand All @@ -221,6 +224,7 @@ module.exports.recognize = (data) => {

messages.push({
topic: `${MQTT.TOPICS.HOMEASSISTANT}/sensor/double-take/unknown/state`,
retain: true,
message: JSON.stringify(payload.unknown),
});
}
Expand All @@ -232,6 +236,7 @@ module.exports.recognize = (data) => {

messages.push({
topic: `${MQTT.TOPICS.MATCHES}/${topic}`,
retain: false,
message: JSON.stringify({
...payload.match,
match,
Expand All @@ -241,6 +246,7 @@ module.exports.recognize = (data) => {
if (MQTT.TOPICS.HOMEASSISTANT) {
messages.push({
topic: `${MQTT.TOPICS.HOMEASSISTANT}/sensor/double-take/${topic}/config`,
retain: true,
message: JSON.stringify({
name: `double_take_${name}`,
icon: 'mdi:account',
Expand All @@ -254,6 +260,7 @@ module.exports.recognize = (data) => {

messages.push({
topic: `${MQTT.TOPICS.HOMEASSISTANT}/sensor/double-take/${topic}/state`,
retain: true,
message: JSON.stringify({
...payload.match,
match,
Expand All @@ -265,12 +272,14 @@ module.exports.recognize = (data) => {
if (matches.length || misses.length || unknowns.length) {
messages.push({
topic: `${MQTT.TOPICS.CAMERAS}/${camera}`,
retain: false,
message: JSON.stringify(payload.camera),
});

if (MQTT.TOPICS.HOMEASSISTANT) {
messages.push({
topic: `${MQTT.TOPICS.HOMEASSISTANT}/sensor/double-take/${camera}/config`,
retain: true,
message: JSON.stringify({
name: `double_take_${camera}`,
icon: 'mdi:camera',
Expand All @@ -284,6 +293,7 @@ module.exports.recognize = (data) => {

messages.push({
topic: `${MQTT.TOPICS.HOMEASSISTANT}/sensor/double-take/${camera}/state`,
retain: true,
message: JSON.stringify(payload.camera),
});
}
Expand All @@ -293,10 +303,11 @@ module.exports.recognize = (data) => {

clearTimeout(PERSON_RESET_TIMEOUT[camera]);
PERSON_RESET_TIMEOUT[camera] = setTimeout(() => {
this.publish({ topic: `${MQTT.TOPICS.CAMERAS}/${camera}/person`, message: '0' });
this.publish({ topic: `${MQTT.TOPICS.CAMERAS}/${camera}/person`, retain: true, message: '0' });
if (MQTT.TOPICS.HOMEASSISTANT) {
this.publish({
topic: `${MQTT.TOPICS.HOMEASSISTANT}/sensor/double-take/${camera}/state`,
retain: true,
message: JSON.stringify(payload.cameraReset),
});
}
Expand All @@ -315,7 +326,7 @@ module.exports.publish = (data) => {
if (!single && !multiple) console.error('MQTT: publish error');

const messages = single ? [{ ...data }] : data;
messages.forEach((message) => CLIENT.publish(message.topic, message.message, { retain: true }));
messages.forEach((message) => CLIENT.publish(message.topic, message.message, { retain: message.retain === true }));
};

module.exports.status = () => ({
Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "double-take-frontend",
"version": "1.13.0",
"version": "1.13.1-beta.1",
"description": "Unified UI and API for processing and training images for facial recognition",
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "double-take",
"version": "1.13.0",
"version": "1.13.1-beta.1",
"description": "Unified UI and API for processing and training images for facial recognition",
"scripts": {
"prepare": "husky install",
Expand Down

0 comments on commit ae80f7c

Please sign in to comment.