Bulk edit linter errors. (#1438)

* Bulk edit linter errors.

Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
pull/1439/head
Jerome Luckenbach 2021-01-10 20:22:40 +01:00 committed by GitHub
parent a3260307b0
commit 82c751d0df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 28 deletions

View File

@ -15,8 +15,14 @@ rule 'MD024', :allow_different_nesting => true
# Allow Multiple top level headers in the same document
exclude_rule 'MD025'
# Allow trailing punctuation in headers
exclude_rule 'MD026'
# Allow inline HTML
exclude_rule 'MD033'
# Allow bare urls (at least until they don't produce errors in source code blocks anymore)
exclude_rule 'MD033'
# Allow Frontmatter and exclude top level header on first line rule
exclude_rule 'MD041'

View File

@ -62,8 +62,8 @@ You have different options to execute a command through an action.
- `executeCommandLine(String commandLine)`: Executes a command on the command line without waiting for the command to complete.
For example you could run `executeCommandLine("path/to/my/script.sh")` which then would be executed and the rule would continue processing.
- `executeCommandLine(Duration.ofSeconds(timeout), String commandLine)`: Executes a command on the command and waits `timeout` seconds for the command to complete, returning the output from the command as a String
For example you could run `var ScriptResponse = executeCommandLine(Duration.ofSeconds(60), "path/to/my/script.sh");` would get executed and wait 1 minute for the output to be responded back and write it into the `ScriptResponse` variable.
- `executeCommandLine(Duration.ofSeconds(timeout), String commandLine)`: Executes a command on the command and waits `timeout` seconds for the command to complete, returning the output from the command as a String.
For example you could run `var ScriptResponse = executeCommandLine(Duration.ofSeconds(60), "path/to/my/script.sh");` would get executed and wait 1 minute for the output to be responded back and write it into the `ScriptResponse` variable.
Other Durations than `ofSeconds` units are possible too.
Check out the [Java Documentation](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/Duration.html?is-external=true) for possible units.

View File

@ -22,7 +22,7 @@ Audio streams are provided by *audio sources* and consumed by *audio sinks*.
They can support different formats and provide a stream in a requested format upon request.
Typical audio source services are microphones. Typically, a continuous stream is expected from them.
- *Audio Sinks* are services that accept audio streams of certain formats.
Typically, these are expected to play the audio stream, i.e. they are some kind of speaker or media device.
Typically, these are expected to play the audio stream, i.e. they are some kind of speaker or media device.
- *Text-to-Speech* (TTS) services are similar to audio sources with respect to the ability to create audio streams.
The difference is that they take a string as an input and will synthesize this string to a spoken text using a given voice.
TTS services can provide information about the voices that they support and the locale that those voices are associated with.

View File

@ -174,7 +174,7 @@ The following naming style guide is recommended:
- Words should be separated by an underscore character, except for words that logically belong together
- Names that reoccur frequently, such as the names of rooms or appliances, may be abbreviated to reduce overall name length.
(Example: Bathroom = BR)
(Example: Bathroom = BR)
Examples:
@ -238,7 +238,7 @@ This section provides information about what a user can expect regarding the beh
- An Item's state may also be set through a Binding which may be reacting to changes in the real world
- A Binding may set the state of an Item to `UNDEF` if it looses communications with a Thing (for example, a Z-wave doorbell with a dead battery).
The Binding may also set the state to `UNDEF` if an error exists in the binding configuration, or under other conditions
The Binding may also set the state to `UNDEF` if an error exists in the binding configuration, or under other conditions
*N.B.* Many openHAB users find that it can be very useful to use [Persistence](/addons/#persistence) and [System started]({{base}}/configuration/rules-dsl.html#system-based-triggers) rules so that their systems behaves in a predictable way after an openHAB restart.
@ -573,11 +573,11 @@ Each Thing has one or more Channels, and Items are linked to one or more Channel
There are two different kinds of channels:
- State Channels will, as soon as linked to the Item, update the state of it and/or listen for Commands you send to it.
For example, if you have a `Player` Item, a State Channel could be responsible for propagating the state of an audio player (`PLAYING`, `PAUSED`) to your Item as well as listening for proper Commands (`PLAY`, `PAUSE`, `PREVIOUS`, `NEXT`)
For example, if you have a `Player` Item, a State Channel could be responsible for propagating the state of an audio player (`PLAYING`, `PAUSED`) to your Item as well as listening for proper Commands (`PLAY`, `PAUSE`, `PREVIOUS`, `NEXT`)
- Trigger Channels will only send events that won't have any effect on the Item unless you treat them with Rules or use a Trigger Profile to do state changes or commands based on your event.
For example, when you use a Binding that integrates buttons or wall switches, a Trigger Channel could be responsible for sending a `PRESSED` event when someone is pressing the button of the device.
This event on its own won't change anything on the Item, but you could use, for example, the Trigger Profile "rawbutton-toggle-switch" to toggle a lamp on or off when the button is clicked.
Also, you could e.g. define a Rule that is triggered by this event and calculates the color of the lamp based on the sun position.
For example, when you use a Binding that integrates buttons or wall switches, a Trigger Channel could be responsible for sending a `PRESSED` event when someone is pressing the button of the device.
This event on its own won't change anything on the Item, but you could use, for example, the Trigger Profile "rawbutton-toggle-switch" to toggle a lamp on or off when the button is clicked.
Also, you could e.g. define a Rule that is triggered by this event and calculates the color of the lamp based on the sun position.
Some Bindings support automatic discovery of Things, in which case discovered Things will appear in the Inbox in the UI.
Once accepted, the new Thing will appear under Settings > Things.

View File

@ -409,9 +409,9 @@ There are two ways to discover these methods:
- Use the [openHAB VS Code Extension](/docs/configuration/editors.html#editors.html#openhab-vs-code-extension) and the `<ctrl><space>` key combo to list all the available methods
- Look at the JavaDocs for the given type.
For example, the [JavaDoc for HSBType](https://openhab.org/javadoc/latest/org/openhab/core/library/types/hsbtype) shows getRed, getBlue, and getGreen methods.
These methods can be called in Rules-DSL without the "get" part in name as in `(MyColorItem.state as HSBType).red)`.
They retrieve the state of MyColorItem and then casts it as HSBType to be able to use the methods associated with the HSBType.
For example, the [JavaDoc for HSBType](https://openhab.org/javadoc/latest/org/openhab/core/library/types/hsbtype) shows `getRed`, `getBlue`, and `getGreen` methods.
These methods can be called in Rules-DSL without the `get` part in name as in `(MyColorItem.state as HSBType).red)`.
They retrieve the state of MyColorItem and then casts it as HSBType to be able to use the methods associated with the HSBType.
{: #conversions}

View File

@ -164,6 +164,7 @@ For example:
Groups allow parameters to be grouped together into logical blocks so that the user can find the parameters they are looking for.
A parameter can be placed into a group so that the UI knows how to display the information.
<table>
<tr><td><b>Property</b></td><td><b>Description</b></td></tr>
<tr><td>group.name</td><td>The group name - this is used to link the parameters into the group, along with the groupName option in the parameter (mandatory).</td></tr>
@ -178,7 +179,7 @@ The full XML schema for configuration descriptions is specified in the [openHAB
**Hints:**
- Although the attribute `uri` is optional, it *must* be specified in configuration description files.
Only for embedded configuration descriptions in documents for binding definitions and `Thing` type descriptions, the attribute is optional.
Only for embedded configuration descriptions in documents for binding definitions and `Thing` type descriptions, the attribute is optional.
## Example

View File

@ -12,8 +12,7 @@ If you do not find an answer to your question, do not hesitate to ask it on the
## Structuring Things and Thing Types
1. _I am implementing a binding for system X.
Shall I design this as one Thing or as a Bridge with multiple Things for the different functionalities?_
1. _I am implementing a binding for system X. Shall I design this as one Thing or as a Bridge with multiple Things for the different functionalities?_
In general, both options are valid:
@ -34,16 +33,14 @@ Shall I design this as one Thing or as a Bridge with multiple Things for the dif
Nonetheless, the static XML descriptions of thing types can be picked up for documentation generation and other purposes.
So whenever possible, static XML descriptions should be provided.
1. _For my system XY, there are so many different variants of devices.
Do I really need to define a thing type for every single one of them?_
1. _For my system XY, there are so many different variants of devices. Do I really need to define a thing type for every single one of them?_
Thing types are important if you have no chance to request any structural information about the devices from your system and if you need users to manually chose a thing to add or configure (i.e. there is also no automatic discovery).
The thing types that you provide will be the list the user can choose from.
If your system supports auto-discovery and you can also dynamically construct things (and their channels) from structural information that you can access during runtime, there is in theory no need to provide any thing type description at all.
Nonetheless, static descriptions of thing types have the advantage that the user knows which kind of devices are supported, no matter if he has a device at home or not - so you should at least have static XML descriptions for the devices that are known to you at implementation time.
1. _I have a device that can have different firmware versions with slightly different functionality.
Should I create one or two thing types for it?_
1. _I have a device that can have different firmware versions with slightly different functionality. Should I create one or two thing types for it?_
If the firmware version makes a huge difference for the device (and can be seen as a different model of it), then it is ok to have different things defined.
If the list of channels can be determined by knowing the firmware revision, this is good.

View File

@ -282,7 +282,7 @@ public class SunriseEvent extends AbstractEvent {
The listing below summarizes some coding guidelines as illustrated in the example above:
- Events should only be created by event factories.
Constructors do not have any access specifier in order to make the class package private.
Constructors do not have any access specifier in order to make the class package private.
- The serialization of the payload into a data transfer object (e.g. `SunriseDTO`) should be part of the event factory and will be assigned to a class member via the constructor.
- A public member `TYPE` represents the event type as string representation and is usually the name of the class.
- The `toString()` method should deliver a meaningful string since it is used for event logging.
@ -330,14 +330,14 @@ public class SunEventFactory extends AbstractEventFactory {
The listing below summarizes some guidelines as illustrated in the example above:
- Provide the supported event types (`SunriseEvent.TYPE`) via an `AbstractEventFactory` constructor call.
The supported event types will be returned by the `AbstractEventFactory.getSupportedEventTypes()` method.
The supported event types will be returned by the `AbstractEventFactory.getSupportedEventTypes()` method.
- The event factory defines the topic (`SUNRISE_EVENT_TOPIC`) of the supported event types.
Please ensure that the topic format follows the topic structure of the openHAB core events, similar to a REST URI (`{namespace}/{entityType}/{entity}/{sub-entity-1}/.../{sub-entity-n}/{action}`).
The namespace must be `openhab`.
Please ensure that the topic format follows the topic structure of the openHAB core events, similar to a REST URI (`{namespace}/{entityType}/{entity}/{sub-entity-1}/.../{sub-entity-n}/{action}`).
The namespace must be `openhab`.
- Implement the method `createEventByType(String eventType, String topic, String payload, String source)` to create a new event based on the topic and the payload, determined by the event type.
This method will be called by the framework in order to dispatch received events to the corresponding event subscribers.
If the payload is serialized with JSON, the method `deserializePayload(String payload, Class<T> classOfPayload)` can be used to deserialize the payload into a data transfer object.
This method will be called by the framework in order to dispatch received events to the corresponding event subscribers.
If the payload is serialized with JSON, the method `deserializePayload(String payload, Class<T> classOfPayload)` can be used to deserialize the payload into a data transfer object.
- Provide a static method to create event instances based on a domain object (Item, Thing, or in the example above `Sunrise`).
This method can be used by components in order to create events based on domain objects which should be sent by the EventPublisher.
If the data transfer object should be serialized into a JSON payload, the method `serializePayload(Object payloadObject)` can be used.
Custom event factories must be registered as an OSGi Service (eg. by using the @Component annotation) in order to receive the custom events.
This method can be used by components in order to create events based on domain objects which should be sent by the EventPublisher.
If the data transfer object should be serialized into a JSON payload, the method `serializePayload(Object payloadObject)` can be used.
Custom event factories must be registered as an OSGi Service (eg. by using the @Component annotation) in order to receive the custom events.