
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
oasira
Advanced tools
Python API client for Oasira with Firebase OAuth support, designed for Home Assistant integrations
A Python API client for Oasira home security systems, designed specifically for Home Assistant integrations.
pip install oasira
Note: This package distributes only compiled bytecode to protect the source code. The functionality is identical to a source distribution.
git clone https://github.com/yourusername/oasira.git
cd oasira
pip install -e .
import asyncio
from oasira import OasiraAPIClient
async def main():
# Initialize the client with your credentials
# Option 1: PSK-based authentication
async with OasiraAPIClient(
customer_id="your_customer_id",
system_id="your_system_id",
customer_psk="your_customer_psk",
system_psk="your_system_psk"
) as client:
# Get customer and system information
info = await client.get_customer_and_system()
print(f"System: {info}")
# Get system users
users = await client.get_system_users()
print(f"Users: {users}")
# Create a security alarm
alarm_data = {
"sensor_device_class": "door",
"sensor_device_name": "Front Door",
"sensor_state": "open"
}
response = await client.create_security_alarm(alarm_data)
print(f"Alarm created: {response}")
asyncio.run(main())
import asyncio
from oasira import OasiraAPIClient
#### Initialization
```python
client = OasiraAPIClient(
customer_id="...", # Optional: Customer ID
system_id="...", # Optional: System ID
customer_psk="...", # Optional: Customer PSK token
system_psk="...", # Optional: System PSK token
firebase_token="...", # Optional: Firebase ID token for OAuth
firebase_refresh_token="...", # Optional: Firebase refresh token
session=None # Optional: Reuse existing aiohttp session
)
PSK Authentication (Legacy):
customer_psk and system_psk tokenseh_customer_id, eh_system_id, system_psk)Firebase OAuth Authentication (Recommended):
Uses Firebase ID tokens
Passed in standard Authorization: Bearer {token} header
Supports token refresh
More secure and standard OAuth 2.0 flow # Authenticate with Firebase auth_result = await client.authenticate_with_firebase( email="your.email@example.com", password="your_password", api_key=api_key )
# Token is now stored and automatically used in requests
system_info = await client.get_customer_and_system()
print(system_info)
# Refresh token when needed
await client.refresh_firebase_token(api_key)
asyncio.run(main())
### Using Existing Firebase Token
```python
# Initialize with existing Firebase token
async with OasiraAPIClient(
customer_id="your_customer_id",
system_id="your_system_id",
firebase_token="your_firebase_id_token",
firebase_refresh_token="your_refresh_token",
) as client:
# Token is automatically included in Authorization header
info = await client.get_customer_and_system()
Main client for interacting with Oasira APIs.
client = OasiraAPIClient(
customer_id="...", # Optional: Customer ID
system_id="...", # Optional: System ID
customer_psk="...", # Optional: Customer PSK token
system_psk="...", # Optional: System PSK token
session=None # Optional: Reuse existing aiohttp session
)
get_customer_and_system() - Get customer and system informationauthenticate_with_firebase(email, password, api_key) - Authenticate using Firebase email/passwordrefresh_firebase_token(api_key) - Refresh Firebase ID token using refresh tokenget_firebase_user_info() - Get Firebase user information using current tokenupdate_credentials(customer_id, system_id, customer_psk, system_psk, firebase_token, firebase_refresh_token) - Update API credentialscreate_security_alarm(alarm_data) - Create a security alarmcreate_monitoring_alarm(alarm_data) - Create a monitoring alarmcreate_medical_alarm(alarm_data) - Create a medical alert alarmcreate_event(alarm_id, event_data) - Create a security eventcreate_alert(alert_data) - Create a security alertget_alarm_status(alarm_id) - Get current alarm statuscancel_alarm(alarm_id) - Cancel an active alarmconfirm_pending_alarm() - Confirm a pending alarmupdate_credentials(customer_id, system_id, customer_psk, system_psk) - Update API credentialsfrom oasira import OasiraAPIClient, OasiraAPIError
try:
async with OasiraAPIClient(...) as client:
### Example Integration Usage
```python
"""Platform for Oasira integration."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from oasira import OasiraAPIClient, OasiraAPIError
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up from a config entry."""
# Option 1: PSK authentication
client = OasiraAPIClient(
customer_id=entry.data["customer_id"],
system_id=entry.data["system_id"],
customer_psk=entry.data["customer_psk"],
system_psk=entry.data["system_psk"],
session=hass.helpers.aiohttp_client.async_get_clientsession()
)
# Option 2: Firebase OAuth authentication
# client = OasiraAPIClient(
# customer_id=entry.data["customer_id"],
# system_id=entry.data["system_id"],
# firebase_token=entry.data["firebase_token"],
# firebase_refresh_token=entry.data["firebase_refresh_token"],
# session=hass.helpers.aiohttp_client.async_get_clientsession()
# )
"""Platform for Oasira integration."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from oasira import OasiraAPIClient, OasiraAPIError
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up from a config entry."""
client = OasiraAPIClient(
customer_id=entry.data["customer_id"],
system_id=entry.data["system_id"],
customer_psk=entry.data["customer_psk"],
system_psk=entry.data["system_psk"],
session=hass.helpers.aiohttp_client.async_get_clientsession()
)
# Verify credentials
try:
await client.get_customer_and_system()
except OasiraAPIError as err:
_LOGGER.error("Failed to authenticate: %s", err)
return False
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = client
return True
"""DataUpdateCoordinator for Oasira."""
from datetime import timedelta
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from oasira import OasiraAPIClient, OasiraAPIError
class OasiraCoordinator(DataUpdateCoordinator):
"""Class to manage fetching Oasira data."""
def __init__(self, hass: HomeAssistant, client: OasiraAPIClient) -> None:
"""Initialize coordinator."""
super().__init__(
hass,
logger=_LOGGER,
name="Oasira",
update_interval=timedelta(seconds=30),
)
self.client = client
async def _async_update_data(self):
"""Fetch data from API."""
try:
return await self.client.get_customer_and_system()
except OasiraAPIError as err:
raise UpdateFailed(f"Error communicating with API: {err}") from err
# Clone the repository
git clone https://github.com/yourusername/oasira.git
cd oasira
# Install development dependencies
pip install -e ".[dev]"
pytest
pytest --cov=oasira # With coverage
# Format code
black oasira tests
# Sort imports
isort oasira tests
# Type checking
mypy oasira
# Linting
pylint oasira
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For issues and questions, please use the GitHub issue tracker.
FAQs
Python API client for Oasira with Firebase OAuth support, designed for Home Assistant integrations
We found that oasira demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.