shopsavvy-mqtt

April 3, 2026 ยท View on GitHub

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:

TopicPayloadDescription
shopsavvy/products/{id}/price79.99Lowest current price
shopsavvy/products/{id}/currencyUSDPrice currency
shopsavvy/products/{id}/retailerAmazonRetailer with lowest price
shopsavvy/products/{id}/availabilityin_stockProduct availability
shopsavvy/products/{id}/offer_count12Number of offers found
shopsavvy/products/{id}/titleProduct NameProduct title
shopsavvy/products/{id}/urlhttps://...Link to best offer
shopsavvy/products/{id}/json{...}Full JSON payload
shopsavvy/products/{id}/timestamp2026-01-15T12:00:00ZLast update time
shopsavvy/status{...}Bridge status summary

Configuration

VariableDefaultDescription
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_IDauto-generatedMQTT client identifier
MQTT_TOPIC_PREFIXshopsavvyTopic prefix
MQTT_QOS1MQTT QoS level (0, 1, or 2)
MQTT_RETAINtrueRetain messages on broker
POLL_INTERVAL_SECONDS300Poll interval in seconds
HA_DISCOVERYfalseEnable Home Assistant MQTT discovery
HA_DISCOVERY_PREFIXhomeassistantHome 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