Skip to content

Instantly share code, notes, and snippets.

View ashvayka's full-sized avatar

Andrew Shvayka ashvayka

View GitHub Profile
@ashvayka
ashvayka / tb-action-button-states-dashboard.json
Created February 21, 2024 16:11
ThingsBoard dashboard with 4 states to showcase Action Button widget
{
"title": "Buttons",
"image": null,
"mobileHide": false,
"mobileOrder": null,
"configuration": {
"description": "",
"widgets": {
"1061b1b7-240e-ef27-37a2-d2a823149b63": {
"typeFullFqn": "system.action_button",
@ashvayka
ashvayka / main.py
Created May 8, 2023 09:49
Sample application for single board computers to connect to ThingsBoard IoT platform
import logging.handlers
import time
import os
from tb_gateway_mqtt import TBDeviceMqttClient
logging.basicConfig(level=logging.DEBUG)
client = None
@ashvayka
ashvayka / lwm2m_operations.json
Created March 2, 2023 11:35
Simple LwM2M dashboard
{
"title": "LwM2M Operations",
"image": null,
"mobileHide": false,
"mobileOrder": null,
"configuration": {
"description": "",
"widgets": {
"38246cc5-3c7c-633a-9240-78895978e4ae": {
"isSystemType": true,
@ashvayka
ashvayka / asset-profile-switch-example.json
Last active February 9, 2023 14:56
Rule Chain examples for Rule Node documentation
{
"ruleChain": {
"additionalInfo": {
"description": ""
},
"name": "Asset profile switch example",
"type": "CORE",
"firstRuleNodeId": null,
"root": false,
"debugMode": false,
@ashvayka
ashvayka / thermostat.js
Last active April 28, 2022 09:34
Thermostat emulator
var mqtt = require('mqtt');
var args = process.argv.slice(2);
var token = args[0];
var client = mqtt.connect('mqtt://demo.thingsboard.io', {
username: token
});
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the Apache 2.0 license; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the Apache 2.0 license; or
@ashvayka
ashvayka / new_map_widget.json
Created February 10, 2017 11:07
Map widget for the Bus tracking Thingsboard demo
{
"widget": {
"isSystemType": true,
"bundleAlias": "maps",
"typeAlias": "route_map",
"type": "timeseries",
"title": "New widget",
"sizeX": 28,
"sizeY": 10,
"config": {
@ashvayka
ashvayka / copy-ami.sh
Last active October 11, 2020 00:34
Copy Thingsboard AWS AMIs to all regions
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: copy-ami.sh AMI_ID"
return 1
fi
SRC_REGION=us-east-1
SRC_AMI=$1
NEW_AMI_NAME="Thingsboard 1.2.2 AMI for micro instances"
@ashvayka
ashvayka / attributes-demo.js
Last active August 25, 2022 21:17
Thingsboard Attributes API demo application
// Requires node.js and mqtt library installed.
var mqtt = require('mqtt');
var os = require("os");
const thingsboardHost = "demo.thingsboard.io";
// Reads the access token from arguments
const accessToken = process.argv[2];
// Default topics. See http://thingsboard.io/docs/reference/mqtt-api/ for more details.
const attributesTopic = 'v1/devices/me/attributes';
@ashvayka
ashvayka / emulator.js
Created December 28, 2016 17:19
Temperature and Humidity emulator for Thingsboard tutorials
//Requires node.js and mqtt library installed.
var mqtt = require('mqtt');
const thingsboardHost = "demo.thingsboard.io";
// Reads the access token from arguments
const accessToken = process.argv[2];
const minTemperature = 17.5, maxTemperature = 30, minHumidity = 12, maxHumidity = 90;
// Initialization of temperature and humidity data with random values
var data = {