Reset all devices each time when starting in demo mode

This commit is contained in:
Adrian Jagielak 2025-07-27 02:09:51 +02:00
parent aa9cb0f12a
commit b6be226ac2
No known key found for this signature in database
GPG Key ID: 0818CF7AF6C62BFB
2 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,7 @@
## 0.1.7 (26.07.2025) ## 0.1.7 (26.07.2025)
- Added setting for enabling debug log. - Added setting for enabling debug log.
- Reset all devices each time when starting in demo mode.
## 0.1.6 (26.07.2025) ## 0.1.6 (26.07.2025)

View File

@ -92,6 +92,12 @@ import { delay } from './utils';
`^homeassistant/device/futurehome_${hubId}_([a-zA-Z0-9]+)/config$`, `^homeassistant/device/futurehome_${hubId}_([a-zA-Z0-9]+)/config$`,
); );
for (const haDevice of haConfig) { for (const haDevice of haConfig) {
if (demoMode) {
log.debug('Resetting all devices for demo mode');
ha?.publish(haDevice.topic, '', { retain: true, qos: 2 });
continue;
}
log.debug('Found existing HA device', haDevice.topic); log.debug('Found existing HA device', haDevice.topic);
const match = haDevice.topic.match(regex); const match = haDevice.topic.match(regex);