Code Monkey home page Code Monkey logo

mqtt_spaceapi's Introduction

mqtt_spaceAPI

MQTT to SpaceAPI bridge. This script is used to connect the internal (or home user) MQTT broker with the public spaceAPI, updating the sensors spacestate and annexes (branch location) states.

setup

Assuming python3 is installed and the system is debian-alike;

  • install git, pip and paho-mqtt:
    • sudo apt install git python3-pip
    • pip3 install paho-mqtt
  • clone this repo locally:
  • Copy over systemd service file (edit Environment variables, User and ExecStart path) and enable the service
    • sudo cp mqtt_spaceapi.service /etc/systemd/system/
    • sudo systemctl enable mqtt_spaceapi.service
  • optionally modify mqtt_spaceapi.py and change "Custom annex topic" mqtt_sensor_topics and mqtt_spacestate_topic
  • run the script inside a screen/tmux (or nohup) session (change BROKER, API_KEY and ANNEX accordingly):
    • BROKER=192.168.1.42 API_KEY=ABC ANNEX="@xopr's" USER=ackspace PASS=ackspace ./mqtt_spaceapi.py

Note that the values can also be set as environment variables.

Mandatory variables:

  • BROKER: IP or FQDN/hostname of MQTT (mosquitto) broker/server
  • API_KEY: The ACKspace API key for updating the spaceAPI

Optional variables:

  • ANNEX: name of an annex location, for example @xopr's: omit completely to update the actual spacestate
  • DEBUG: enable debug data on both client and spaceAPI server
  • USER: MQTT username, ackspace for read-only access
  • PASS: MQTT password, ackspace for read-only access

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.