Project Awesome project awesome

Smart Home Integration Software > shopsavvy-mqtt

MQTT bridge that publishes product price data with Home Assistant MQTT discovery support.

Package GitHub

shopsavvy-mqtt

MQTT bridge for ShopSavvy price data. Publishes real-time product prices to MQTT topics, with optional Home Assistant auto-discovery support.

Features

  • Connects to any MQTT broker (Mosquitto, HiveMQ, EMQX, etc.)
  • Publishes to structured topics: shopsavvy/products/{id}/price, /retailer, /availability, etc.
  • Full JSON payload on shopsavvy/products/{id}/json for detailed data
  • Configurable QoS, retain, and poll interval
  • Home Assistant MQTT discovery support for automatic sensor creation
  • Uses the official @shopsavvy/sdk

Quick Start

# Install dependencies
bun install

# Set your API key (get one at https://shopsavvy.com/data)
export SHOPSAVVY_API_KEY=ss_live_your_key_here

# Configure MQTT and products
export MQTT_BROKER_URL=mqtt://localhost:1883
export PRODUCT_IDS="B09XS7JWHH,012345678901"

# Start the bridge
bun run start

MQTT Topics

For each monitored product, the bridge publishes to:

Topic Payload Description
shopsavvy/products/{id}/price 79.99 Lowest current price
shopsavvy/products/{id}/currency USD Price currency
shopsavvy/products/{id}/retailer Amazon Retailer with lowest price
shopsavvy/products/{id}/availability in_stock Product availability
shopsavvy/products/{id}/offer_count 12 Number of offers found
shopsavvy/products/{id}/title Product Name Product title
shopsavvy/products/{id}/url https://... Link to best offer
shopsavvy/products/{id}/json {...} Full JSON payload
shopsavvy/products/{id}/timestamp 2026-01-15T12:00:00Z Last update time
shopsavvy/status {...} Bridge status summary

Configuration

Variable Default Description
SHOPSAVVY_API_KEY (required) Your ShopSavvy API key
MQTT_BROKER_URL (required) MQTT broker URL (e.g., mqtt://localhost:1883)
PRODUCT_IDS (required) Comma-separated product identifiers
MQTT_USERNAME (none) MQTT username
MQTT_PASSWORD (none) MQTT password
MQTT_CLIENT_ID auto-generated MQTT client identifier
MQTT_TOPIC_PREFIX shopsavvy Topic prefix
MQTT_QOS 1 MQTT QoS level (0, 1, or 2)
MQTT_RETAIN true Retain messages on broker
POLL_INTERVAL_SECONDS 300 Poll interval in seconds
HA_DISCOVERY false Enable Home Assistant MQTT discovery
HA_DISCOVERY_PREFIX homeassistant Home Assistant discovery topic prefix

Home Assistant Integration

Enable automatic sensor discovery:

export HA_DISCOVERY=true
export HA_DISCOVERY_PREFIX=homeassistant

This publishes discovery configs so Home Assistant automatically creates sensor entities for each monitored product's price, retailer, and availability.

Docker

FROM oven/bun:1
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --production
COPY src/ src/
ENV SHOPSAVVY_API_KEY=ss_live_your_key_here
ENV MQTT_BROKER_URL=mqtt://mosquitto:1883
ENV PRODUCT_IDS=B09XS7JWHH
CMD ["bun", "run", "src/bridge.ts"]

License

MIT

Back to MQTT