diff --git a/js/editor/automation.js b/js/editor/automation.js index 9234b34967..ea5a25fbbe 100644 --- a/js/editor/automation.js +++ b/js/editor/automation.js @@ -78,22 +78,21 @@ export default class Automation extends Component { - { condition && - - Conditions - - Conditions are an optional part of an automation rule and can be used to prevent - an action from happening when triggered. Conditions look very similar to triggers - but are very different. A trigger will look at events happening in the system - while a condition only looks at how the system looks right now. A trigger can - observe that a switch is being turned on. A condition can only see if a switch - is currently on or off. -

- Learn more about conditions. -

-
- -
} + + Conditions + + Conditions are an optional part of an automation rule and can be used to prevent + an action from happening when triggered. Conditions look very similar to triggers + but are very different. A trigger will look at events happening in the system + while a condition only looks at how the system looks right now. A trigger can + observe that a switch is being turned on. A condition can only see if a switch + is currently on or off. +

+ Learn more about conditions. +

+
+ +
Action diff --git a/js/editor/condition/sun.js b/js/editor/condition/sun.js index d234d2757c..23064c6b0d 100644 --- a/js/editor/condition/sun.js +++ b/js/editor/condition/sun.js @@ -15,7 +15,7 @@ export default class SunCondition extends Component { const condition = { ...this.props.condition }; if (ev.target.selected) { - condition[key] = ev.target.value; + condition[key] = ev.target.selected; } else { delete condition[key]; } diff --git a/panels/config/automation/ha-automation-editor.html b/panels/config/automation/ha-automation-editor.html index 07341240de..2928914416 100644 --- a/panels/config/automation/ha-automation-editor.html +++ b/panels/config/automation/ha-automation-editor.html @@ -216,6 +216,7 @@ Polymer({ trigger: [ { platform: 'state' }, ], + condition: [], action: [ { service: '' }, ], @@ -253,7 +254,7 @@ Polymer({ this.dirty = false; if (this.creatingNew) { - history.pushState(null, null, '/automation/edit/' + id); + history.replaceState(null, null, '/config/automation/edit/' + id); this.fire('location-changed'); } }.bind(this), function (errors) {