Skip to content

Instantly share code, notes, and snippets.

View splatch's full-sized avatar

Łukasz Dywicki splatch

View GitHub Profile
Bridge mqtt:broker:myInsecureBroker [ host="192.168.0.42", secure=false ]
Thing mqtt:topic:mything "mything" (mqtt:broker:myInsecureBroker) {
Channels:
Type switch : lamp "Kitchen Lamp" [ stateTopic="lamp/enabled", commandTopic="lamp/enabled/set" ]
Type switch : fancylamp "Fancy Lamp" [ stateTopic="fancy/lamp/state", commandTopic="fancy/lamp/command", on="i-am-on", off="i-am-off" ]
Type string : alarmpanel "Alarm system" [ stateTopic="alarm/panel/state", commandTopic="alarm/panel/set", allowedStates="ARMED_HOME,ARMED_AWAY,UNARMED" ]
Type color : lampcolor "Kitchen Lamp color" [ stateTopic="lamp/color", commandTopic="lamp/color/set", colorMode="RGB" ]
Type dimmer : blind "Blind" [ stateTopic="blind/state", commandTopic="blind/set", min=0, max=5, step=1 ]
}
<Things>
<things>
<things>
<kind>Thing</kind>
<UID>mqtt:topic:mything</UID>
<bridgeUID>mqtt:broker:myInsecureBroker</bridgeUID>
<label>mything</label>
<channels>
<id>lamp</id>
<type>switch</type>
things:
- kind: Bridge
thingTypeUID: mqtt:broker
id: myInsecureBroker
configuration:
host: "192.168.0.42"
secure: false
- kind: Thing
UID: mqtt:topic:mything
@splatch
splatch / page_overview.hbs
Created December 31, 2023 11:21
Example teamplate of overview page for openHAB made with handlebars.
basic: true
configurationPid: "cloud.connectorio.gateway.manaco.view.overview"
--
uid: overview
#tags: []
#props: []
component: oh-tabs-page
config:
visibleTo:
- role:administrator
2023-01-26T23:43:08.711Z INFO 1 --- [ault-executor-0] o.o.m.grpc.twin.AbstractTwinPublisher : Registered a session with key SessionKey{location='Default'}
2023-01-26T23:43:08.712Z INFO 1 --- [ault-executor-0] o.o.m.grpc.twin.AbstractTwinPublisher : Published an object update for the session with key SessionKey{location='Default'}
2023-01-26T23:43:11.879Z INFO 1 --- [ault-executor-0] o.o.m.grpc.twin.AbstractTwinPublisher : Registered a session with key SessionKey{location='Default1'}
2023-01-26T23:43:11.879Z INFO 1 --- [ault-executor-0] o.o.m.grpc.twin.AbstractTwinPublisher : Published an object update for the session with key SessionKey{location='Default1'}
2023-01-26T23:43:14.384Z INFO 1 --- [ault-executor-0] o.o.m.grpc.twin.AbstractTwinPublisher : Registered a session with key SessionKey{location='Default2'}
2023-01-26T23:43:14.384Z INFO 1 --- [ault-executor-0] o.o.m.grpc.twin.AbstractTwinPublisher : Published an object update for the session with key SessionKey{location='Default2'}
@splatch
splatch / gist:88dc8c9d3338c815c03ae145d3bb9c24
Created June 1, 2022 10:10
OData feed definition for Excel
# If you ever come to that point - official power query docs are not very clear
# on how to append custom headers or query options, here is how
= OData.Feed("https://....", null, [
Implementation="2.0",
Headers=[#"X-API-Token"="xyz",#"X-xyz"="zyx"],
Query=[#"timeZone"="UTC",#"another"="abc"]
])
@splatch
splatch / Main.java
Created April 19, 2021 17:30
Profinet DCP interaction based on experimental protocol implementation for Apache PLC4X.
import org.apache.plc4x.java.PlcDriverManager;
import org.apache.plc4x.java.api.PlcConnection;
import org.apache.plc4x.java.api.messages.PlcSubscriptionEvent;
import org.apache.plc4x.java.utils.rawsockets.netty.RawSocketChannel;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
// Very simple example showing how to request profinet-dcp identification.
// Answers in line 23 are returned as PlcStruct (which is a map), for example:
@splatch
splatch / modbus.items
Created December 27, 2020 15:49
openHAB configuration for ineprometering PRO380-mod three phase meter.
String PRO380_ModbusId "Pro 380 Modbus id" { channel="modbus:data:pro380:metadata:serialNumber:number" }
Number PRO380_Voltage_L1 "Pro 380 L1 Voltage [%.2f]" { channel="modbus:data:pro380:voltage:L1:number" }
Number PRO380_Voltage_L2 "Pro 380 L2 Voltage [%.2f]" { channel="modbus:data:pro380:voltage:L2:number" }
Number PRO380_Voltage_L3 "Pro 380 L3 Voltage [%.2f]" { channel="modbus:data:pro380:voltage:L3:number" }
Number PRO380_Current_L1 "Pro 380 L1 Current [%.2f]" { channel="modbus:data:pro380:current:L1:number" }
Number PRO380_Current_L2 "Pro 380 L2 Current [%.2f]" { channel="modbus:data:pro380:current:L2:number" }
Number PRO380_Current_L3 "Pro 380 L3 Current [%.2f]" { channel="modbus:data:pro380:current:L3:number" }
@splatch
splatch / pom.xml
Created November 19, 2020 16:26
Fragment of maven plugin configuration to get jaxrs stubs out of openapi generator plugin.
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.3.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
@splatch
splatch / brick.csv
Created November 15, 2020 01:01
Example semantics tags input for OH scripts derivered from brickschema
We can't make this file beautiful and searchable because it's too large.
Type,Tag,Parent,Label,Synonyms,Description
Location,Location,,,Location,
Location,Storey,Location,,Storey,
Location,Space,Location,,Space,"A part of the physical world or a virtual world whose 3D spatial extent is bounded actually or theoretically, and provides for certain functions within the zone it is contained in."
Location,Room,Space,,Room,"Base class for all more specific room types."
Location,Laboratory,Room,,Laboratory,"facility acceptable to the local, national, or international recognized authority having jurisdiction and which provides uniform testing and examination procedures and standards for meeting design, manufacturing, and factory testing requirements."
Location,Hot Box,,,Hot Box,"hot air chamber forming part of an air handler."
Location,Freezer,Laboratory,,Freezer,"cold chamber usually kept at a temperature of 22°F to 31°F (–5°C to –1°C), with high-volume air circulation."
Location,Environment Box,,,Environment Box,"(also known as climatic chamber), enclosed space designed to create a parti