]> git.basschouten.com Git - openhab-addons.git/commitdiff
[nuvo] update rules examples in README (#13771)
authormlobstein <michael.lobstein@gmail.com>
Fri, 25 Nov 2022 07:08:59 +0000 (01:08 -0600)
committerGitHub <noreply@github.com>
Fri, 25 Nov 2022 07:08:59 +0000 (08:08 +0100)
* update rules examples

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
bundles/org.openhab.binding.nuvo/README.md

index e4a407cd821fa989dbcd1445dcd42594849311bd..6db93f746c5f5a916fa1c8567a5484232b028344 100644 (file)
@@ -40,7 +40,7 @@ The thing has the following configuration parameters:
 |--------------------------|--------------- |-------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
 | Serial Port              | serialPort     | Serial port to use for connecting to the Nuvo whole house amplifier device                                                                      | a comm port name                                                                   |
 | Address                  | host           | Host name or IP address of the machine connected to the Nuvo whole house amplifier serial port (serial over IP) or MPS4 server                  | host name or ip                                                                    |
-| Port                     | port           | Communication port (serial over IP).                                                                                                            | ip port number                                                                     |
+| Port                     | port           | Communication port (serial over IP)                                                                                                             | ip port number                                                                     |
 | Number of Zones          | numZones       | (Optional) Number of zones on the amplifier to utilize in the binding (up to 20 zones when zone expansion modules are used)                     | (1-20; default 6)                                                                  |
 | Favorite Labels          | favoriteLabels | A comma separated list of up to 12 label names that are loaded into the 'favorites' channel of each zone. These represent keypad favorites 1-12 | Optional; Comma separated list, max 12 items. ie: Favorite 1,Favorite 2,Favorite 3 |
 | Sync Clock on GConcerto  | clockSync      | (Optional) If set to true, the binding will sync the internal clock on the Grand Concerto to match the openHAB host's system clock              | Boolean; default false                                                             |
@@ -52,7 +52,7 @@ The thing has the following configuration parameters:
 Some notes:
 
 * If the port is set to 5006, the binding will adjust its protocol to connect to the Nuvo amplifier thing via an MPS4 IP connection.
-* MPS4 connections do not support commands using `SxDISPINFO`& `SxDISPLINE` (display_lineN channels) including those outlined in the advanced rules section below.
+* MPS4 connections do not support commands using `SxDISPINFO`& `SxDISPLINE` (display_lineN channels) including those outlined in the advanced rules section below. In this case,`SxDISPINFOTWO` and `SxDISPLINES` must be used instead. See the *very advanced* rule examples below.
 * As of OH 3.4.0, the binding supports NuvoNet source communication for any/all of the amplifier's 6 inputs but only when using an MPS4 connection.
 * By implementing NuvoNet communication, the binding can now support sending custom menus, custom favorite lists, album art, etc. to the Nuvo keypads for each source configured as an openHAB NuvoNet source.
 * If a zone has a maximum volume limit configured by the Nuvo configurator, the volume slider will automatically drop back to that level if set above the configured limit.
@@ -365,16 +365,12 @@ rule "Load track play info for Source 3"
 when
     Item Item_Containing_TrackLength received update
 then
-    if (null === actions) {
-        logInfo("actions", "Actions not found, check thing ID")
-        return
-    }
     // strip off any non-numeric characters and multiply seconds by 10 (Nuvo expects tenths of a second)
     var int trackLength = Integer::parseInt(Item_Containing_TrackLength.state.toString.replaceAll("[\\D]", "")) * 10
 
     // '0' indicates the track is just starting (at position 0), '2' indicates to Nuvo that the track is playing
     // The Nuvo keypad will now begin counting up the elapsed time displayed (starting from 0)
-    actions.sendNuvoCommand("S3DISPINFO," + trackLength.toString() + ",0,2")
+    sendCommand(nuvo_system_sendcmd, "S3DISPINFO," + trackLength.toString() + ",0,2")
     
 end
 
@@ -427,25 +423,20 @@ then
     var int trackLength = Integer::parseInt(Item_Containing_TrackLength.state.toString.replaceAll("[\\D]", "")) * 10
     var int trackPosition = Integer::parseInt(Item_Containing_TrackPosition.state.toString.replaceAll("[\\D]", "")) * 10
 
-    if (null === actions) {
-        logInfo("actions", "Actions not found, check thing ID")
-        return
-    }
-
     switch playMode {
         case "Nothing playing": {
             // when idle, '1' tells Nuvo to display 'idle' on the keypad
-            actions.sendNuvoCommand("S3DISPINFO,0,0,1")
+            sendCommand(nuvo_system_sendcmd, "S3DISPINFO,0,0,1")
         }
         case "Playing": {
             // when playback starts or resumes, '2' tells Nuvo to display 'playing' on the keypad
             // trackPosition does not need to be updated continuously, Nuvo will automatically count up the elapsed time displayed on the keypad 
-            actions.sendNuvoCommand("S3DISPINFO," + trackLength.toString() + "," + trackPosition.toString() + ",2")
+            sendCommand(nuvo_system_sendcmd, "S3DISPINFO," + trackLength.toString() + "," + trackPosition.toString() + ",2")
         }
         case "Paused": {
             // when playback is paused, '3' tells Nuvo to display 'paused' on the keypad and stop counting up the elapsed time
             // trackPosition should indicate the time elapsed of the track when playback was paused
-            actions.sendNuvoCommand("S3DISPINFO," + trackLength.toString() + "," + trackPosition.toString() + ",3")
+            sendCommand(nuvo_system_sendcmd, "S3DISPINFO," + trackLength.toString() + "," + trackPosition.toString() + ",3")
         }
     }
 end