totalimmersion / com.somfy.tahoma

Somfy TaHoma app for Homey
GNU General Public License v3.0
10 stars 16 forks source link

Wrong position state used for horizontal awning #87

Open fjeldstad opened 4 years ago

fjeldstad commented 4 years ago

The driver for horizontal awnings is trying to fetch the position through the core:ClosureState state, but - at least in my setup - the state it should use is called core:DeploymentState. (I have a vertical exterior awning as well, and that has a core:ClosureState state.)

The effect of this is that I can control the horizontal awning from Homey but it doesn't report the correct position back when it changes due to an external event (such as wind, the Connexoon app etc.).

See https://github.com/totalimmersion/com.somfy.tahoma/blob/develop/drivers/WindowCoveringsDevice.js#L96 - this should probably be updated to something like:

.filter(state => ['core:OpenClosedState', 'core:ClosureState', 'core:DeploymentState'].includes(state.name))

This is the device setup for the horizontal awning - notice there's no core:ClosureState:

{
  "creationTime": 1558358089000,
  "lastUpdateTime": 1558358089000,
  "label": "Example",
  "deviceURL": "io://1234-1234-1234/123456",
  "shortcut": false,
  "controllableName": "io:HorizontalAwningIOComponent",
  "definition": {
    "commands": [
      {
        "commandName": "close",
        "nparams": 0
      },
      {
        "commandName": "delayedStopIdentify",
        "nparams": 1
      },
      {
        "commandName": "deploy",
        "nparams": 0
      },
      {
        "commandName": "down",
        "nparams": 0
      },
      {
        "commandName": "getName",
        "nparams": 0
      },
      {
        "commandName": "identify",
        "nparams": 0
      },
      {
        "commandName": "my",
        "nparams": 0
      },
      {
        "commandName": "open",
        "nparams": 0
      },
      {
        "commandName": "refreshMemorized1Position",
        "nparams": 0
      },
      {
        "commandName": "setClosure",
        "nparams": 1
      },
      {
        "commandName": "setDeployment",
        "nparams": 1
      },
      {
        "commandName": "setMemorized1Position",
        "nparams": 1
      },
      {
        "commandName": "setName",
        "nparams": 1
      },
      {
        "commandName": "setPosition",
        "nparams": 1
      },
      {
        "commandName": "setSecuredPosition",
        "nparams": 1
      },
      {
        "commandName": "startIdentify",
        "nparams": 0
      },
      {
        "commandName": "stop",
        "nparams": 0
      },
      {
        "commandName": "stopIdentify",
        "nparams": 0
      },
      {
        "commandName": "undeploy",
        "nparams": 0
      },
      {
        "commandName": "up",
        "nparams": 0
      },
      {
        "commandName": "wink",
        "nparams": 1
      }
    ],
    "states": [
      {
        "type": "ContinuousState",
        "qualifiedName": "core:DeploymentState"
      },
      {
        "type": "ContinuousState",
        "qualifiedName": "core:Memorized1PositionState"
      },
      {
        "type": "DataState",
        "qualifiedName": "core:NameState"
      },
      {
        "values": [
          "closed",
          "open"
        ],
        "type": "DiscreteState",
        "qualifiedName": "core:OpenClosedState"
      },
      {
        "type": "ContinuousState",
        "qualifiedName": "core:PriorityLockTimerState"
      },
      {
        "type": "ContinuousState",
        "qualifiedName": "core:RSSILevelState"
      },
      {
        "type": "ContinuousState",
        "qualifiedName": "core:SecuredPositionState"
      },
      {
        "values": [
          "available",
          "unavailable"
        ],
        "type": "DiscreteState",
        "qualifiedName": "core:StatusState"
      },
      {
        "values": [
          "comfortLevel1",
          "comfortLevel2",
          "comfortLevel3",
          "comfortLevel4",
          "environmentProtection",
          "humanProtection",
          "userLevel1",
          "userLevel2"
        ],
        "type": "DiscreteState",
        "qualifiedName": "io:PriorityLockLevelState"
      },
      {
        "values": [
          "LSC",
          "SAAC",
          "SFC",
          "UPS",
          "externalGateway",
          "localUser",
          "myself",
          "rain",
          "security",
          "temperature",
          "timer",
          "user",
          "wind"
        ],
        "type": "DiscreteState",
        "qualifiedName": "io:PriorityLockOriginatorState"
      }
    ],
    "dataProperties": [
      {
        "value": "500",
        "qualifiedName": "core:identifyInterval"
      }
    ],
    "widgetName": "PositionableHorizontalAwning",
    "uiClass": "Awning",
    "qualifiedName": "io:HorizontalAwningIOComponent",
    "type": "ACTUATOR"
  },
  "states": [
    {
      "name": "core:NameState",
      "type": 3,
      "value": "SUNILUS io"
    },
    {
      "name": "core:PriorityLockTimerState",
      "type": 1,
      "value": 0
    },
    {
      "name": "core:StatusState",
      "type": 3,
      "value": "available"
    },
    {
      "name": "core:RSSILevelState",
      "type": 2,
      "value": 60
    },
    {
      "name": "core:DeploymentState",
      "type": 1,
      "value": 0
    },
    {
      "name": "core:OpenClosedState",
      "type": 3,
      "value": "closed"
    }
  ],
  "attributes": [],
  "available": true,
  "enabled": true,
  "placeOID": "518719ec-edd8-49a1-9b46-7da2915c9589",
  "widget": "PositionableHorizontalAwning",
  "type": 1,
  "oid": "1eaefa59-eea2-4017-8a0f-9dcd7951870d",
  "uiClass": "Awning"
}