Coder Social home page Coder Social logo

mrhs's Introduction

mrhs

  • Monitoring Running Hangout Status
  • M5Stack + MQTT

mrhs agent

  • deploy
$ go build -o path/to/mrhsagent agent.go
$ sudo ln -s path/to/mrhsagent /usr/local/bin/mrhsagent
$ sudo ln -s path/to/mrhs.service /lib/systemd/system/mrhs.service
$ sudo ln -s path/to/calendar.json /etc/mrhs/calendar.json
$ sudo ln -s path/to/adafruit.json /etc/mrhs/adafruit.json
$ sudo ln -s path/to/credential.json /etc/mrhs/credential.json
$ sudo systemctl restart mrhs.service
  • calendar.json
    • set calendar id to be monitored
$ cat calendar.json
{
  "calendar_id": "[email protected]"
}
  • .adafruilt.json
    • set information to use Adafruit IO
$ cat adafruit.json
{
  "username": "xxx",
  "key": "yyy",
  "feed": "zzz"
}
  • credential.json
    • put a file to be served for google service account

mrhs client

$ open client/client.ino

mrhs cli(deprecated)

  • Update username and key on script/.mrhs.json
  • Set up cron at an appropriate frequency
# Every minute
*   * * * * ${path/to/mrhs_agent}/mrhs_cli.sh

# Every 5minutes
*/5 * * * * ${path/to/mrhs_agent}/mrhs_cli.sh

Notes

MQTT broker

MQTT client

  • Using MQTT.fx
  • Download and install it
  • Open the app and add a connection
    • Profile Name: mrhs
    • Profile Type: MQTT Broker
    • Broker Address: io.adafruit.com
    • Broker Port: 8883
    • Client ID: MQTT_FX_Client
      • Anything is ok
      • Do Generate is also good
    • User Credentials
      • User Name: [Username] of adafruit
      • Password: [Active Key] of adafruit
        • Can get from Afafruit IO Key screen
    • SSL/TLS
      • Check Enable SSL/TLS
      • Protocol: TLSv1.2
  • Connect
  • Publish
    • Input topic: [Username]/feeds/mrhs
    • Input any string and push Publish
  • Subscribe
    • Input topic: [Username]/feeds/mrhs
    • Push Subscribe

M5Stack

Adafruit_MQTT

  • Sketch -> Include Library -> Manage Libraries
    • Adafruit MQTT Library (vresion was 1.3.0 when I did)

mosquitto

$ /usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf
1600654250: mosquitto version 1.6.12 starting
1600654250: Config loaded from /usr/local/etc/mosquitto/mosquitto.conf.
1600654250: Opening ipv6 listen socket on port 1883.
1600654250: Opening ipv4 listen socket on port 1883.
1600654250: mosquitto version 1.6.12 running
1600654260: New connection from ::1 on port 1883.
1600654260: New client connected from ::1 as SUB (p2, c1, k60).
1600654278: New connection from ::1 on port 1883.
1600654278: New client connected from ::1 as PUB (p2, c1, k60).
1600654278: Client PUB disconnected.
1600654282: Client SUB disconnected.
^C1600654290: mosquitto version 1.6.12 terminating
$ mosquitto_sub -t test -i SUB
Hello
$ mosquitto_pub -t test -m Hello -i PUB
$ mosquitto_sub -d -h test.mosquitto.org -p 8883 -t "#" --tls-version tlsv1.2 --cafile mosquitto.org.crt
$ mosquitto_sub -d -h io.adafruit.com -p 1883 -t ${username}/feeds/mrhs -u ${username} -P ${key}
$ mosquitto_pub -d -h io.adafruit.com -p 1883 -t ${username}/feeds/mrhs -u ${username} -P ${key} -m 1
$ mosquitto_pub -L mqtt://${username}:${key}@io.adafruit.com/${username}/feeds/mrhs -s
$ mosquitto_sub -d -h io.adafruit.com -p 8883 -t ${username}/feeds/mrhs -u ${username} -P ${key} --tls-version tlsv1.2 --cafile /etc/ssl/cert.pem

References

mrhs's People

Contributors

8mamo10 avatar

Watchers

 avatar James Cloos avatar

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.