Skip to content

Commit

Permalink
Fixed possible null pointer, made slashes consistent
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Roberts <timmarkroberts@gmail.com>
  • Loading branch information
tmrobert8 committed Jan 21, 2020
1 parent eabbf9a commit 211ec34
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 55 deletions.
32 changes: 16 additions & 16 deletions bundles/org.openhab.binding.sony/README-SCALAR.md
Original file line number Diff line number Diff line change
Expand Up @@ -556,24 +556,24 @@ The first attempt to 'fix' this situation was to be able to create a thing type

This addon defines the following directories:

1. `userdata\sony\definition\capabilities` which will contain the capabilities of the TV after it's gone online
2. `userdata\sony\definition\types` which will define a thing type of the TV after it's gone online
3. `userdata\sony\db\local\types` which will be the source of local thing types
1. `userdata/sony/definition/capabilities` which will contain the capabilities of the TV after it's gone online
2. `userdata/sony/definition/types` which will define a thing type of the TV after it's gone online
3. `userdata/sony/db/local/types` which will be the source of local thing types

Essentially - when the TV goes online - this addon will:

1. Query the device capabilities and write them to the `userdata\sony\definition\capabilities\{modelname}.json` if that file doesn't already exist
2. If a file `userdata\sony\db\local\types\{modelname}.json` exists, constructs the thing and thing type from this file
3. If the file doesn't exist, dynamically determine the channels for the device and write a thing type defintion to `userdata\sony\definition\types\{modelname}.json` if it doesn't already exist.
1. Query the device capabilities and write them to the `userdata/sony/definition/capabilities/{modelname}.json` if that file doesn't already exist
2. If a file `userdata/sony/db/local/types/{modelname}.json` exists, constructs the thing and thing type from this file
3. If the file doesn't exist, dynamically determine the channels for the device and write a thing type defintion to `userdata/sony/definition/types/{modelname}.json` if it doesn't already exist.

Now - to solve the problem of the non detected channels - you can follow this procedure:

1. Stop openHAB
2. Delete `{modelname}.json` from `userdata\sony\definition\types` if it exists.
2. Delete `{modelname}.json` from `userdata/sony/definition/types` if it exists.
3. Turn the device on and make sure it's at the home screen
4. Start openHAB and wait for the thing to go online
5. Verify that `{modelname}.json` in `userdata\sony\definition\types` exists.
6. Copy the `{modelname}.json` in `userdata\sony\db\local\types` directory
5. Verify that `{modelname}.json` in `userdata/sony/definition/types` exists.
6. Copy the `{modelname}.json` in `userdata/sony/db/local/types` directory
7. Wait a minute or so and the thing type of your thing will change to this file

From this point on - the channels created will come from the local file rather than be dynamically created. The only exception to this is that the application channels (netflix, youtube, etc) will continue to be dynamic.
Expand All @@ -593,9 +593,9 @@ There are two github repositories this addon works with:

The github addon will:

1. On startup, the addon will look for `{modelname}.json` (as defined above) from `userdata\sony\db\local\types` and will use that if found.
2. If not found, the addon will look for `{modelname}.json` in `userdata\sony\db\github\types` and use that if found
3. If not found, the addon will look for `{modelname}.json` in the GITHUB repository under `sonydevices/openHAB/thingtypes`. If found, the file will be downloaded to `userdata\sony\db\github\types` and will be used.
1. On startup, the addon will look for `{modelname}.json` (as defined above) from `userdata/sony/db/local/types` and will use that if found.
2. If not found, the addon will look for `{modelname}.json` in `userdata/sony/db/github/types` and use that if found
3. If not found, the addon will look for `{modelname}.json` in the GITHUB repository under `sonydevices/openHAB/thingtypes`. If found, the file will be downloaded to `userdata/sony/db/github/types` and will be used.
4. The thing then goes online
5. The github implementation will then compare the device capabilities to the `sonydevices/dev/apiinfo/restapi.json` (the master API document) and if any new/updated capabilities are found, will open a new issue on `sonydevices/dev` with the new/updated capability (if an issue doesn't already exist).
6. Likewise, the implementation will compare the thing type (if dynamically generated) to the `sonydevices/openHAB/thingtypes` and if any new/updated thing type channels are found, will open a new issue on `sonydevices/openHAB` with the new/updated thing type (if an issue doesn't already exist).
Expand All @@ -605,7 +605,7 @@ By using github, this addon can be supported by a team of people and have a cont

### Disabling local/github information

You may disable either local or the github information by editing the `conf\services\runtime.cfg` and including the following:
You may disable either local or the github information by editing the `conf/services/runtime.cfg` and including the following:

```
sony.sources:local=false
Expand All @@ -624,7 +624,7 @@ The first page is the API/Definition explorer. This will allow you to load your

To use this page:

1. To explore your device, press the "Load File" button and navigate to your device file (in `userdata\sony\definition\capabilities` folder as described above) and open your device JSON file. This will load all the capabilities into the right side.
1. To explore your device, press the "Load File" button and navigate to your device file (in `userdata/sony/definition/capabilities` folder as described above) and open your device JSON file. This will load all the capabilities into the right side.
2. Click on one of the capabiliites and the left side will be loaded with details of the call
3. Change any parameters you want to press the execute button
4. Results appear in the bottom window.
Expand All @@ -651,13 +651,13 @@ The type editor will allow you to customize a type for your own purposes. The ty

To use this page:

1. To load your device, press the "Load File" button and navigate to your device file (in `userdata\sony\definition\types` folder as described above) and open your device JSON file. This will load the thing type into the window.
1. To load your device, press the "Load File" button and navigate to your device file (in `userdata/sony/definition/types` folder as described above) and open your device JSON file. This will load the thing type into the window.
2. On the left top, you can change general information (please do not change service or the config)
3. On the right top, you can change the grouping names and add/delete new groups (please note that you can't delete a group until there are no channels referencing that group)
4. On the bottom, you can change the channel mappings to the group and to new channel names. Please be careful to not create duplicate channel names as I probably don't validate for that! ;)
5. You can press the "list" icon to change a property of the channel - I highly recommend leaving this alone as you can really screw something up.
6. You can press the "eye" icon to change the state for the channel - I highly recommend leaving this alone as you can really screw something up.
7. Press "Save" to download your new thing type to some directory.
8. Move the new thing type to the `userdata\sony\db\local\types` directory to have it become active.
8. Move the new thing type to the `userdata/sony/db/local/types` directory to have it become active.

Note that the validations on this screen are rudimentary at best and you can screw things up pretty easily. This screen was really mean for my use only.
Loading

0 comments on commit 211ec34

Please sign in to comment.