Madman Lora Mailbox sensor: Notification Setup

Hello. I would like to share my mailbox sensor setup. It’s simple; nothing fancy. The sensor device is the v.2 created by @Madman. He was kind enough to listened to my suggestion and created a ready-made sensor for those who have no experience with hot plate soldering. You can read about Madman github for more details.

Below is my setup and automations. The 3D case file for the Lilygo TTGO V1 gateway was provided by user wmaker. Thank you for that. When the sensor is triggered, a call-to-action message is send to telegram where I can confirm delivered. If I forget to confirm delivered, I have setup another automation where it will change the state to delivered at midnight. You will need to setup Telegram for Ha prior.

- alias: Telegram - You got mail
  trigger:
    - platform: state
      entity_id: sensor.lora_mailbox
      id: mail
      to: '0xA2B2'
      for: 3
    - platform: state
      entity_id: sensor.lora_mailbox
      id: bat
      to: '0xLBAT'
      for: 3
  condition:
    - condition: []
  action:
    - choose:
      - conditions:
        - condition: trigger
          id: mail
        sequence:
        - service: notify.amberthebot
          data_template:
            message: "You've got mail!"
            data:
              inline_keyboard:
              - 'Received:/received, Mute:/donothing'
      - conditions:
        - condition: trigger
          id: bat
        sequence:
        - service: script.text_notify
          data:
            who: amber
            title: 'Mailbox'
            message: "Mailbox battery is low!"
        - service: python_script.set_state
          data:
            entity_id: sensor.lora_mailbox
            state: received

- alias: Telegram - You got mail received
  trigger:
    - platform: event
      event_type: telegram_callback
      event_data:
        data: '/received'
  action:
    - service: telegram_bot.answer_callback_query
      data_template:
        callback_query_id: '{{ trigger.event.data.id }}'
        message: 'OK, turning off notification'
    - service: telegram_bot.edit_replymarkup
      data_template:
        message_id: '{{ trigger.event.data.message.message_id }}'
        chat_id: '{{ trigger.event.data.chat_id }}'
        inline_keyboard: []
    - service: python_script.set_state
      data:
        entity_id: sensor.lora_mailbox
        state: received

  - alias: Reset mailbox 
    initial_state: true
    trigger:
      - platform: time
        at: '00:00:01'
      - platform: homeassistant
        event: start
    action:
      - service: python_script.set_state # reset mail if not done so
        data:
          entity_id: sensor.lora_mailbox
          state: received

2 Likes

Thanks for sharing, Finally I put together a video

3 Likes