This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Datacake - Milesight UC300 Cellular Decoder for 1NCE OS | |
| // (c) 2024 Simon Kemper | |
| // Works for all analog and digital inputs and output, not yet for: | |
| // - RS232 | |
| // - Modbus | |
| // Note for RS232 and Modbus: If you need those, ask us ... | |
| /* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import json | |
| class DatacakeGraphQlClient: | |
| def __init__(self, url, token): | |
| self.url = url | |
| self.headers = {"Content-Type": "application/json", "Authorization": f"Token {token}"} | |
| def run(self, query, variables=None): | |
| data = {"query": query, "variables": variables} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import plotly.express as px | |
| import streamlit as st | |
| import requests | |
| import pandas as pd | |
| import json | |
| import time | |
| # URL deines GraphQL-Endpunkts | |
| url = 'https://api.datacake.co/graphql/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Decoder(request) { | |
| var payload = JSON.parse(request.body); | |
| var device = payload.serial_number; | |
| var readings = []; | |
| for (var field in payload) { | |
| if (field !== "serial_number") { | |
| readings.push({ | |
| field: field, | |
| value: payload[field], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{"id":"dc44d96a.e622a8","type":"http request","z":"7ead4a25.118974","name":"","method":"POST","ret":"txt","paytoqs":false,"url":"https://api.datacake.co/integrations/api/3701c2b6-1c74-4d0a-95e1-8ce6a49493dd/","tls":"abfd8aeb.337298","persist":false,"proxy":"","authType":"","x":590,"y":120,"wires":[["da293a28.815628"]]},{"id":"da293a28.815628","type":"debug","z":"7ead4a25.118974","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":120,"wires":[]},{"id":"916a2d32.c8ae4","type":"function","z":"7ead4a25.118974","name":"","func":"data = {\n \"serial_number\": \"ABC123\",\n \"temperature\": 56.5,\n \"humidity\": 53.2,\n \"pressure\": 4513.25,\n \"acceleration_x\": 0.12,\n \"acceleration_y\": -0.23,\n \"acceleration_z\": 1.01,\n \"magnetic_field_x\": 0.85,\n \"magnetic_field_y\": -0.92,\n \"magnetic_field_z\": 0.12,\n \"gyroscope_x\": -0.02,\n \"gyroscope_y\": 4.3,\n \"gyroscope_z\": -0.08,\n \"uv_index\": 5.2,\n \"amb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{"id":"72ef688a.928ce8","type":"function","z":"3bbe52a3.6ecd96","name":"GraphQL Call","func":"// Datacake API Token and Workspace\nvar token = \"123456mytoken123456\";\nvar workspace = \"1234myworkspace1234\";\n\n// GraphQL API URL\nmsg.url = \"https://api.datacake.co/graphql\";\n\n// GraphQL Header\nmsg.headers = {\n \"Authorization\": \"Token \"+token,\n \"Content-Type\": \"application/json\"\n};\n\n// GraphQL Query\nvar query = `query {\n allDevices(inWorkspace:${workspace}) {\n id\n serialNumber\n verboseName\n currentMeasurements(allActiveFields: true) {\n field {\n fieldName\n verboseFieldName\n }\n value\n }\n }\n}`;\n\nmsg.payload = {\"query\": query};\nmsg.body = {\"query\": query};\n\nreturn msg;\n","outputs":1,"noerr":0,"x":340,"y":260,"wires":[["37ecf05e.a3995"]]},{"id":"37ecf05e.a3995","type":"http request","z":"3bbe52a3.6ecd96","name":"","method":"GET","ret":"obj","paytoqs":true,"url":"","tls":"36a29eca.14f2f2","persist":false,"proxy":"","auth |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Decoder(request) { | |
| var data = JSON.parse(request.body); | |
| var device = data.device; | |
| var file = data.file; | |
| var decoded = {}; | |
| if (file === "locations.qos") { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Project AirWatch2 | |
| * Description: | |
| * Author: | |
| * Date: | |
| */ | |
| #include "Particle.h" | |
| #include "neopixel.h" | |
| #include "Serial4/Serial4.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| HOST = "192.168.178.50" | |
| PORT = 4223 | |
| UID = "Bdp" # Change XYZ to the UID of your Industrial Digital Out 4 Bricklet | |
| import time | |
| from tinkerforge.ip_connection import IPConnection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| HOST = "192.168.178.50" | |
| PORT = 4223 | |
| UID = "Bdp" # Change XYZ to the UID of your Industrial Digital Out 4 Bricklet | |
| import time | |
| from tinkerforge.ip_connection import IPConnection |
NewerOlder