chasenicholl / homebridge-weatherflow-tempest

WeatherFlow Tempest Homebridge Plugin
Apache License 2.0
15 stars 2 forks source link

Error setting serial number in logs #18

Closed apexskier closed 10 months ago

apexskier commented 10 months ago

Describe The Bug: Plugin still works, but there's an error in the logs

To Reproduce: Just happens on startup

Expected behavior: No error in logs

Logs:

[14/12/2023, 10:53:23] [homebridge-weatherflow-tempest] This plugin generated a warning from the characteristic 'Serial Number': [Serial Number] characteristic must have a length of more than 1 character otherwise         HomeKit will reject this accessory, ignoring new value. See https://homebridge.io/w/JtMGR for more info.
[14/12/2023, 10:53:23] [homebridge-weatherflow-tempest] Error: 
    at SerialNumber.Characteristic.characteristicWarning (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
    at SerialNumber.Characteristic.validateUserInput (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2963:14)
    at SerialNumber.Characteristic.setValue (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2229:20)
    at AccessoryInformation.Service.setCharacteristic (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Service.ts:758:35)
    at new WeatherFlowTempestPlatformAccessory (/var/lib/homebridge/node_modules/homebridge-weatherflow-tempest/src/platformAccessory.ts:642:8)
    at WeatherFlowTempestPlatform.initAccessory (/var/lib/homebridge/node_modules/homebridge-weatherflow-tempest/src/platform.ts:351:9)
    at WeatherFlowTempestPlatform.discoverDevices (/var/lib/homebridge/node_modules/homebridge-weatherflow-tempest/src/platform.ts:297:14)
    at WeatherFlowTempestPlatform.initializeBySocket (/var/lib/homebridge/node_modules/homebridge-weatherflow-tempest/src/platform.ts:114:12)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Plugin Config:

{
  "name": "Tempest",
  "local_api": true,
  "token": "<Your API Token>",
  "station_id": 0,
  "interval": 10,
  "units": "Standard",
  "sensors": [
    {
      "name": "Air Temperature",
      "sensor_type": "Temperature Sensor",
      "temperature_properties": {
        "value_key": "air_temperature"
      }
    },
    {
      "name": "Humidity",
      "sensor_type": "Humidity Sensor",
      "humidity_properties": {
        "value_key": "relative_humidity"
      }
    },
    {
      "name": "Brightness",
      "sensor_type": "Light Sensor",
      "light_properties": {
        "value_key": "brightness"
      }
    },
    {
      "name": "Feels Like",
      "sensor_type": "Temperature Sensor",
      "temperature_properties": {
        "value_key": "feels_like"
      }
    },
    {
      "name": "Wind Gust",
      "sensor_type": "Motion Sensor",
      "motion_properties": {
        "value_key": "wind_gust",
        "trigger_value": 3
      }
    },
    {
      "name": "Rain",
      "sensor_type": "Occupancy Sensor",
      "occupancy_properties": {
        "value_key": "precip",
        "trigger_value": 0
      }
    }
  ],
  "_bridge": {
    "username": "0E:C9:A9:4B:4B:4B",
    "port": 42489
  },
  "platform": "WeatherFlowTempest"
}

Environment:

DMBlakeley commented 10 months ago

Nice catch!

If you edit the Plugin Config and change "station_id": 0, to "station_id": 12345, the error will go away.

Will need to update the plugin to check for a 0 entry which is the case when you install the plugin and directly use local mode.

chasenicholl commented 10 months ago

Great catch, thank you. I'll work on a patch release soon.

DMBlakeley commented 10 months ago

@chasenicholl, I submitted a 4.0.1 pull request to address this issue.

chasenicholl commented 10 months ago

@apexskier thanks for the bug ticket. This has been addressed by @DMBlakeley in a just published patch release v4.0.1

Thank you everyone.

bourquep commented 2 weeks ago

I'm seeing this in a just-installed v4.0.2:

[10/16/2024, 7:40:21 AM] [WeatherFlow Tempest Platform] Initial local broadcast recieved.
[10/16/2024, 7:40:21 AM] [WeatherFlow Tempest Platform] Adding new accessory: Temperature
[Temperature@@Serial Number] [Serial Number] characteristic must have a length of more than 1 character otherwise         HomeKit will reject this accessory, ignoring new value
[10/16/2024, 7:40:21 AM] [WeatherFlow Tempest Platform] Adding new accessory: Feels Like
[Feels Like@@Serial Number] [Serial Number] characteristic must have a length of more than 1 character otherwise         HomeKit will reject this accessory, ignoring new value
[10/16/2024, 7:40:21 AM] [WeatherFlow Tempest Platform] Adding new accessory: Humidity
[Humidity@@Serial Number] [Serial Number] characteristic must have a length of more than 1 character otherwise         HomeKit will reject this accessory, ignoring new value
[10/16/2024, 7:40:21 AM] [WeatherFlow Tempest Platform] Adding new accessory: Wind
[Wind@@Serial Number] [Serial Number] characteristic must have a length of more than 1 character otherwise         HomeKit will reject this accessory, ignoring new value
[10/16/2024, 7:40:21 AM] [WeatherFlow Tempest Platform] Adding new accessory: Brightness
[Brightness@@Serial Number] [Serial Number] characteristic must have a length of more than 1 character otherwise         HomeKit will reject this accessory, ignoring new value
[10/16/2024, 7:40:21 AM] [WeatherFlow Tempest Platform] Adding new accessory: Rain
[Rain@@Serial Number] [Serial Number] characteristic must have a length of more than 1 character otherwise         HomeKit will reject this accessory, ignoring new value
[10/16/2024, 7:40:21 AM] [WeatherFlow Tempest Platform] discoverDevices completed
[10/16/2024, 7:40:21 AM] [WeatherFlow Tempest Platform] removeDevices completed
DMBlakeley commented 2 weeks ago

Believe the problem is that you may have created the config.json file manually rather than use the Plugin Config option and the "Name" field is missing or is blank.

If this is not the issue, would be best if you shared your JSON config file. Redact your station number.

bourquep commented 2 weeks ago

I configured the plugin using the UI right after installing it. Then I manually edited the config.json to add my station_id and the warning went away.

DMBlakeley commented 2 weeks ago

Thanks for submitting! Manually adding the station_id pointed at the problem. On initial configuration with Local mode, station_id is null which produces the error that you saw. Will push an update to @chasenicholl for review and release.