#------------------------------------------------------------------------------ # CYBUS SERVICE COMMISSIONING #------------------------------------------------------------------------------ description: | Service Commissioning File Example Cybus Learn - Service Basics https://learn.cybus.io/lessons/service-basics/ metadata: name: Service Basics Example version: 0.0.4 icon: https://www.cybus.io/wp-content/uploads/2019/03/Cybus-logo-Claim-lang.svg provider: Cybus GmbH homepage: https://www.cybus.io #------------------------------------------------------------------------------ # Parameters #------------------------------------------------------------------------------ parameters: opcuaHost: type: string description: OPC UA Host Address default: opcuaserver.com opcuaPort: type: integer description: OPC UA Host Port default: 48010 #------------------------------------------------------------------------------ # Resources #------------------------------------------------------------------------------ resources: #---------------------------------------------------------------------------- # OPC UA Connection #---------------------------------------------------------------------------- opcuaConnection: type: Cybus::Connection properties: protocol: Opcua connection: host: !ref opcuaHost port: !ref opcuaPort #username: myUsername #password: myPassword Humidity: type: Cybus::Endpoint properties: protocol: Opcua connection: !ref opcuaConnection subscribe: nodeId: ns=3;s=AirConditioner_1.Humidity PowerConsumption: type: Cybus::Endpoint properties: protocol: Opcua connection: !ref opcuaConnection subscribe: nodeId: ns=3;s=AirConditioner_1.PowerConsumption Temperature: type: Cybus::Endpoint properties: protocol: Opcua connection: !ref opcuaConnection subscribe: nodeId: ns=3;s=AirConditioner_1.Temperature #---------------------------------------------------------------------------- # InfluxDB Connection #---------------------------------------------------------------------------- influxdbConnection: type: Cybus::Connection properties: protocol: Influxdb connection: host: connectware port: 8086 bucket: generic scheme: http airconditionerWrite: type: Cybus::Endpoint properties: protocol: Influxdb connection: !ref influxdbConnection write: measurement: airconditioner #---------------------------------------------------------------------------- # MAPPINGS #---------------------------------------------------------------------------- mqttMapping: type: Cybus::Mapping properties: mappings: - subscribe: endpoint: !ref Humidity publish: topic: 'building-automation/airconditioner/1/humidity' - subscribe: endpoint: !ref PowerConsumption publish: topic: 'building-automation/airconditioner/1/power-consumption' - subscribe: endpoint: !ref Temperature publish: topic: 'building-automation/airconditioner/1/temperature' influxdbMapping: type: Cybus::Mapping properties: mappings: - subscribe: topic: 'building-automation/airconditioner/1/+measurement' publish: endpoint: !ref airconditionerWrite rules: - transform: expression: '$merge([$,{"measurement": $context.vars.measurement}])' #---------------------------------------------------------------------------- # VOLUMES #---------------------------------------------------------------------------- grafanaVolume: type: Cybus::Volume influxdbVolume: type: Cybus::Volume #---------------------------------------------------------------------------- # INGRESS ROUTES #---------------------------------------------------------------------------- # Grafana grafanaURL: type: Cybus::IngressRoute properties: container: !ref genericGrafana type: http slug: grafana target: path: '/' port: 3000 # InfluxDB influxdbRoute: type: Cybus::IngressRoute properties: container: !ref influxdb type: tcp containerPort: 8086 connectwarePort: 8086 #---------------------------------------------------------------------------- # FRONTENDS #---------------------------------------------------------------------------- dashboard: type: Cybus::Link properties: name: Dashboard ingressRoute: !ref grafanaURL href: '' #---------------------------------------------------------------------------- # CONTAINERS #---------------------------------------------------------------------------- influxdb: type: Cybus::Container properties: image: registry.hub.docker.com/library/influxdb:1.8-alpine volumes: - !sub '${influxdbVolume}:/var/lib/influxdb' environment: INFLUXDB_DB: generic INFLUXDB_HTTP_FLUX_ENABLED: true genericGrafana: type: Cybus::Container properties: image: registry.cybus.io/cybus-services/generic-grafana:1.3.0 volumes: - !sub '${grafanaVolume}:/var/lib/grafana' environment: GF_SERVER_ROOT_URL: !sub '/services/${Cybus::ServiceId}/grafana' GF_AUTH_ANONYMOUS_ENABLED: true INFLUX_HOST: !ref influxdb INFLUX_PORT: 8086 INFLUX_DB: generic