iammatthew2 / doorbellReceiver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

doorbellSender

This app is the receiver part of doorbellSender. These are a pair of apps used to trigger an event emitted from one raspberry pi to another without regards for what network they are running on. Azure IoT hub is the connection point for both apps. There are simpler options, namely running an Express Server - but the approach taken here does not require an exposed port and is provides a chance to play with Azure.

doorbellReceiver is roughly written in Typescript running on Node.js.

What does it do

doorbellReceiver relies on Azure Hub direct method invocation to trigger a set of chime sounds. A set of chron jobs mute the bell in the evening and un-mute the bell in the morning. The app is configured for two different bell trigger. See constants/requests for all api options.

How to use doorbellReceiver

  • Add two configs to as environmental variables - dotenv makes this easy:

    • AZURE_IOT_CONNECTION_STRING - see Azure docs for setup. This could use more documentation here
    • INSTRUMENTATION_KEY - see Azure docs for setup. This could use more documentation here
  • $ npm install

  • $ npm start

How do you run this at startup

Add this to /etc/rc.local: su pi -c 'npm start --prefix ~/<pathToTheApp>/doorbellReceiver/'

About


Languages

Language:TypeScript 100.0%