I have a problem that I cannot understand … I am using your code to which I have also added some LEDs … I have noticed that if the esp is restarted from reset or from power supply I find myself in the home Assistant the alarm in active state while its state was inactive
@MatthewFlamm
Hard to say without your code unless it is the same as above. To debug this I rely on using the logs when directly connected to a computer.
I always use that … As for the log how do you do? I look at the log from the home assistant’s add on esphome … Then on esphome it says … Warning you only have 96 bytes … What does this mean?
To be precise. The globals int is set to 0 … so if I switch off the power it should start with disarmed … But if I just do a reset and the globals at that moment was at 1 or 2 and is set to yer restore value … … It should send a publish to home assistant with the latest status … Instead it always sends armed home to me … Finding myself with the alarm system armed
@MatthewFlamm
I don’t use the ESP home add on, so I’m not sure sorry. I plug a usb cable directly from the esp into a laptop.
If I’m understanding correctly, if you do a reset when the alarm is currently in state 1 or 2, i.e. pending or triggered, it restarts in state 3, i.e. armed. Is that correct? If so, that is exactly how the code is written, if you want different behavior you need to change the on_boot
section.
If it isn’t, then I’m not understanding what is happening. Can you explain again? Id suggest you figure out how to get the logs working first. You could have an issue either on the esp code or the home assistant code. The only way to separate these is to access the logs on your esp unit.
What do you use for esphome to view the logs?
I have read the on boot many times but I do not think that the behavior should be this, or rather what you say is right, if it is 1 or 2 it must start from 3 … But if it is 0 it must start from 0 … Forgive me. If I have disarmed the alarm from home assistant the global is 0 … if I restart esp from reset … I find myself at the new start of esp home Assistant armed and esp armed …
@MatthewFlamm
Ok, this is clear. Are you still using the esp8266 or the esp32? I’ve only tested it with the esp32.
Seems like you need to debug on the ESP unit side. You can put logging messages inside the on boot section. If I remember, the global integers don’t get logged very well, so you need to put it in your own logic.
I have a laptop running Ubuntu with esphome installed. You can flash the esp unit directly this way and directly get the logs. I assume you can do the same using the add on, but I’ve never used it, so you would have to ask someone else.
Hi, does anybody used this project,? Is it stable?
It works great for me, but the pain point I’ve found is that the ESP units die on me after awhile. I’ve had two stop working months after running continuously. One was before and one was after when I implemented the persistence of state in memory. After this, I’m deciding whether I should continue flashing new units after the next failure or bite the bullet and use a commercial system that can be integrated somehow.
Thanks for the update, I will try connected.io and yours to see which one will die quicker if it will die obviously:)Thanks Again
If you mean konnected, they are also using esp32 or esp8266 chips. I had one of their first versions that used an off the shelf esp8226 and it lasted about as long as the others. Maybe their new custom boards are better?
Yes konnected sorry, thanks for the info. Will the sleep mode make any better for the board?
Is the error on the alarm code line? Is your code a string?
Hi Mat, i am now in the process of creating an alarm so i was surprised to see you have created exactly what i’m looking for. I did not want to be dependent on the HA server for an alarm i wanted the esp32 to work independent but integrate with HA so that if the HA server goes down it does not affect the arming and disarming of the alarm system. So basically it works like a traditional alarm system but still has the smart capabilities. Now my initial devices will be wired contacts which i have added and have them working just to read open and closed, motion sensors detecting motion already and i am now adding a gas/smoke sensor because fire and security goes together. I am very young to esp home so adding the devices is all i can do right now. Would you be able to help me with the coding aspect of the alarm like the arming disarming 24 hour zones disarm timers and so on.
The below is my code i have right now just changed the password for publishing purpose.
esphome:
name: pulseeyealarm
platform: ESP32
board: esp32dev
wifi:
ssid: “myssid”
password: “mypassword”
Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: “Pulseeyealarm Fallback Hotspot”
password: “myfallbackpassword”
captive_portal:
Enable logging
logger:
Enable Home Assistant API
api:
password: “myhaapipassword”
ota:
password: “myotapassword”
binary_sensor:
-
platform: gpio
pin: 22
name: “PIR Sensor”
device_class: motion -
platform: gpio
name: “test door contact”
pin:
number: 23
mode: INPUT_PULLUP
Have you looked at the code I linked to in the very first post of this thread? It has a lot of these ideas embedded there. If you have any questions, I can help.
Hey Mathew yes i’m looking at it now and it seems great. I am having an issue with the code i don’t know if its because it was compiled using an older version of esp home and i’m using the latest version up to date. I’m using your code word for word
maximum recursion depth exceeded while calling a Python object
this is the error i’m getting
Maybe I should be more explicit in the gist, but I did not include the board and platform keys under esphome. See here for example, but you need to use your own platform (esp8266 potentially) and board.
I’m not sure if this is causing the exact error you are getting, but you are definitely missing that.
forgive me for being such a noob. The rest of the code works fine but the only part it wont accept it seems is the secrets part. this is my board and link