Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
docbender committed Nov 11, 2020
1 parent 26e4943 commit 4c44135
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 85 deletions.
21 changes: 5 additions & 16 deletions org.openhab.binding.simatic/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010-2020 Contributors to the openHAB project
See the NOTICE file(s) distributed with this work for additional
information.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0
SPDX-License-Identifier: EPL-2.0
-->
<!-- Copyright (c) 2010-2020 Contributors to the openHAB project See the NOTICE file(s) distributed with this work for additional
information. This program and the accompanying materials are made available under the terms of the Eclipse Public License
2.0 which is available at http://www.eclipse.org/legal/epl-2.0 SPDX-License-Identifier: EPL-2.0 -->
<features name="org.openhab.binding.simatic-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features
</repository>
<feature name="openhab-binding-simatic" description="simatic Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.simatic/${project.version}</bundle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void initialize() {
@Override
protected void updateState(@Nullable ChannelUID channel, State state) {
if (channel == null) {
logger.error("{} - updateState(...) channelID is null for state={}", getThing().getLabel(), state);
logger.debug("{} - updateState(...) channelID is null for state={}", getThing().getLabel(), state);
return;
}
// logger.debug("{} - update channelID={}, state={}", getThing().getLabel(), channel, state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<label>Simatic Bridge</label>
<description>Represent single PLC or more exactly its connection, which uses individual things.</description>
<channels>
<channel id="ChannelVersion" typeId="chVersionTypeID" />
<channel id="ChannelPdu" typeId="chPduTypeID" />
<channel id="ChannelAreasCount" typeId="chAreasCountTypeID" />
<channel id="ChannelAreas" typeId="chAreasTypeID" />
<channel id="ChannelTagCount" typeId="chTagCountTypeID" />
<channel id="ChannelRequests" typeId="chRequestsTypeID" />
<channel id="ChannelBytes" typeId="chBytesTypeID" />
</channels>
<channel id="ChannelVersion" typeId="chVersionTypeID"/>
<channel id="ChannelPdu" typeId="chPduTypeID"/>
<channel id="ChannelAreasCount" typeId="chAreasCountTypeID"/>
<channel id="ChannelAreas" typeId="chAreasTypeID"/>
<channel id="ChannelTagCount" typeId="chTagCountTypeID"/>
<channel id="ChannelRequests" typeId="chRequestsTypeID"/>
<channel id="ChannelBytes" typeId="chBytesTypeID"/>
</channels>
<config-description>
<parameter name="address" type="text" required="true">
<label>PLC IP/Host address</label>
Expand All @@ -33,26 +33,27 @@
<default>2</default>
</parameter>
<parameter name="pollRate" type="integer" min="0" required="true">
<label>Poll rate [ms]</label>
<description>Determine period of data read from device. </description>
<default>1000</default>
<advanced>true</advanced>
</parameter>
<parameter name="charset" type="text">
<label>Code page</label>
<description>Define code page for communicated strings (e.g. ISO-8859-1, cp1250). If blank or wrong code page is defined, system code page is used.</description>
<default></default>
<advanced>true</advanced>
</parameter>
<label>Poll rate [ms]</label>
<description>Determine period of data read from device. </description>
<default>1000</default>
<advanced>true</advanced>
</parameter>
<parameter name="charset" type="text">
<label>Code page</label>
<description>Define code page for communicated strings (e.g. ISO-8859-1, cp1250). If blank or wrong code page is
defined, system code page is used.</description>
<default></default>
<advanced>true</advanced>
</parameter>
<parameter name="communicationType" type="text" pattern="^(PG)|(OP)|(S7)$" required="true">
<label>Communication type</label>
<description>Which type of communication should be established. Possibilities are PG, OP, S7 (default).</description>
<default>S7</default>
<options>
<option value="PG">PG</option>
<option value="OP">OP</option>
<option value="S7">S7</option>
</options>
<option value="PG">PG</option>
<option value="OP">OP</option>
<option value="S7">S7</option>
</options>
<advanced>true</advanced>
</parameter>
<parameter name="isS7200" type="boolean">
Expand All @@ -75,51 +76,51 @@
</thing-type>

<!-- Channels -->
<!-- Bridge Channels -->
<channel-type id="chVersionTypeID">
<item-type>String</item-type>
<label>Version</label>
<description>Binding version</description>
<state readOnly="true" />
</channel-type>
<channel-type id="chPduTypeID">
<item-type>Number</item-type>
<label>PDU size</label>
<description>Negotiated PDU size</description>
<state pattern="%d B" readOnly="true" />
</channel-type>
<channel-type id="chAreasCountTypeID">
<item-type>Number</item-type>
<label>Areas count</label>
<description>Communicated PLC data areas count</description>
<state readOnly="true" />
</channel-type>
<channel-type id="chAreasTypeID">
<item-type>String</item-type>
<label>Areas</label>
<description>Communicated PLC data areas</description>
<state readOnly="true" />
</channel-type>
<channel-type id="chTagCountTypeID">
<item-type>Number</item-type>
<label>Channels count</label>
<description>Channels count</description>
<state readOnly="true" />
</channel-type>
<channel-type id="chRequestsTypeID">
<item-type>Number</item-type>
<label>Request/s</label>
<description>Requests per second to device</description>
<state pattern="%d 1/s" readOnly="true" />
</channel-type>
<channel-type id="chBytesTypeID">
<item-type>Number</item-type>
<label>Bytes/s</label>
<description>Bytes per second grabbed from device</description>
<state pattern="%d B/s" readOnly="true" />
</channel-type>
<!-- Thing Channels -->
<!-- Bridge Channels -->
<channel-type id="chVersionTypeID">
<item-type>String</item-type>
<label>Version</label>
<description>Binding version</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="chPduTypeID">
<item-type>Number</item-type>
<label>PDU size</label>
<description>Negotiated PDU size</description>
<state pattern="%d B" readOnly="true"/>
</channel-type>
<channel-type id="chAreasCountTypeID">
<item-type>Number</item-type>
<label>Areas count</label>
<description>Communicated PLC data areas count</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="chAreasTypeID">
<item-type>String</item-type>
<label>Areas</label>
<description>Communicated PLC data areas</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="chTagCountTypeID">
<item-type>Number</item-type>
<label>Channels count</label>
<description>Channels count</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="chRequestsTypeID">
<item-type>Number</item-type>
<label>Request/s</label>
<description>Requests per second to device</description>
<state pattern="%d 1/s" readOnly="true"/>
</channel-type>
<channel-type id="chBytesTypeID">
<item-type>Number</item-type>
<label>Bytes/s</label>
<description>Bytes per second grabbed from device</description>
<state pattern="%d B/s" readOnly="true"/>
</channel-type>

<!-- Thing Channels -->
<channel-type id="chNumber">
<item-type>Number</item-type>
<label>Number Value</label>
Expand Down

0 comments on commit 4c44135

Please sign in to comment.