view service/mqtt_to_rdf/conf/frontdoorlock.n3 @ 1754:92999dfbf321 default tip

add shelly support
author drewp@bigasterisk.com
date Tue, 04 Jun 2024 13:03:43 -0700
parents 5871ef3a380e
children
line wrap: on
line source

@prefix : <http://projects.bigasterisk.com/room/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fr: <http://bigasterisk.com/foaf/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:mqttConnectedStatusMap a :ValueMap;
   :map [:from "offline"; :to :Offline], 
        [:from "online"; :to :Online] .

:frontDoorLockStatus a :MqttStatementSource;
  :mqttTopic ("frontdoorlock" "status");

  :parser :mqttConnectedStatusMap;

  :graphStatements [
    :outputPredicate :connectedStatus
  ]
  
  .

{ ?msg :body "online" . } => { ?msg :onlineTerm :Online . } .
{ ?msg :body "offline" . } => { ?msg :onlineTerm :Offline . } .


{
  ?msg a :MqttMessage ;
     :topic ( "frontdoorlock" "status" );
     :onlineTerm ?onlinenessStr . } => {
  :frontDoorLockStatus :connectedStatus ?onlineness .
} .