Dúvida sobre “YET another take on an alarm system”

Boas malta,

Começei a configurar o sistema de alarme do [gazoscalvertos.
Mas estou com uma certa dificuldade em configurar a modo da maneira que quero.
Sendo assim este topico serve para quem ( como eu) tem dificuldades neste assunto.

É o seguinte, será possivel uma automação/switch passar para o seu estado de “ON” ao fim de armar o sistema de alarme?

E apartir do momento que eu abra a porta ( sensor) como faço para que tenha uns 30 segundos para digitar o codigo senão entra a sirene? Como configuro isto tudo?

Obrigado

Todas as configurações são feitas dentro do ficheiro alarm.yaml

Explica melhor o que queres, alterar um switch ou correr uma automação?

@j_assuncao tenho isso tudo configurado já. Ainda me esta a custar entender bem as coisa, mas aos poucos isto vai.
O tempo tenho de averiguar melhor quando chegar a casa se não estou a fazer mal as coisas.

Em relação a outra questão pretendia que fosse (para agora) uma automação que ele ligasse ao ser armado.

Esta seria a automação que queria ligar:

Automação - Ligar Sirene Quando Porta Principal Abrir

- alias: 'Alertar Se Porta Abrir'
  initial_state: 'off'
  trigger:
    platform: state
    entity_id: binary_sensor.sensor_porta_principal
    from: 'off'
    to: 'on'
  condition:
    condition: state
    entity_id: switch.interruptor_sirene
    state: 'off'
  action:
  #  - delay: '00:00:02'    
    - service: switch.turn_on
      entity_id:
        - switch.interruptor_sirene
    - delay: '00:05:00'
    - service: switch.turn_off
      entity_id:
        - switch.interruptor_sirene

Antes de mais não te esqueças que tens de descomentar e configurar as entradas de MQTT no ficheiro alarm.yaml.

Não precisas dessa automação para nada uma vez que que vai fazer tocar a sirene será o alarme.

1 Curtiu

Hoje já consegui perder aqui um bocadinho com isto hoje… Por tanto já alterei as entradas MQTT no ficheiro alarm.yaml. É necessário acrescentar estas linhas no configuration.yaml :

mqtt:
  username: !secret username_mqtt
  password: !secret password_mqtt
  keepalive: 30

alarm.yaml:

 platform: bwalarm
name: House

alarm: automation.alarm_triggered
warning: automation.alarm_warning

##[CODE RELATED]
#[REQUIRED] Master Code, should consist of one or more digits ie '6482' ensure your passcode is encapsulated by quotes
code: !secret alarm_code 
#[OPTIONAL] Panic Code should consist of one or more digits ie '9876' ensure your passcode is encapsulated by quotes, it needs to be different to your standard alarm code. This enables a special panic mode. This can be used under duress to deactivate the alarm which would appear to the unseeing eye as deactivated however a special attribute [panic_mode] listed under the alarm_control_panel.[identifier] will change to ACTIVE. This status could be used in your automations to send a notification to someone else police/spouse/sibling/neighbour that you are under duress. To deactive this mode arm then disarm your alarm in the usual manner. 
panic_code: !secret panic_code 

#[DEFAULT] Grace time in seconds to allow for exit and entry using Away mode
pending_time: 25  
#[DEFAULT] The amount of time the alarm stays triggered before returning to its previous state
trigger_time: 300 

#######################################################################################
##[STATE RELATED]
#[OPTIONAL]
#armed_perimeter: 
  ##[OPTIONAL however either an immediate or delayed group must exist] Sensors in this group tigger the alarm immediately 
#  immediate:
#    - binary_sensor.sensor_porta_principal

#######################################################################################

#[REQUIRED]
armed_home: 
  #[OPTIONAL] State specific overrides default time above
  pending_time: 10
  #[OPTIONAL] State specific overrides default time above
  trigger_time: 300 
  ##[OPTIONAL however either an immediate or delayed group must exist] Sensors in this group tigger the alarm immediately 
  immediate:
    - binary_sensor.sensor_porta_principal

  ##[OPTIONAL] Sensors in this group start the clock (pending_time) when tripped before the alarm is triggered 
#  delayed:
#    - binary_sensor.first_floor_motion
##################################################################


#[REQUIRED]
armed_away: 
  #[OPTIONAL] State specific overrides default time above
  trigger_time: 600  
  ##[OPTIONAL however either an immediate or delayed group must exist] Sensors in this group tigger the alarm immediately 
  immediate:
    - binary_sensor.sensor_porta_principal

  ##[OPTIONAL] Sensors in this group start the clock (pending_time) when tripped before the alarm is triggered 
  delayed:
    - switch.interruptor_sirene

  #[OPTIONAL] Use this group to automatically override the warning message on open sensors when arming. (I use this as I have a motion sensor at the front door)
#  override:
#    - binary_sensor.front_door
#    - binary_sensor.hall_motion
############################################################################
##[INTERFACE OPTIONAL SETTINGS] 
#[OPTIONAL] - False by default. True enables a clock in the center of the status bar
clock: True  
#[OPTIONAL] - False by default. True enables perimeter mode, this could be known as 'Day Mode' i.e. only arm the doors whilst there is someone using all floors
perimeter_mode: false 
#[OPTIONAL] - False by Default. Allows a weather summary to be displayed on the status bar. Dark Sky weather component must be enabled with the name sensor.dark_sky_summary
weather: True 
#[OPTIONAL] False by Default. Allows this custom component to save the state of the alarm to file then reinstate it in the event of power loss.
persistence: False 
#[OPTIONAL] - True by default. This is a security feature when enabled hides the passcode while entering disarm code.
hide_passcode: True 
#[OPTIONAL] - False by default. This is a security feature when enabled hides the HA sidebar when the alarm is armed. The sidebar re-appears when the alarm is disarmed.
hide_sidebar: True 
#[OPTIONAL] - False by default. Setting this to True hides sensor groups (all sensors, immediate sensors, delayed sensors, inactive sensors) from the display. Open sensors will still appear
hide_sensor_groups: False 
#[OPTIONAL] - True by default. Setting this to False enables a custom panel below the sensors groups which allows you to add your own html code. Use this to bring any other features you would like to see for example displaying live camera feeds, a rotating image gallery, custom HA buttons and sensors. To use this enable the custom panel in alarm.yaml (custom_panel: True) then ensure you take a copy of custom-element.html and add it to you www/alarm/ folder. Edit the html code between the <template> tags. I'm have added a custom sample folder where I will upload examples of 'things' which can be added here. Please contribute!!!
hide_custom_panel: True 

##[PASSCODE RELATED]
#[OPTIONAL] Disabled if commented out. When a value equal or greater than 0 is set, the system will only allow the set amount of password attempts before timing out
#passcode_attempts: 3 
#[OPTIONAL] Default 30 seconds. When set with the password attempts option the panel will timeout for the amount of seconds set if the password is entered incorrectly as per the password_attempts option. The system will then reset the allowed password attempts
#passcode_attempts_timeout: 30 

##[MQTT RELATED]
#[OPTIONAL] - False by default. Settings this to True will enable MQTT Mode. Uncomment options below to use See the README for guidance.
mqtt: True 
#[OPTIONAL] False by default. if true allows MQTT commands to disarm the alarm without a valid code.
#override_code: True 
#[OPTIONAL] The MQTT topic HA will publish state updates to.
state_topic: 'home/alarm' 
#[OPTIONAL] The MQTT topic HA will subscribe to, to receive commands from a remote device to change the alarm state.
command_topic: 'home/alarm/set' 
#[OPTIONAL] The maximum QoS level for subscribing and publishing to MQTT messages. Default is 0.
qos: 0 
#[OPTIONAL] The payload to disarm this Alarm Panel. Default is “DISARM”.
payload_disarm: "DISARM" 
#[OPTIONAL] The payload to set armed-home mode on this Alarm Panel. Default is “ARM_HOME”.
payload_arm_home: "ARM_HOME" 
#[OPTIONAL] The payload to set armed-away mode on this Alarm Panel. Default is “ARM_AWAY”.
payload_arm_away: "ARM_AWAY" 
#[OPTIONAL] The payload to set armed-night mode on this Alarm Panel. Default is “ARM_NIGHT”.
payload_arm_night: "ARM_NIGHT" 

## [COLOURS] Use any HTML format
warning_colour: 'orange'
pending_colour: 'orange'
disarmed_colour: '#03A9F4'
armed_home_colour: 'black'
armed_away_colour: 'black'
triggered_colour: 'red'

## [CUSTOM SENSOR STATUSES]
## These settings allow devices which are not natively supported by this panel to be used. 
## This is to be used when the state of the device is not recognised by the panel. Examples are provided below 
#custom_supported_statuses_on:
#  - 'running' #EXAMPLE
#  - flipped #EXAMPLE
#custom_supported_statuses_off:
#  - 'not_running' #EXAMPLE
#  - unflipped   #EXAMPLE

Tenho tambem o ficheiro “package_alarm.yaml” em “config_files\packages”. Por exemplo eu aqui posso utilizar delay para a sirene não ser activada logo em que o sensor é activado?

 #### ALARM TRIGGERED
  - id: alarm_triggered
    alias: '[Alarm] Triggered'
    trigger:
      - platform: state
        entity_id: alarm_control_panel.house
        to: 'triggered'
    action:
      - delay: '00:00:10'
      - service: switch.turn_on
        entity_id: switch.interruptor_sirene
      - service: notify.telegram
        data:
          message: 'ALARME ACIONADO!!! {{ states[states.alarm_control_panel.house.attributes.changed_by.split(".")[0]][ states.alarm_control_panel.house.attributes.changed_by.split(".")[1]].name }}'

Uma outra questão, como puderei fazer se o alarme for ativado e falhar a luz e de repente voltar outra vez? o Alarme entra em modo desativado quando o raspberry reiniciar… Para contornar isto só mesmo com uma UPS??

Aquilo que tu queres penso que é feito na variável trigger_time.

Este sistema de alarme também tem uma aplicação Android para controlo do mesmo.

Vi isto num tutorial dessa app. Mas se adicionar o “delay_time” em “armed_way” por exemplo da-me um erro no HA. Será que este comando já não está disponivel nesta versão ou assim?

### Example Home Assistant Setup

```
    alarm_control_panel:
      - platform: manual_mqtt
        state_topic: home/alarm
        command_topic: home/alarm/set
        pending_time: 60
        trigger_time: 1800
        disarm_after_trigger: false
        delay_time: 30
        armed_home:
          pending_time: 0
          delay_time: 0
        armed_away:
          pending_time: 60
          delay_time: 30
    ```

Como é que me connecto com essa app ao Alarme? Insiro o IP e porta do meu Home Assistant no MQTT da app mas diz sempre " Não foi possivel subscrever os topicos MQTT. Verifique…" Tenho de instalar o Mosquito ou algo parecido??

Para ligares a APP ao MQTT tens de ter o broker aberto para fora da tua rede e configurar todas as opções de MQTT na respectiva página.

@j_assuncao Supostamente devo inserir isto no ficheiro configuration.yaml não?

mqtt:
  broker: 127.0.0.1
  port: 1883
  username: !secret username_mqtt
  password: !secret password_mqtt

Não me estou a entender nadinha com o MQTT…

Estás a utilizar que SO para correr o HA, Raspbias, Hassbian; Hassio…?

Hassbian num Rpi 3 com a versao 0.73.1 ainda. Esta versão está muito mais rapida no meu Rpi do que com a ultima…

Esta está a ser a 1ª vez que estou a mexer em MQTT e não me estou a sair la muito bem. Está-me alguma coisa a escapar e se calhar está a vista

Vais ter de instalar então o mosquitto e depois criar as configurações no configuration.yaml de acordo com a instalação.

1 Curtiu

@j_assuncao Penso que já esteja a bombar. Já consigo enviar e receber mensagens. Na app do android também já consigo armar o alarm, porem nao consigo desarmar:

Log Details (ERROR)
Fri Sep 14 2018 13:41:33 GMT+0100 (Horário de Verão da Europa Ocidental)

Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl…at 0x68c09370>)
Traceback (most recent call last):
File “/usr/lib/python3.5/asyncio/events.py”, line 126, in _run
self._callback(*self._args)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/init.py”, line 679, in _mqtt_handle_message
msg.topic, payload, msg.qos)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py”, line 267, in async_run_job
target(*args)
File “/home/homeassistant/.homeassistant/custom_components/alarm_control_panel/bwalarm.py”, line 661, in message_received
self.alarm_disarm(payload.split(" ")[1])
IndexError: list index out of range

Este é o erro que aparece no log do HA

E se desarmares directamente no HA também dá erro?

Não. Directamente funciona bem.
Pela app é que não faz nada. E se for ao HA ver o log, é isso que aparece

Deixa-me ver se percebo de onde vem esse erro. Mas desconfio que deves ter um tópico mal configurado. Confirma se todos os tópicos na aplicação batem certos com os do configuration.yaml.

É assim que tenho na app:

E as configurações no alarm.yaml é as que estou em cima…

Na App aparece as opçoes de “delay” mas no ficheiro nao tenho nada disso nem consigo inserir que dá erro.

Eu referia-me às opções de MQTT…

Penso que o delay da app é o trigger_time do HA.

as opçoes que tenho sao estas:

mqtt:
  broker: 192.168.1.123
  port: 1234
  client_id: home-assistant-1
  username: !secret username_mqtt
  password: !secret password_mqtt

Este cliente_id deve ser o client_id da app?

O client_id não precisa de estar configurado.

client_id

(string)(Optional)The client ID that Home Assistant will use. Has to be unique on the server. Default is a randomly generated one.

O MQTT que te tenho estado a dizer para confirmares é a configuração dos tópicos MQTT.


Copyright © 2017-2021. Todos os direitos reservados
CPHA.pt - info@cpha.pt


FAQ | Termos de Serviço/Regras | Política de Privacidade