Skip to content

Serac v1.8.0 - Vigilance Automation Features

Choose a tag to compare

@atacamalabs atacamalabs released this 12 Feb 13:29
· 7 commits to main since this release

🎯 Serac v1.8.0 - Vigilance Automation Features

What's New

This release adds binary sensors, a manual update service, and enhanced attributes to make creating weather alert automations incredibly easy. Perfect for mobile notifications, TTS announcements, and conditional logic!

🎯 Binary Sensors for Automation Triggers

Three new binary sensors that make automation creation trivial:

1. binary_sensor.serac_{prefix}_has_active_alert

  • State: ON when ANY alert is above green (yellow, orange, or red)
  • Use case: "Notify me of any weather alert"
  • Attributes: List of active alerts with phenomenon, level, color

2. binary_sensor.serac_{prefix}_has_orange_alert

  • State: ON when orange or red alerts are present
  • Use case: "Notify me of dangerous conditions"
  • Attributes: List of orange/red alerts only

3. binary_sensor.serac_{prefix}_has_red_alert

  • State: ON when red alerts are present
  • Use case: "Emergency notifications only"
  • Attributes: List of red alerts only

All binary sensors include:

  • active_alerts: Detailed list of alerts (phenomenon, name, level, color)
  • alert_count: Number of active alerts
  • department: French department code
  • department_name: Department name
  • overall_level: Overall alert level (1-4)
  • overall_color: Overall color (green/yellow/orange/red)

🔄 Manual Update Service

New service: serac.update_vigilance

  • Force immediate refresh of vigilance data
  • Works across all Serac instances
  • Useful for testing and on-demand updates
  • Available in Developer Tools → Services

Usage:

service: serac.update_vigilance

📊 Enhanced Sensor Attributes

All vigilance sensors now include rich automation-friendly attributes:

  • active_alerts: Array of active (non-green) alerts with full details
  • alert_count: Count of active alerts (0-9)
  • highest_level: Highest alert level currently active (1-4)

These work great with templates and conditional logic!

🤖 Automation Examples

Example 1: Mobile Notification on Any Alert

automation:
  - alias: "Weather Alert Notification"
    trigger:
      - platform: state
        entity_id: binary_sensor.serac_home_has_active_alert
        to: "on"
    action:
      - service: notify.mobile_app_iphone
        data:
          title: "⚠️ Weather Alert"
          message: >
            {{ state_attr('binary_sensor.serac_home_has_active_alert', 'alert_count') }} 
            alert(s): {{ states('sensor.serac_home_vigilance_summary') }}

Example 2: TTS Announcement for Dangerous Alerts

automation:
  - alias: "Dangerous Weather Alert TTS"
    trigger:
      - platform: state
        entity_id: binary_sensor.serac_home_has_orange_alert
        to: "on"
    action:
      - service: tts.google_translate_say
        entity_id: media_player.home
        data:
          message: >
            Attention! Weather alert: 
            {{ states('sensor.serac_home_vigilance_summary') }}

Example 3: Flash Lights on Red Alert

automation:
  - alias: "Red Alert Flash Lights"
    trigger:
      - platform: state
        entity_id: binary_sensor.serac_home_has_red_alert
        to: "on"
    action:
      - service: light.turn_on
        target:
          entity_id: light.all_lights
        data:
          flash: "long"
          rgb_color: [255, 0, 0]
      - service: notify.mobile_app_iphone
        data:
          title: "🚨 RED ALERT"
          message: "Extreme weather conditions detected!"

Example 4: Conditional Card Display

type: conditional
conditions:
  - entity: binary_sensor.serac_home_has_active_alert
    state: "on"
card:
  type: markdown
  content: |
    ## ⚠️ Weather Alerts
    {{ states('sensor.serac_home_vigilance_summary') }}
    
    **Active Alerts:** {{ state_attr('binary_sensor.serac_home_has_active_alert', 'alert_count') }}

Technical Details

New Files

  • custom_components/serac/binary_sensor.py - Binary sensor platform implementation
  • custom_components/serac/services.yaml - Service documentation

Modified Files

  • custom_components/serac/__init__.py - Added binary sensor platform registration and service handler
  • custom_components/serac/sensor.py - Enhanced vigilance sensor attributes
  • custom_components/serac/manifest.json - Version bump to 1.8.0

Architecture

  • Binary sensors use the same VigilanceCoordinator as vigilance sensors
  • No additional API calls required
  • Automatic entity ID sanitization (same as v1.7.1)
  • Binary sensors follow Home Assistant best practices (device class: safety)

Upgrade Instructions

For HACS Users

  1. Go to HACS → Integrations
  2. Find "Serac" and click "Update"
  3. Restart Home Assistant
  4. New binary sensors will appear automatically

What You'll See After Update

New entities per location:

  • binary_sensor.serac_{prefix}_has_active_alert
  • binary_sensor.serac_{prefix}_has_orange_alert
  • binary_sensor.serac_{prefix}_has_red_alert

New service:

  • serac.update_vigilance (in Developer Tools → Services)

Enhanced attributes on existing sensors:

  • All vigilance sensors now have active_alerts, alert_count, highest_level

Full Changelog

v1.8.0:

  • 🎯 Added 3 binary sensors for automation triggers
  • 🔄 Added serac.update_vigilance service for manual refresh
  • 📊 Enhanced sensor attributes (active_alerts, alert_count, highest_level)
  • 🤖 Perfect for mobile notifications and TTS automations
  • 🔧 Binary sensors include detailed alert information

Links


🎨 Generated with Claude Code