Show reconnection on startup.

This commit is contained in:
Dermot Duffy
2022-06-23 21:09:28 -07:00
parent fff6d7ecad
commit 15ece97408
+12 -8
View File
@@ -1104,9 +1104,12 @@ export class FrigateCard extends LitElement {
const oldHass = changedProps.get('_hass') as HomeAssistant | undefined; const oldHass = changedProps.get('_hass') as HomeAssistant | undefined;
let shouldUpdate = !oldHass || changedProps.size != 1; let shouldUpdate = !oldHass || changedProps.size != 1;
if (oldHass) { // If this is the first HA state and it is disconnected, or there's been a
const selectedCamera = this._getSelectedCameraConfig(); // change in connection state, then show the reconnection message.
if (oldHass.connected !== !!this._hass?.connected) { if (
(!oldHass && !this._hass?.connected) ||
(!!oldHass && oldHass.connected !== !!this._hass?.connected)
) {
if (!this._hass?.connected) { if (!this._hass?.connected) {
this._setMessageAndUpdate( this._setMessageAndUpdate(
{ {
@@ -1120,11 +1123,12 @@ export class FrigateCard extends LitElement {
} else { } else {
this._changeView(); this._changeView();
} }
shouldUpdate = true; return true;
} else if ( }
this._getConfig().view.scan.enabled &&
this._updateTriggeredCameras(oldHass) if (oldHass) {
) { const selectedCamera = this._getSelectedCameraConfig();
if (this._getConfig().view.scan.enabled && this._updateTriggeredCameras(oldHass)) {
shouldUpdate = true; shouldUpdate = true;
} else if ( } else if (
// Home Assistant pumps a lot of updates through. Re-rendering the card is // Home Assistant pumps a lot of updates through. Re-rendering the card is