mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 10:16:46 +00:00
Merge pull request #6222 from home-assistant/dev
This commit is contained in:
commit
65d587843b
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="home-assistant-frontend",
|
||||
version="20200623.2",
|
||||
version="20200623.3",
|
||||
description="The Home Assistant frontend",
|
||||
url="https://github.com/home-assistant/home-assistant-polymer",
|
||||
author="The Home Assistant Authors",
|
||||
|
@ -14,20 +14,20 @@ export const getViewEntities = (
|
||||
view.attributes.entity_id.forEach((entityId) => {
|
||||
const entity = entities[entityId];
|
||||
|
||||
if (entity && !entity.attributes.hidden) {
|
||||
viewEntities[entity.entity_id] = entity;
|
||||
if (!entity) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (computeDomain(entity.entity_id) === "group") {
|
||||
const groupEntities = getGroupEntities(entities, entity as GroupEntity);
|
||||
viewEntities[entity.entity_id] = entity;
|
||||
|
||||
Object.keys(groupEntities).forEach((grEntityId) => {
|
||||
const grEntity = groupEntities[grEntityId];
|
||||
if (computeDomain(entity.entity_id) === "group") {
|
||||
const groupEntities = getGroupEntities(entities, entity as GroupEntity);
|
||||
|
||||
if (!grEntity.attributes.hidden) {
|
||||
viewEntities[grEntityId] = grEntity;
|
||||
}
|
||||
});
|
||||
}
|
||||
Object.keys(groupEntities).forEach((grEntityId) => {
|
||||
const grEntity = groupEntities[grEntityId];
|
||||
|
||||
viewEntities[grEntityId] = grEntity;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -114,6 +114,7 @@ export const provideHass = (
|
||||
);
|
||||
|
||||
const localLanguage = getLocalLanguage();
|
||||
const noop = () => undefined;
|
||||
|
||||
const hassObj: MockHomeAssistant = {
|
||||
// Home Assistant properties
|
||||
@ -123,8 +124,8 @@ export const provideHass = (
|
||||
},
|
||||
} as any,
|
||||
connection: {
|
||||
addEventListener: () => undefined,
|
||||
removeEventListener: () => undefined,
|
||||
addEventListener: noop,
|
||||
removeEventListener: noop,
|
||||
sendMessage: (msg) => {
|
||||
const callback = wsCommands[msg.type];
|
||||
|
||||
@ -168,6 +169,8 @@ export const provideHass = (
|
||||
);
|
||||
};
|
||||
},
|
||||
suspendReconnectUntil: noop,
|
||||
suspend: noop,
|
||||
socket: {
|
||||
readyState: WebSocket.OPEN,
|
||||
},
|
||||
|
@ -78,7 +78,7 @@ export class HomeAssistantAppEl extends HassElement {
|
||||
|
||||
document.addEventListener(
|
||||
"visibilitychange",
|
||||
() => this.__handleVisibilityChange(),
|
||||
() => this._handleVisibilityChange(),
|
||||
false
|
||||
);
|
||||
}
|
||||
@ -148,7 +148,7 @@ export class HomeAssistantAppEl extends HassElement {
|
||||
: route.path.substr(1, dividerPos - 1);
|
||||
}
|
||||
|
||||
private __handleVisibilityChange() {
|
||||
protected _handleVisibilityChange() {
|
||||
if (document.hidden) {
|
||||
// If the document is hidden, we will prevent reconnects until we are visible again
|
||||
this.hass!.connection.suspendReconnectUntil(
|
||||
|
@ -487,7 +487,6 @@ class HaConfigZwave extends LocalizeMixin(EventsMixin(PolymerElement)) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
!ent.attributes.hidden &&
|
||||
"node_id" in ent.attributes &&
|
||||
ent.attributes.node_id === nodeid &&
|
||||
!ent.entity_id.match("zwave[.]")
|
||||
|
@ -60,6 +60,7 @@ const HIDE_DOMAIN = new Set([
|
||||
"device_tracker",
|
||||
"geo_location",
|
||||
"persistent_notification",
|
||||
"zone",
|
||||
]);
|
||||
|
||||
let subscribedRegistries = false;
|
||||
@ -227,10 +228,7 @@ const computeDefaultViewStates = (entities: HassEntities): HassEntities => {
|
||||
const states = {};
|
||||
Object.keys(entities).forEach((entityId) => {
|
||||
const stateObj = entities[entityId];
|
||||
if (
|
||||
!stateObj.attributes.hidden &&
|
||||
!HIDE_DOMAIN.has(computeStateDomain(stateObj))
|
||||
) {
|
||||
if (!HIDE_DOMAIN.has(computeStateDomain(stateObj))) {
|
||||
states[entityId] = entities[entityId];
|
||||
}
|
||||
});
|
||||
|
@ -124,7 +124,6 @@ class HaPanelMap extends LocalizeMixin(PolymerElement) {
|
||||
var entity = hass.states[entityId];
|
||||
|
||||
if (
|
||||
(entity.attributes.hidden && computeStateDomain(entity) !== "zone") ||
|
||||
entity.state === "home" ||
|
||||
!("latitude" in entity.attributes) ||
|
||||
!("longitude" in entity.attributes)
|
||||
|
@ -92,7 +92,6 @@ hassAttributeUtil.LOGIC_STATE_ATTRIBUTES = hassAttributeUtil.LOGIC_STATE_ATTRIBU
|
||||
description: "Device class",
|
||||
domains: ["binary_sensor", "cover", "humidifier", "sensor", "switch"],
|
||||
},
|
||||
hidden: { type: "boolean", description: "Hide from UI" },
|
||||
assumed_state: {
|
||||
type: "boolean",
|
||||
domains: [
|
||||
|
@ -4,7 +4,6 @@ import { getViewEntities } from "../../../src/common/entity/get_view_entities";
|
||||
|
||||
import {
|
||||
createEntities,
|
||||
createEntity,
|
||||
createGroup,
|
||||
createView,
|
||||
entityMap,
|
||||
@ -47,33 +46,4 @@ describe("getViewEntities", () => {
|
||||
|
||||
assert.deepEqual(expectedEntities, getViewEntities(entities, view));
|
||||
});
|
||||
|
||||
it("should not include hidden entities inside groups", () => {
|
||||
const visibleEntity = createEntity({ attributes: { hidden: false } });
|
||||
const hiddenEntity = createEntity({ attributes: { hidden: true } });
|
||||
const group1 = createGroup({
|
||||
attributes: {
|
||||
entity_id: [visibleEntity.entity_id, hiddenEntity.entity_id],
|
||||
},
|
||||
});
|
||||
|
||||
const entities = {
|
||||
[visibleEntity.entity_id]: visibleEntity,
|
||||
[hiddenEntity.entity_id]: hiddenEntity,
|
||||
[group1.entity_id]: group1,
|
||||
};
|
||||
|
||||
const view = createView({
|
||||
attributes: {
|
||||
entity_id: [group1.entity_id],
|
||||
},
|
||||
});
|
||||
|
||||
const expectedEntities = {
|
||||
[visibleEntity.entity_id]: visibleEntity,
|
||||
[group1.entity_id]: group1,
|
||||
};
|
||||
|
||||
assert.deepEqual(expectedEntities, getViewEntities(entities, view));
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user