I’ve built an ESP8266 based door sensor that is running fine in the front end. Door opens it toggles to off and vice versa. However I’ve built an automation that I intend to email me when the door is opened and turn on some lights but its just not running.
I’ve checked the configuration and it passes fine, any help would be most appreciated
But just from first glance it looks like you are using the wrong state for your trigger. It should be “on” & “off”. Not “On” & “Off”. Capitalization is important.
I used the code tags, but it didnt work…
- id: FrontDoorMonitor
alias: Monitor the front door
trigger:
- entity_id: binary_sensor.front_door_reed
platform: state
from: ‘On’
to: ‘Off’
action:
- service: notify.email
data:
title: ‘Front Door Open’
message: ‘Front door has been opened’
- service: homeassistant.turn_on
entity_id: swith.side_lamp
I think @finity’s suggestion is probably correct. I.e., you’re using the wrong capitalization for the from & to states. They need to be all lower case.
In the future, if you want help from this forum you need to learn to properly format YAML code, error messages, etc. You need to copy directly from a text editor (not a word processor.) Once you’ve pasted the code into the reply box, immediately select it and click the “Preformatted text” button. If that doesn’t work (although it should), you can try putting a line before the code containing exactly three “back tick” characters, and a line after it also with exactly three back ticks. Click on the “please use code blocks and syntax highlighting” link at the top of the page for more details.
You may have (non-binary) sensors whose state is 'On' and 'Off', but the states of binary_sensor’s are always 'on' and 'off' (lower case.) If the automation is still not working, please post it again, properly formatted, and maybe we can spot what else might be wrong.
I have posted the code directly from nano straight into the editor here, highlighted it and hit the preformatted text button.Twice now it hasn’t worked. I’m no noob, I’ve been a sysadmin for over 30 years primarily working with Unix environments.
To be honest, both your attitudes are exactly what is wrong with Open source community, elitist nobs!
I may be wrong but I’m pretty sure we aren’t the ones with any attitude.
You asked for help.
We tried to help but you (for whatever reason) can’t provide us with the information that is required to provide you the help that you asked for.
Then we try to help you provide us that information by suggesting what has worked countless times every time I’ve ever posted any code here.
Then when we say that we can’t really help until you can provide the information we need to help you then you try to impress us with your credentials and call us names.
Doesn’t seem like the best way to make people want to help you.
Using the preformatted text button is just a shortcut to preceding each selected line with four spaces. That is one way in markdown to format YAML code, etc.
The other way is using three back ticks on a line before and after the code as I mentioned above. I personally use the latter. It would look like this (in the left-hand editing pane):
```
xxx
yyy
```
The reason we put so much emphasis on this is that YAML, as you may know, is extremely sensitive to indentation, and when the code isn’t formatted right it’s impossible to see errors/problems due to incorrect indentation.
We’re more than willing to help if you will allow us. If not, that is, of course, your prerogative.