AdyRock / com.smartthings

Home app to integrate SmartThings
GNU General Public License v3.0
12 stars 7 forks source link

Fahrenheit handling #40

Open squizzeak opened 11 months ago

squizzeak commented 11 months ago

Neither the official app nor this one seem to handle the temps correctly when unit is "F".

I haven't yet looked into if this conversion can be handled automatically by any homey methods but since the code doesn't even check the 'unit' key in temperature it shows the values as if they were C converted to F (fridge is 38F but shows as 100F in the homey app).

I sent the log from my install via the send log button in settings.

If I should happen upon how to fix this while perusing the homey sdk docs at some point I'll try to fix it up and send a PR.

AdyRock commented 11 months ago

The Send log function seems to be broken since the app has been in the new HCS. Could you paste the relevant section of the log here please.

squizzeak commented 11 months ago

Done from phone, apologies for any bad cropping or formatting

Poll:

* Setting logEnabled has changed.
* Get device: devices/a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5/components/freezer/capabilities/thermostatCoolingSetpoint/status
Result: {
  "coolingSetpointRange": {
    "value": null
  },
  "coolingSetpoint": {
    "value": -4,
    "unit": "F",
    "timestamp": "2023-12-27T03:57:40.371Z"
  }
}
* Set Capability: target_temperature,freezer - Value: -4
* devices/a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5/components/cooler/capabilities/contactSensor/status
* Get device: devices/a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5/components/cooler/capabilities/contactSensor/status
Result: {
  "contact": {
    "value": "closed",
    "timestamp": "2023-12-27T17:03:28.716Z"
  }
}
* Set Capability: alarm_contact.cooler - Value: false
* Trigger Check: alarm_contact.cooler = false was false
* devices/a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5/components/cooler/capabilities/temperatureMeasurement/status
* Get device: devices/a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5/components/cooler/capabilities/temperatureMeasurement/status
Result: {
  "temperatureRange": {
    "value": null
  },
  "temperature": {
    "value": 38,
    "unit": "F",
    "timestamp": "2023-12-27T03:51:43.401Z"
  }
}
* Set Capability: measure_temperature,cooler - Value: 38
* Trigger Check: measure_temperature,cooler = 
* devices/a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5/components/cooler/capabilities/thermostatCoolingSetpoint/status
* Get device: devices/a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5/components/cooler/capabilities/thermostatCoolingSetpoint/status
Result: {
  "coolingSetpointRange": {
    "value": null
  },
  "coolingSetpoint": {
    "value": 38,
    "unit": "F",
    "timestamp": "2023-12-27T03:49:34.331Z"
  }
}
* Set Capability: target_temperature,cooler - Value: 38
* devices/a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5/components/icemaker/capabilities/switch/status
* Get device: devices/a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5/components/icemaker/capabilities/switch/status
Result: {
  "switch": {
    "value": "on",
    "timestamp": "2023-12-23T17:16:43.010Z"
  }
}
* Set Capability: onoff.icemaker - Value: true
* devices/a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5/components/icemaker-02/capabilities/switch/status
* Get device: devices/a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5/components/icemaker-02/capabilities/switch/status
Result: {
  "switch": {
    "value": "on",
    "timestamp": "2023-12-23T17:16:43.053Z"
  }
}
* Set Capability: onoff.icemaker-02 - Value: true
* !!!!!! Polling finished
* Next Interval = 5000

Detection:

{
  "items": [
    {
      "deviceId": "a0c01edb-bb7f-2bb3-6b6a-b1a1204786b5",
      "name": "Samsung-Refrigerator",
      "label": "Kitchen refrigerator",
      "manufacturerName": "Samsung Electronics",
      "presentationId": "DA-REF-NORMAL-01011",
      "deviceManufacturerCode": "Samsung Electronics",
      "locationId": "eda7593a-6634-4cac-8809-d60edb4816fa",
      "ownerId": "9f10151a-c1fb-57c4-5253-1db44e7b72ec",
      "roomId": "5692ae46-5270-47b7-9937-0c2c3ef2b986",
      "deviceTypeName": "Samsung OCF Refrigerator",
      "components": [
        {
          "id": "main",
          "label": "main",
          "capabilities": [
            {
              "id": "contactSensor",
              "version": 1
            },
            {
              "id": "execute",
              "version": 1
            },
            {
              "id": "ocf",
              "version": 1
            },
            {
              "id": "powerConsumptionReport",
              "version": 1
            },
            {
              "id": "demandResponseLoadControl",
              "version": 1
            },
            {
              "id": "refresh",
              "version": 1
            },
            {
              "id": "refrigeration",
              "version": 1
            },
            {
              "id": "temperatureMeasurement",
              "version": 1
            },
            {
              "id": "thermostatCoolingSetpoint",
              "version": 1
            },
            {
              "id": "custom.deodorFilter",
              "version": 1
            },
            {
              "id": "custom.deviceReportStateConfiguration",
              "version": 1
            },
            {
              "id": "custom.energyType",
              "version": 1
            },
            {
              "id": "custom.fridgeMode",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            },
            {
              "id": "custom.disabledComponents",
              "version": 1
            },
            {
              "id": "custom.waterFilter",
              "version": 1
            },
            {
              "id": "samsungce.softwareUpdate",
              "version": 1
            },
            {
              "id": "samsungce.deviceIdentification",
              "version": 1
            },
            {
              "id": "samsungce.driverVersion",
              "version": 1
            },
            {
              "id": "samsungce.powerCool",
              "version": 1
            },
            {
              "id": "samsungce.powerFreeze",
              "version": 1
            },
            {
              "id": "samsungce.selfCheck",
              "version": 1
            },
            {
              "id": "samsungce.viewInside",
              "version": 1
            },
            {
              "id": "samsungce.fridgeWelcomeLighting",
              "version": 1
            },
            {
              "id": "sec.diagnosticsInformation",
              "version": 1
            },
            {
              "id": "sec.wifiConfiguration",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Refrigerator",
              "categoryType": "manufacturer"
            },
            {
              "name": "Refrigerator",
              "categoryType": "manufacturer"
            }
          ]
        },
        {
          "id": "freezer",
          "label": "freezer",
          "capabilities": [
            {
              "id": "contactSensor",
              "version": 1
            },
            {
              "id": "temperatureMeasurement",
              "version": 1
            },
            {
              "id": "thermostatCoolingSetpoint",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            },
            {
              "id": "custom.fridgeMode",
              "version": 1
            },
            {
              "id": "custom.thermostatSetpointControl",
              "version": 1
            },
            {
              "id": "samsungce.temperatureSetting",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Other",
              "categoryType": "manufacturer"
            }
          ]
        },
        {
          "id": "cooler",
          "label": "cooler",
          "capabilities": [
            {
              "id": "contactSensor",
              "version": 1
            },
            {
              "id": "temperatureMeasurement",
              "version": 1
            },
            {
              "id": "thermostatCoolingSetpoint",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            },
            {
              "id": "custom.fridgeMode",
              "version": 1
            },
            {
              "id": "custom.thermostatSetpointControl",
              "version": 1
            },
            {
              "id": "samsungce.temperatureSetting",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Other",
              "categoryType": "manufacturer"
            }
          ]
        },
        {
          "id": "cvroom",
          "label": "cvroom",
          "capabilities": [
            {
              "id": "contactSensor",
              "version": 1
            },
            {
              "id": "temperatureMeasurement",
              "version": 1
            },
            {
              "id": "thermostatCoolingSetpoint",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            },
            {
              "id": "custom.fridgeMode",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Other",
              "categoryType": "manufacturer"
            }
          ]
        },
        {
          "id": "onedoor",
          "label": "onedoor",
          "capabilities": [
            {
              "id": "contactSensor",
              "version": 1
            },
            {
              "id": "temperatureMeasurement",
              "version": 1
            },
            {
              "id": "thermostatCoolingSetpoint",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            },
            {
              "id": "custom.fridgeMode",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Other",
              "categoryType": "manufacturer"
            }
          ]
        },
        {
          "id": "icemaker",
          "label": "icemaker",
          "capabilities": [
            {
              "id": "switch",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Other",
              "categoryType": "manufacturer"
            }
          ]
        },
        {
          "id": "icemaker-02",
          "label": "icemaker-02",
          "capabilities": [
            {
              "id": "switch",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Other",
              "categoryType": "manufacturer"
            }
          ]
        },
        {
          "id": "icemaker-03",
          "label": "icemaker-03",
          "capabilities": [
            {
              "id": "switch",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Other",
              "categoryType": "manufacturer"
            }
          ]
        },
        {
          "id": "scale-10",
          "label": "scale-10",
          "capabilities": [
            {
              "id": "samsungce.weightMeasurement",
              "version": 1
            },
            {
              "id": "samsungce.weightMeasurementCalibration",
              "version": 1
            },
            {
              "id": "samsungce.connectionState",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Other",
              "categoryType": "manufacturer"
            }
          ]
        },
        {
          "id": "scale-11",
          "label": "scale-11",
          "capabilities": [
            {
              "id": "samsungce.weightMeasurement",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Other",
              "categoryType": "manufacturer"
            }
          ]
        },
        {
          "id": "pantry-01",
          "label": "pantry-01",
          "capabilities": [
            {
              "id": "samsungce.fridgePantryInfo",
              "version": 1
            },
            {
              "id": "samsungce.fridgePantryMode",
              "version": 1
            },
            {
              "id": "samsungce.meatAging",
              "version": 1
            },
            {
              "id": "samsungce.foodDefrost",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Other",
              "categoryType": "manufacturer"
            }
          ]
        },
        {
          "id": "pantry-02",
          "label": "pantry-02",
          "capabilities": [
            {
              "id": "samsungce.fridgePantryInfo",
              "version": 1
            },
            {
              "id": "samsungce.fridgePantryMode",
              "version": 1
            },
            {
              "id": "samsungce.meatAging",
              "version": 1
            },
            {
              "id": "samsungce.foodDefrost",
              "version": 1
            },
            {
              "id": "custom.disabledCapabilities",
              "version": 1
            }
          ],
          "categories": [
            {
              "name": "Other",
              "categoryType": "manufacturer"
            }
          ]
        }
      ],
      "createTime": "2023-12-23T16:57:54.660Z",
      "profile": {
        "id": "8ee20eda-20f3-338a-b26a-7985ce809b18"
      },
      "ocf": {
        "ocfDeviceType": "oic.d.refrigerator",
        "name": "Samsung-Refrigerator",
        "specVersion": "core.1.1.0",
        "verticalDomainSpecVersion": "1.2.1",
        "manufacturerName": "Samsung Electronics",
        "modelNumber": "TP1X_REF_21K|00148241|00020841031611204103000021010000",
        "platformVersion": "DAWIT 2.0",
        "platformOS": "TizenRT 3.1",
        "hwVersion": "Realtek",
        "firmwareVersion": "A-RFWW-TP1-22-REV1_20231018",
        "vendorId": "DA-REF-NORMAL-01011",
        "vendorResourceClientServerVersion": "Realtek Release 3.1.221111",
        "lastSignupTime": "2023-12-23T16:57:54.513349Z"
      },
      "type": "OCF",
      "restrictionTier": 0,
      "allowed": [],
      "executionContext": "CLOUD"
    }
  ],
  "_links": {}
}

image

AdyRock commented 11 months ago

Ok, I will check the unit and convert it to Centigrade if required as Homey always expects that. If you are in the USA then it converts it to Fahrenheit for display.

AdyRock commented 11 months ago

I have published a new version. can you check if it solves the issue.

squizzeak commented 11 months ago

@AdyRock I think the conversion also needs to be added to the refrigeration device.

Thanks for your help!

AdyRock commented 11 months ago

I added it as a generic conversation for the temperature capability, so it should do that if SmartThings returns the unit as 'F'. I will check the log again though.

AdyRock commented 11 months ago

Oops, I forgot the refrigeration was a separate device, so magic applied to that as well.

squizzeak commented 11 months ago

Tested and it works after fixing a minor typo

fix-temp-conversion.patch