opensmarthouse / opensmarthouse-web

Provides public elements of OpenSmartHouse web site including ZWave database import/export and log file processors.
0 stars 2 forks source link

Issues with multilevel sensor imports #6

Closed cdjackson closed 3 years ago

cdjackson commented 3 years ago

I got the following error importing a device -:

file: "/var/www/vhosts/opensmarthouse.org/httpdocs/zwavedatabase/zwaveCreateOh2.php"
line: 791
message: "Undefined index: VOLATILE_ORGANIC_COMPOUND"
trace: "#0 /var/www/vhosts/opensmarthouse.org/httpdocs/zwavedatabase/zwaveCreateOh2.php(791): exception_error_handler(8, 'Undefined index...', '/var/www/vhosts...', 791, Array)↵#1 /var/www/vhosts/opensmarthouse.org/httpdocs/zwavedatabase/zwaveCreateOh2.php(1774): zwaveProcessCommandClasses(Array, Object(SimpleXMLElement), Object(SimpleXMLElement))↵#2 /var/www/vhosts/opensmarthouse.org/httpdocs/zwavedatabase/zwaveCreateOh2.php(59): zwaveProcessXML(Object(SimpleXMLElement), 'My Thing', 'A new one')↵#3 {main}"

SMOKE_DENSITY also causes this.

bwosborne2 commented 3 years ago

OK I guess this is one for me to look at. Since the code repository is empty, so I just fix it on the site? Doing a PR against an empty repository is unusual...

cdjackson commented 3 years ago

I was just writing to suggest this :)

I think there's a table that lists all these so it should be an easy fix.

Yes, just fix this direct in on the site - thanks.

bwosborne2 commented 3 years ago

Ahem! I see this is now a class.

I believe we were reading from the API. I also think you mentioned changing the API...

I eliminated the table because the (old) API provided the information directly...

Let me check my local files first.

bwosborne2 commented 3 years ago

Example device IDs please.

cdjackson commented 3 years ago

The following XML should cover at least some of these...

<node>
  <homeId>0xd6fe3ae3</homeId>
  <nodeId>11</nodeId>
  <version>4</version>
  <manufacturer>0x15f</manufacturer>
  <deviceId>0x1111</deviceId>
  <deviceType>0x2222</deviceType>
  <listening>true</listening>
  <frequentlyListening>false</frequentlyListening>
  <routing>true</routing>
  <security>false</security>
  <beaming>true</beaming>
  <maxBaudRate>40000</maxBaudRate>
  <sleepDelay>1000</sleepDelay>
  <nodeInformationFrame>
    <commandClass>COMMAND_CLASS_ZWAVEPLUS_INFO</commandClass>
    <commandClass>COMMAND_CLASS_VERSION</commandClass>
    <commandClass>COMMAND_CLASS_MANUFACTURER_SPECIFIC</commandClass>
    <commandClass>COMMAND_CLASS_DEVICE_RESET_LOCALLY</commandClass>
    <commandClass>COMMAND_CLASS_POWERLEVEL</commandClass>
    <commandClass>COMMAND_CLASS_ASSOCIATION</commandClass>
    <commandClass>COMMAND_CLASS_ASSOCIATION_GRP_INFO</commandClass>
    <commandClass>COMMAND_CLASS_CONFIGURATION</commandClass>
    <commandClass>COMMAND_CLASS_SENSOR_MULTILEVEL</commandClass>
    <commandClass>COMMAND_CLASS_TRANSPORT_SERVICE</commandClass>
    <commandClass>COMMAND_CLASS_SECURITY_2</commandClass>
    <commandClass>COMMAND_CLASS_SUPERVISION</commandClass>
    <commandClass>COMMAND_CLASS_FIRMWARE_UPDATE_MD</commandClass>
  </nodeInformationFrame>
  <associationGroups class="concurrent-hash-map">
    <entry>
      <int>1</int>
      <associationGroup>
        <index>1</index>
        <maxNodes>0</maxNodes>
        <associations>
          <associationMember>
            <node>1</node>
          </associationMember>
        </associations>
      </associationGroup>
    </entry>
  </associationGroups>
  <endpoints class="concurrent-hash-map">
    <entry>
      <int>0</int>
      <endPoint>
        <deviceClass>
          <basicDeviceClass>BASIC_TYPE_ROUTING_SLAVE</basicDeviceClass>
          <genericDeviceClass>GENERIC_TYPE_SENSOR_MULTILEVEL</genericDeviceClass>
          <specificDeviceClass>SPECIFIC_TYPE_ROUTING_SENSOR_MULTILEVEL</specificDeviceClass>
        </deviceClass>
        <endpointId>0</endpointId>
        <secureCommandClasses/>
        <supportedCommandClasses class="concurrent-hash-map">
          <entry>
            <commandClass>COMMAND_CLASS_VERSION</commandClass>
            <COMMAND__CLASS__VERSION>
              <version>2</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>2</versionSupported>
              <libraryType>LIB_SLAVE_ENHANCED</libraryType>
              <protocolVersion>6.8</protocolVersion>
              <applicationVersion>6.3</applicationVersion>
              <hardwareVersion>255</hardwareVersion>
            </COMMAND__CLASS__VERSION>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_CONFIGURATION</commandClass>
            <COMMAND__CLASS__CONFIGURATION>
              <version>1</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>1</versionSupported>
              <configParameters>
                <entry>
                  <int>1</int>
                  <configurationParameter>
                    <index>1</index>
                    <size>1</size>
                    <value>1</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>2</int>
                  <configurationParameter>
                    <index>2</index>
                    <size>1</size>
                    <value>1</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>3</int>
                  <configurationParameter>
                    <index>3</index>
                    <size>1</size>
                    <value>1</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>4</int>
                  <configurationParameter>
                    <index>4</index>
                    <size>1</size>
                    <value>1</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>5</int>
                  <configurationParameter>
                    <index>5</index>
                    <size>1</size>
                    <value>1</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>6</int>
                  <configurationParameter>
                    <index>6</index>
                    <size>2</size>
                    <value>10</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>7</int>
                  <configurationParameter>
                    <index>7</index>
                    <size>1</size>
                    <value>1</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>8</int>
                  <configurationParameter>
                    <index>8</index>
                    <size>1</size>
                    <value>1</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>9</int>
                  <configurationParameter>
                    <index>9</index>
                    <size>1</size>
                    <value>1</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>10</int>
                  <configurationParameter>
                    <index>10</index>
                    <size>2</size>
                    <value>60</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>11</int>
                  <configurationParameter>
                    <index>11</index>
                    <size>2</size>
                    <value>60</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>12</int>
                  <configurationParameter>
                    <index>12</index>
                    <size>2</size>
                    <value>60</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>13</int>
                  <configurationParameter>
                    <index>13</index>
                    <size>2</size>
                    <value>120</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>14</int>
                  <configurationParameter>
                    <index>14</index>
                    <size>2</size>
                    <value>180</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>15</int>
                  <configurationParameter>
                    <index>15</index>
                    <size>2</size>
                    <value>180</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>16</int>
                  <configurationParameter>
                    <index>16</index>
                    <size>2</size>
                    <value>180</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>17</int>
                  <configurationParameter>
                    <index>17</index>
                    <size>2</size>
                    <value>300</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>18</int>
                  <configurationParameter>
                    <index>18</index>
                    <size>2</size>
                    <value>300</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>47</int>
                  <configurationParameter>
                    <index>47</index>
                    <size>1</size>
                    <value>0</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>50</int>
                  <configurationParameter>
                    <index>50</index>
                    <size>1</size>
                    <value>100</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>51</int>
                  <configurationParameter>
                    <index>51</index>
                    <size>1</size>
                    <value>20</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>52</int>
                  <configurationParameter>
                    <index>52</index>
                    <size>2</size>
                    <value>500</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>53</int>
                  <configurationParameter>
                    <index>53</index>
                    <size>1</size>
                    <value>100</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>54</int>
                  <configurationParameter>
                    <index>54</index>
                    <size>2</size>
                    <value>5000</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>55</int>
                  <configurationParameter>
                    <index>55</index>
                    <size>1</size>
                    <value>100</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
                <entry>
                  <int>56</int>
                  <configurationParameter>
                    <index>56</index>
                    <size>1</size>
                    <value>50</value>
                    <readOnly>false</readOnly>
                    <writeOnly>false</writeOnly>
                  </configurationParameter>
                </entry>
              </configParameters>
            </COMMAND__CLASS__CONFIGURATION>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_POWERLEVEL</commandClass>
            <COMMAND__CLASS__POWERLEVEL>
              <version>1</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>1</versionSupported>
              <powerLevel>0</powerLevel>
              <powerTimeout>0</powerTimeout>
            </COMMAND__CLASS__POWERLEVEL>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_SENSOR_MULTILEVEL</commandClass>
            <COMMAND__CLASS__SENSOR__MULTILEVEL>
              <version>10</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>10</versionSupported>
              <sensors>
                <entry>
                  <multilevelSensorType>VOLATILE_ORGANIC_COMPOUND</multilevelSensorType>
                  <multilevelSensor>
                    <sensorType>VOLATILE_ORGANIC_COMPOUND</sensorType>
                    <initialised>true</initialised>
                  </multilevelSensor>
                </entry>
                <entry>
                  <multilevelSensorType>TEMPERATURE</multilevelSensorType>
                  <multilevelSensor>
                    <sensorType>TEMPERATURE</sensorType>
                    <initialised>true</initialised>
                  </multilevelSensor>
                </entry>
                <entry>
                  <multilevelSensorType>LOUDNESS</multilevelSensorType>
                  <multilevelSensor>
                    <sensorType>LOUDNESS</sensorType>
                    <initialised>true</initialised>
                  </multilevelSensor>
                </entry>
                <entry>
                  <multilevelSensorType>CO2</multilevelSensorType>
                  <multilevelSensor>
                    <sensorType>CO2</sensorType>
                    <initialised>true</initialised>
                  </multilevelSensor>
                </entry>
                <entry>
                  <multilevelSensorType>SMOKE_DENSITY</multilevelSensorType>
                  <multilevelSensor>
                    <sensorType>SMOKE_DENSITY</sensorType>
                    <initialised>true</initialised>
                  </multilevelSensor>
                </entry>
                <entry>
                  <multilevelSensorType>PARTICULATE_MATTER</multilevelSensorType>
                  <multilevelSensor>
                    <sensorType>PARTICULATE_MATTER</sensorType>
                    <initialised>true</initialised>
                  </multilevelSensor>
                </entry>
                <entry>
                  <multilevelSensorType>GENERAL</multilevelSensorType>
                  <multilevelSensor>
                    <sensorType>GENERAL</sensorType>
                    <initialised>true</initialised>
                  </multilevelSensor>
                </entry>
                <entry>
                  <multilevelSensorType>LUMINANCE</multilevelSensorType>
                  <multilevelSensor>
                    <sensorType>LUMINANCE</sensorType>
                    <initialised>true</initialised>
                  </multilevelSensor>
                </entry>
                <entry>
                  <multilevelSensorType>RELATIVE_HUMIDITY</multilevelSensorType>
                  <multilevelSensor>
                    <sensorType>RELATIVE_HUMIDITY</sensorType>
                    <initialised>true</initialised>
                  </multilevelSensor>
                </entry>
              </sensors>
              <isGetSupported>true</isGetSupported>
            </COMMAND__CLASS__SENSOR__MULTILEVEL>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_ENERGY_PRODUCTION</commandClass>
            <COMMAND__CLASS__ENERGY__PRODUCTION>
              <version>0</version>
              <instances>0</instances>
              <control>false</control>
              <versionSupported>0</versionSupported>
            </COMMAND__CLASS__ENERGY__PRODUCTION>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_MANUFACTURER_SPECIFIC</commandClass>
            <COMMAND__CLASS__MANUFACTURER__SPECIFIC>
              <version>1</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>2</versionSupported>
              <initSerialNumber>false</initSerialNumber>
              <deviceManufacturer>351</deviceManufacturer>
              <deviceType>43011</deviceType>
              <deviceId>4946</deviceId>
            </COMMAND__CLASS__MANUFACTURER__SPECIFIC>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_BASIC</commandClass>
            <COMMAND__CLASS__BASIC>
              <version>0</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>0</versionSupported>
              <isGetSupported>true</isGetSupported>
            </COMMAND__CLASS__BASIC>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_ZWAVEPLUS_INFO</commandClass>
            <COMMAND__CLASS__ZWAVEPLUS__INFO>
              <version>1</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>2</versionSupported>
              <zwPlusVersion>1</zwPlusVersion>
              <zwPlusRole>ROLE_TYPE_SLAVE_ALWAYS_ON</zwPlusRole>
              <zwPlusNodeType>NODE_TYPE_ZWAVEPLUS_NODE</zwPlusNodeType>
              <isGetSupported>true</isGetSupported>
            </COMMAND__CLASS__ZWAVEPLUS__INFO>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_ASSOCIATION_GRP_INFO</commandClass>
            <COMMAND__CLASS__ASSOCIATION__GRP__INFO>
              <version>0</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>0</versionSupported>
              <autoSubscribeGroups/>
            </COMMAND__CLASS__ASSOCIATION__GRP__INFO>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_FIRMWARE_UPDATE_MD</commandClass>
            <COMMAND__CLASS__FIRMWARE__UPDATE__MD>
              <version>1</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>4</versionSupported>
            </COMMAND__CLASS__FIRMWARE__UPDATE__MD>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_SECURITY</commandClass>
            <COMMAND__CLASS__SECURITY>
              <version>0</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>0</versionSupported>
            </COMMAND__CLASS__SECURITY>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_DEVICE_RESET_LOCALLY</commandClass>
            <COMMAND__CLASS__DEVICE__RESET__LOCALLY>
              <version>1</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>1</versionSupported>
            </COMMAND__CLASS__DEVICE__RESET__LOCALLY>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_ASSOCIATION</commandClass>
            <COMMAND__CLASS__ASSOCIATION>
              <version>0</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>0</versionSupported>
              <maxGroups>1</maxGroups>
            </COMMAND__CLASS__ASSOCIATION>
          </entry>
          <entry>
            <commandClass>COMMAND_CLASS_NO_OPERATION</commandClass>
            <COMMAND__CLASS__NO__OPERATION>
              <version>1</version>
              <instances>1</instances>
              <control>false</control>
              <versionSupported>1</versionSupported>
            </COMMAND__CLASS__NO__OPERATION>
          </entry>
        </supportedCommandClasses>
      </endPoint>
    </entry>
  </endpoints>
  <nodeNeighbors>
    <int>2</int>
    <int>3</int>
    <int>4</int>
    <int>5</int>
    <int>8</int>
    <int>9</int>
    <int>10</int>
  </nodeNeighbors>
  <lastReceived>2020-04-05 00:58:07.858 UTC</lastReceived>
</node>
bwosborne2 commented 3 years ago

OK, looking at for first error it appeaerd to be with device id 1274 so I started looking at that.

bwosborne2 commented 3 years ago

"Undefined index: VOLATILE_ORGANIC_COMPOUND"

That was not in your original processor file.

SMOKE_DENSITY also causes this.

Not in the original file either.

bwosborne2 commented 3 years ago

The processor has the following list: "TEMPERATURE" "GENERAL", "LUMINANCE" "POWER" "RELATIVE_HUMIDITY" "VELOCITY" "DIRECTION" "ATMOSPHERIC_PRESSURE" "BAROMETRIC_PRESSURE" "SOLAR_RADIATION" "DEW_POINT" "RAIN_RATE" "TIDE_LEVEL" "WEIGHT" "VOLTAGE" "CURRENT" "CO2" "AIR_FLOW" "TANK_CAPACITY" "DISTANCE" "ANGLE_POSITION" "ROTATION" "WATER_TEMPERATURE" "SOIL_TEMPERATURE" "SEISMIC_INTENSITY" "SEISMIC_MAGNITUDE" "ULTRAVIOLET" "ELECTRICAL_RESISTIVITY" "ELECTRICAL_CONDUCTIVITY" "LOUDNESS" "MOISTURE"

From you sample XML the following, at a minimum are missing: VOLATILE_ORGANIC_COMPOUND SMOKE_DENSITY PARTICULATE_MATTER

cdjackson commented 3 years ago

The current list from the binding is here -:

https://github.com/openhab/org.openhab.binding.zwave/blob/2.5.x/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveMultiLevelSensorCommandClass.java#L331

This may not be 100% complete if the spec has been updated, but will definitely list everything that can possibly appear in the XML since it's all the definitions the binding knows :)

bwosborne2 commented 3 years ago

Thanks. I will compose an updated array and get you to "bless" the differences first ;)

bwosborne2 commented 3 years ago

I went ahead and added the other half of the list. Your test xml works now. I probably should make up a test case multi sensor xml file to be used in verification testing.

Whenever new capabilities are added to the binding, we need to make sure the processing script is updated too.

bwosborne2 commented 3 years ago

This bug should be declared squashed. 👍

I cannot seem to close the issue?

cdjackson commented 3 years ago

I guess as I raised it you can't close it. I'll bump your access...

bwosborne2 commented 3 years ago

Closed.