MQTTtimer is based mqtt protocol sync timer

MQTTTimer is based mqtt protocol sync timer.

You can used ntp sync time protocol in IoT without ntp server. used mqtt protocol sync time is tcp connnections, and based mqtt protocol, so don't need a ntp server. and direct embed mqtt server side.

exmaples

Import

import timer "github.com/hysios/MQTTtimer"

Client Mode

	var (
		opts     = mqtt.NewClientOptions().AddBroker(addr)
		mqClient = mqtt.NewClient(opts)
	)

	opts.SetOnConnectHandler(func(c mqtt.Client) {
		log.Infof("connected")
	})

	if token := mqClient.Connect(); token.Wait() && token.Error() != nil {
		time.Sleep(5 * time.Second)
		panic(token.Error())
	}

	log.Printf("connect %s", addr)
	client := timer.NewTimer(mqClient)
	client.Sync()

Server Mode

	var (
		opts     = mqtt.NewClientOptions().AddBroker(addr)
		mqClient = mqtt.NewClient(opts)
	)
	opts.SetOnConnectHandler(func(c mqtt.Client) {
		log.Infof("connected")
	})

	if token := mqClient.Connect(); token.Wait() && token.Error() != nil {
		time.Sleep(5 * time.Second)
		panic(token.Error())
	}
	s := timer.NewServe(mqClient)
	log.Printf("startup mntp server connect %s", addr)
	s.Start()
Similar Resources

Send IR command through MQTT

Introduction This program can be used in two different modes: Either it is waiting for an id button on a MQTT topic and execute the corresponding LIRC

Nov 9, 2022

Simple BLE to MQTT gateway

BLE_to_MQTT_gw Simple BLE to MQTT gateway This app will scan for the Eddystone BLE advertisement packets from my ESP32 BLE sensor, and forward tempera

Dec 29, 2021

Smq - Simple MQTT Broker with golang

Simple MQTT Broker 关于 Golang MQTT Broker, Version 3.1.1, and Compatible for ecli

Jul 7, 2022

Courier Golang client library provides an opinionated wrapper over paho MQTT library to add features on top of it

Courier Golang Client Library Introduction Courier Golang client library provides an opinionated wrapper over paho MQTT library to add features on top

Nov 19, 2022

A project outputs Bluetooth Low Energy (BLE) sensors data in InfluxDB line protocol formatA project outputs Bluetooth Low Energy (BLE) sensors data in InfluxDB line protocol format

Intro This project outputs Bluetooth Low Energy (BLE) sensors data in InfluxDB line protocol format. It integrates nicely with the Telegraf execd inpu

Apr 15, 2022

🦖 Streaming-Serverless Framework for Low-latency Edge Computing applications, running atop QUIC protocol, engaging 5G technology.

🦖 Streaming-Serverless Framework for Low-latency Edge Computing applications, running atop QUIC protocol, engaging 5G technology.

YoMo YoMo is an open-source Streaming Serverless Framework for building Low-latency Edge Computing applications. Built atop QUIC Transport Protocol an

Dec 29, 2022

MAVLink protocol implementation for Go

#go-mavlink go impletation of the MAVLink protocol. MAVLink or Micro Air Vehicle Link is a protocol for communicating with small unmanned vehicle. It'

Aug 19, 2020

Task Timer (tt) is a dead simple TUI task timer

Task Timer (tt) is a dead simple TUI task timer

tasktimer Task Timer (tt) is a dead simple TUI task timer Usage To get started, just run tt: tt You'll be presented with something like this: You can

Dec 21, 2022

Gmqtt is a flexible, high-performance MQTT broker library that fully implements the MQTT protocol V3.1.1 and V5 in golang

中文文档 Gmqtt News: MQTT V5 is now supported. But due to those new features in v5, there area lots of breaking changes. If you have any migration problem

Jan 5, 2023

Vallox RS-485 MQTT gateway to integrate Vallox RS485 ventilation device to Home Assistant via MQTT.

Vallox RS-485 MQTT gateway to integrate Vallox RS485 ventilation device to Home Assistant via MQTT.

Vallox RS-485 MQTT gateway to integrate Vallox RS485 ventilation device to Home Assistant via MQTT. Implements Home Assistant MQTT discovery but can also be used without Home Assistant.

Dec 26, 2021

Sensirion SCD30 CO2 sensor MQTT gateway with Home Assistant MQTT discovery

Sensirion SCD30 CO2 sensor MQTT gateway for Home Assistant Overview This gateway can be used to publish measurements SCD30 to mqtt. It supports Home A

Oct 10, 2022

Lg-ess-mqtt - MQTT Firmware Extension for 1st generation LG ESS BESS

lg-ess-mqtt This projects is a firmware extension for the 1st generation LG ESS

Oct 19, 2022

Focus is a fully featured productivity timer for the command line, based on the Pomodoro Technique. Supports Linux, Windows, and macOS.

Focus is a fully featured productivity timer for the command line, based on the Pomodoro Technique. Supports Linux, Windows, and macOS.

Focus is a cross-platform productivity timer for the command line. It is based on the Pomodoro Technique, a time management method developed by Francesco Cirillo in the late 1980s.

Dec 26, 2022

grafana-sync Keep your grafana dashboards in sync.

grafana-sync Keep your grafana dashboards in sync. Table of Contents grafana-sync Table of Contents Installing Getting Started Pull Save all dashboard

Dec 14, 2022

Minimalistic, pluggable Golang evloop/timer handler with dependency-injection

Anagent Minimalistic, pluggable Golang evloop/timer handler with dependency-injection - based on codegangsta/inject - go-macaron/inject and chuckpresl

Sep 27, 2022

Terminal countdown timer

Terminal countdown timer

Countdown Usage Specify duration in go format 1h2m3s. countdown 25s Add command with && to run after countdown. countdown 1m30s && say "Hello, world"

Dec 31, 2022

This app can extend developer mode timer for the LG TV (you'll need the session token for that)

LG WebOS Developer Mode Extender This app can extend developer mode timer for the LG TV (you'll need the session token for that) You can obtain the de

Dec 17, 2021

Dwarka - API gateway offers REST API to manage various device controlled using MQTT protocol

dwarka API gateway offers REST API to manage various device controlled using 'MQ

Sep 16, 2022

handle multiple mqtt server/cluster based on paho client

pakhshi Introduction Consider you have an array of brokers but you want to publish and subscribe on all of them at the same time. Why you may need thi

Nov 9, 2022
Sensirion SCD30 CO2 sensor MQTT gateway with Home Assistant MQTT discovery

Sensirion SCD30 CO2 sensor MQTT gateway for Home Assistant Overview This gateway can be used to publish measurements SCD30 to mqtt. It supports Home A

Oct 10, 2022
Lg-ess-mqtt - MQTT Firmware Extension for 1st generation LG ESS BESS

lg-ess-mqtt This projects is a firmware extension for the 1st generation LG ESS

Oct 19, 2022
Dwarka - API gateway offers REST API to manage various device controlled using MQTT protocol

dwarka API gateway offers REST API to manage various device controlled using 'MQ

Sep 16, 2022
handle multiple mqtt server/cluster based on paho client

pakhshi Introduction Consider you have an array of brokers but you want to publish and subscribe on all of them at the same time. Why you may need thi

Nov 9, 2022
Hermes is a tiny MQTT compatible broker written in Go.

Hermes Hermes is a tiny MQTT compatible broker written in Go. The goals of the project are as below Easy to compile, and run Tiny footprint Extensible

Sep 9, 2022
IP Camera Alarm Server to MQTT

IP Camera Alarm Server Universal Alarm Server for all your IP cameras in one place! Integrates well with Home Assistant, Node-Red, etc. Runs great on

Dec 8, 2022
Generic Prometheus ⟷ MQTT Bridge

Promqtt: Prometheus ⟷ MQTT Bridge Promqtt makes Prometheus MQTT capable in a truly generic way. It has no assumptions on message payloads or topic lay

Sep 18, 2022
An embeddable lightweight Go/Golang MQTT broker(server) for IoT.
An embeddable lightweight Go/Golang MQTT broker(server) for IoT.

Snple MQTT 简体中文 Note: The API of this library is still unstable and has not been sufficiently tested, please do not use it in production environments.

Sep 12, 2022
mqtt-rewriter is a tool that can forward data from a topic to another topic.

mqtt-rewriter Background mqtt-rewriter is a tool that can forward data from a topic to another topic. Install Todo... Usage Currently only supports tw

Feb 18, 2022
A robust and easy to use MQTT rule engine
A robust and easy to use MQTT rule engine

⚙ MQTT COMMANDER A robust and easy to use MQTT rule engine Configure your MQTT Rules via easy to use YML Files Supports JSON encoded MQTT Messages Sup

Sep 21, 2022