Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

fix: update alarm tile example with support for new states #472

Merged
merged 2 commits into from
Oct 16, 2020
Merged

Conversation

rchl
Copy link
Collaborator

@rchl rchl commented Oct 12, 2020

No description provided.

@rchl
Copy link
Collaborator Author

rchl commented Oct 13, 2020

@akloeckner Care to review?

@@ -8,6 +8,7 @@ extends: 'eslint:recommended'
ignorePatterns:
- build/
- scripts/vendors/
- config.example.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should we not lint the example? Probably that's the piece of code that is most read by the user...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could lint but it would then need to use eslint configuration that doesn't use any new ES features as the config needs to, unfortunately, stay compatible with old browsers and we can't transpile it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see the dilemma. Let's just run eslint --fix from time to time then, to have at least indents and the like correct.

(In the long run, I'd prefer to have only one file with examples. That should render on GitHub and be usable as a start configuration. Maybe like here: https://github.com/akloeckner/TileBoard/blob/test/one-example/TILE_EXAMPLES.md . But if you have better ideas...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eslint --fix will still use the default configuration so it will switch to new ES syntax if we run it.

We can just have an override for this file specifically and un-ignore it then.

I agree about having one place with examples.

@@ -178,26 +178,32 @@ var CONFIG = {
{
position: [0, 1],
type: TYPES.ALARM,
//id: "alarm_control_panel.home_alarm",
// id: "alarm_control_panel.home_alarm",
id: { state: 'disarmed' }, // replace it with real string id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say, the effective setting in the example should be the actual example id, while this line here appears to be a test. (Which I appreciated very much in testing...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it's done like that because that will make the tile show up while real ID wouldn't (it would complain about the missing entity). So I think it's better like that for the purpose of showing something to user.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Sounds reasonable. We should apply that thinking to the other examples then, too. In the long run...

disarmed: 'Disarmed',
pending: 'Pending',
armed_custom_bypass: 'Armed custom bypass',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This state name is so long, it overflows my tile. While that is probably another issue by itself, I suggest to use a shorter name in the example. Maybe just “Custom“?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll go with "Armed bypass". I want to preserve the text that alarm is armed to be consistent with other armed states.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@rchl rchl merged commit 43f151b into master Oct 16, 2020
@rchl rchl deleted the fix/alarm branch October 16, 2020 10:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants