Skip to content

onoffautomations/home-assistant-textbee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TextBee for Home Assistant

Custom Integration by OnOff Automations

Custom Home Assistant integration for TextBee โ€“ built by OnOff Automations โ€“ to send and receive SMS/MMS via your TextBee gateway devices.

The TextBee Home Assistant integration allows full SMS automation through one or more TextBee gateway devices.
You can send SMS messages, receive inbound messages instantly via webhook, automate based on keywords, track message stats, and monitor device diagnostics.

โš ๏ธ TextBee Limitations (as of now):

  • Picture messaging (MMS) is not supported yet
  • Signal strength & battery reporting are not fully supported by TextBee yet

๐Ÿš€ Features

๐Ÿ“ฑ Multi-Device Support

Each TextBee gateway under your account becomes its own device in Home Assistant.

๐Ÿ“Š Per-Device Sensors

Each device exposes the following sensors:

  • Status (online/offline/etc.) โ€“ Diagnostic
  • Signal Bars โ€“ Diagnostic
  • Battery Level โ€“ Diagnostic
  • Device ID (with raw attributes) โ€“ Diagnostic
  • Registered (true/false) โ€“ Diagnostic
  • Last Message Text (inbound/outbound)
  • Last Incoming Number
  • Last Outgoing Number
  • Last Incoming Text
  • Last Outgoing Text

๐Ÿ“ค SMS Sending Service

A single unified service:

textbee.send_sms

Supports:

  • Single SMS
  • Bulk SMS (comma-separated numbers)
  • Message content (required)
  • Optional media_urls (for future MMS support)

๐Ÿ“ฆ Installation

You can install TextBee using HACS (Recommended) or manually.


๐Ÿ”ต Option 1 โ€” Install via HACS (Custom Repository)

  1. Open HACS โ†’ Integrations
  2. Click โ‹ฎ menu โ†’ Custom repositories
  3. Add:
https://github.com/onoffautomations/home-assistant-textbee

Repository type: Integration

  1. Install via HACS
  2. Restart Home Assistant
  3. Add integration: Settings โ†’ Devices & Services โ†’ Add Integration โ†’ TextBee

๐Ÿ”ต Option 2 โ€” Manual Installation

  1. Download or clone this repository
  2. Copy custom_components/textbee into:
<config>/custom_components/textbee
  1. Restart Home Assistant
  2. Add integration as usual.

๐Ÿ”” Ganerate API

Ganerate a API in Textbee:

  • Log in to your TextBee account at https://app.textbee.dev/
  • Generate an API key and use it in the Home Assistant integration config.

โš™๏ธ Service: textbee.send_sms

Example:

service: textbee.send_sms
data:
  device_id: "device_1"
  recipients: "+18451234567, +18885557777"
  message: "Reminder: Shacharis is at 7:15am"

๐Ÿ“ก Services

textbee.send_sms

Send a single SMS, bulk SMS, or a picture message.

Example service call:

service: textbee.send_sms
data:
  device_id: "device_1"
  recipients: "+15551234567, +15557654321"
  message: "Hello from Home Assistant ๐Ÿ‘‹"
  media_urls: "https://example.com/image1.jpg, https://example.com/image2.jpg"

Fields:

  • device_id (string, required): ID of the TextBee gateway device.
  • recipients (string or list, required):
    • "+15551234567" or
    • ["+15551234567", "+15557654321"] or
    • comma-separated string.
  • message (string, required): SMS text.
  • media_urls (string or list, optional):
    One or more URLs to images/media; if provided, a picture/MMS is sent when supported by TextBee.

๐Ÿค– Example automations

1. Notify when a specific number texts you

Trigger a mobile push when a specific number sends any SMS.

alias: TextBee - Alert when VIP texts
mode: single
trigger:
  - platform: state
    entity_id: sensor.textbee_device_1_last_incoming_text
condition:
  - condition: template
    value_template: >
      {{ states('sensor.textbee_device_1_last_incoming_number') == '+15551234567' }}
action:
  - service: notify.mobile_app_my_phone
    data:
      title: "New SMS from VIP"
      message: >
        {{ states('sensor.textbee_device_1_last_incoming_text') }}

2. Keyword automation โ€“ turn on a scene via SMS

Turn on a scene if someone sends you an SMS that contains a keyword like LIGHTS ON.

alias: TextBee - Control lights via SMS
mode: single
trigger:
  - platform: state
    entity_id: sensor.textbee_device_1_last_incoming_text
condition:
  - condition: template
    value_template: >
      {% set text = states('sensor.textbee_device_1_last_incoming_text') | lower %}
      {{ 'lights on' in text }}
action:
  - service: scene.turn_on
    target:
      entity_id: scene.shul_full_on
  - service: textbee.send_sms
    data:
      device_id: "device_1"
      recipients: >
        {{ states('sensor.textbee_device_1_last_incoming_number') }}
      message: "Lights are now on โœ…"

3. Forward all incoming SMS into a HA log / dashboard

Send every incoming SMS to a logbook message & persistent notification:

alias: TextBee - Log all incoming SMS
mode: parallel
trigger:
  - platform: state
    entity_id: sensor.textbee_device_1_last_incoming_text
condition:
  - condition: template
    value_template: >
      {{ trigger.to_state.state not in ['', 'unknown', 'unavailable'] }}
action:
  - service: logbook.log
    data:
      name: "TextBee SMS"
      message: >
        From {{ states('sensor.textbee_device_1_last_incoming_number') }}:
        {{ states('sensor.textbee_device_1_last_incoming_text') }}
  - service: persistent_notification.create
    data:
      title: "New SMS via TextBee"
      message: >
        From {{ states('sensor.textbee_device_1_last_incoming_number') }}:
        {{ states('sensor.textbee_device_1_last_incoming_text') }}

๐Ÿ’ฌ Example Lovelace โ€œChatโ€ Card

You can build a simple chat-style UI using an input_text for the recipient, an input_text for the message, a script, and a small card.

1. Helpers (configuration.yaml)

input_text:
  textbee_chat_recipient:
    name: TextBee Chat Recipient
    icon: mdi:phone
    max: 30

  textbee_chat_message:
    name: TextBee Chat Message
    icon: mdi:message-text
    max: 250

2. Script to send the message

script:
  textbee_send_chat_message:
    alias: TextBee - Send chat message
    mode: single
    sequence:
      - service: textbee.send_sms
        data:
          device_id: "device_1"  # <-- Adjust to your device id
          recipients: "{{ states('input_text.textbee_chat_recipient') }}"
          message: "{{ states('input_text.textbee_chat_message') }}"
      - service: input_text.set_value
        data:
          entity_id: input_text.textbee_chat_message
          value: ""

3. Lovelace card (simple entities + button)

type: vertical-stack
cards:
  - type: custom:button-card
    name: TextBee Chat
    show_state: false
    show_label: true
    icon: mdi:chat-processing
    styles:
      card:
        - padding: 16px
        - border-radius: 16px
      name:
        - font-weight: 600
        - font-size: 18px
      label:
        - white-space: pre-line
        - font-size: 13px
    label: |
      [[[
        const incNum = states['sensor.textbee_device_1_last_incoming_number']?.state || 'โ€”';
        const incTxt = states['sensor.textbee_device_1_last_incoming_text']?.state || 'No incoming messages yet';
        const outNum = states['sensor.textbee_device_1_last_outgoing_number']?.state || 'โ€”';
        const outTxt = states['sensor.textbee_device_1_last_outgoing_text']?.state || 'No outgoing messages yet';

        return `
Last incoming:
  ${incNum}: ${incTxt}

Last outgoing:
  ${outNum}: ${outTxt}
        `;
      ]]]

  - type: entities
    title: Send SMS via TextBee
    entities:
      - entity: input_text.textbee_chat_recipient
        name: To (phone number)
      - entity: input_text.textbee_chat_message
        name: Message

  - type: button
    name: Send Message
    icon: mdi:send
    tap_action:
      action: call-service
      service: script.textbee_send_chat_message

That gives you:

  • A โ€œchat headerโ€ card showing last in / last out.
  • Two text inputs for number + message.
  • A big Send button that calls textbee.send_sms via the script.

You can of course wrap this in your Bubble / Mushroom / OnOff styling later โ€“ this is just the bare bones.


Made by OnOff Automations

About

TextBee for Home Assistant

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages