jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
196 stars 48 forks source link

Missing Energy and Current Sensors #136

Open web1452 opened 3 years ago

web1452 commented 3 years ago

I have an Aeotec Home Energy Monitor Gen5, and the Energy and Current Sensor are not appearing in the entities. I can see the data being sent from Hubitat to HA and being updated but no entity is appearing with that data.

Wattage and Voltage are working and reporting.

2021-08-13 10:54:55 DEBUG (MainThread) [hubitatmaker.hub] Received event: {'name': 'energy', 'value': '503.045', 'displayName': 'HEM', 'deviceId': '902', 'descriptionText': None, 'unit': 'kWh', 'type': None, 'data': None} 2021-08-13 10:54:55 DEBUG (MainThread) [hubitatmaker.hub] Updating energy of 902 to 503.045

2021-08-13 10:55:10 DEBUG (MainThread) [hubitatmaker.hub] Received event: {'name': 'current', 'value': '7.301', 'displayName': 'HEM', 'deviceId': '902', 'descriptionText': None, 'unit': 'A', 'type': None, 'data': None} 2021-08-13 10:55:10 DEBUG (MainThread) [hubitatmaker.hub] Updating current of 902 to 7.301

JeffM3 commented 3 years ago

Same here. Was hoping to get kWh working. it works on other integrations using Maker_API (I'm using The Home Remote as my whole home controller) so its something on the HA side. I'm a complete noob here so I'm no help. Just thought I'd chime in and second this request.

If kWh was working then I would be able to use the new Energy feature in HA, correct?

jason0x43 commented 3 years ago

Could you post the device data for your device from Hubitat? Seeing what Hubitat says about the device will hopefully indicate why those sensors aren't showing up.

SPCulhane commented 3 years ago

not sure if this will help but I recall reading somewhere that the device class needs to be energy "device_class: energy" (not power) and the unit of measurment kWh

JeffM3 commented 3 years ago

Hi Jason! I appreciate your response! Please be patient with me as I'm still trying to wrap my head around all this! :) Any guidance is much appreciated!

Here's what I get.. hopefully that what you're looking for? (Parent Device)

{
  "id": "326",
  "name": "Device",
  "label": "Home_Energy_Monitor",
  "type": "Aeon HEM Gen5",
  "attributes": [
    { "name": "current2", "currentValue": 3.115, "dataType": "NUMBER" },
    { "name": "energy", "currentValue": 8336.435, "dataType": "NUMBER" },
    { "name": "current1", "currentValue": 2.609, "dataType": "NUMBER" },
    { "name": "voltage2", "currentValue": 118.676, "dataType": "NUMBER" },
    { "name": "current", "currentValue": 5.734, "dataType": "NUMBER" },
    { "name": "power1", "currentValue": 397.173, "dataType": "NUMBER" },
    { "name": "power", "currentValue": 609.334, "dataType": "NUMBER" },
    { "name": "voltage", "currentValue": 118.676, "dataType": "NUMBER" },
    { "name": "power2", "currentValue": 1987.078, "dataType": "NUMBER" },
    { "name": "voltage1", "currentValue": 118.676, "dataType": "NUMBER" }
  ],
  "capabilities": [
    "Configuration",
    "Refresh",
    "PowerMeter",
    { "attributes": [{ "name": "power", "dataType": null }] },
    "EnergyMeter",
    { "attributes": [{ "name": "energy", "dataType": null }] },
    "Sensor"
  ],
  "commands": ["configure", "refresh", "reset"]
}

(Child Device Clamp1)

{
  "id": "327",
  "name": "Home_Energy_Monitor Clamp 1",
  "label": "Home_Energy_Monitor Clamp 1",
  "type": "Generic Component Metering Switch",
  "attributes": [
    { "name": "power", "currentValue": 1929.275, "dataType": "NUMBER" },
    { "name": "energy", "currentValue": 4019.546, "dataType": "NUMBER" },
    {
      "name": "switch",
      "currentValue": null,
      "dataType": "ENUM",
      "values": ["on", "off"]
    }
  ],
  "capabilities": [
    "Actuator",
    "Refresh",
    "PowerMeter",
    { "attributes": [{ "name": "power", "dataType": null }] },
    "Switch",
    { "attributes": [{ "name": "switch", "dataType": null }] },
    "EnergyMeter",
    { "attributes": [{ "name": "energy", "dataType": null }] }
  ],
  "commands": ["off", "on", "refresh"]
}

(Child Device Clamp 2)

{
  "id": "328",
  "name": "Home_Energy_Monitor Clamp 2",
  "label": "Home_Energy_Monitor Clamp 2",
  "type": "Generic Component Metering Switch",
  "attributes": [
    { "name": "power", "currentValue": 1937.73, "dataType": "NUMBER" },
    { "name": "energy", "currentValue": 4318.316, "dataType": "NUMBER" },
    {
      "name": "switch",
      "currentValue": null,
      "dataType": "ENUM",
      "values": ["on", "off"]
    }
  ],
  "capabilities": [
    "Actuator",
    "Refresh",
    "PowerMeter",
    { "attributes": [{ "name": "power", "dataType": null }] },
    "Switch",
    { "attributes": [{ "name": "switch", "dataType": null }] },
    "EnergyMeter",
    { "attributes": [{ "name": "energy", "dataType": null }] }
  ],
  "commands": ["off", "on", "refresh"]
}
JeffM3 commented 3 years ago

Not sure if this helps but this was in the log (those are the 3 devices from the Energy Monitor): Edit: forgot to mention I only get this occasionally. Logger: hubitatmaker.hub Source: /usr/local/lib/python3.9/site-packages/hubitatmaker/hub.py:332 First occurred: 1:29:35 PM (3 occurrences) Last logged: 1:29:36 PM

Tried to update unknown device 326 Tried to update unknown device 327 Tried to update unknown device 328

CamSoper commented 2 years ago

I have a first generation version of one of these Aeon devices. I too went down the rabbit hole of trying to get this wired up with HA's energy features, and it turns out the attribute that isn't making its way to an entity is energy.

I'm adding my own device info in hopes it turns out to be useful for you. 🙂

{
    "id": "1430",
    "name": "Energy Meter",
    "label": "Energy Meter",
    "type": "Aeon Home Energy Meter",
    "attributes": [
        {
            "name": "energy",
            "currentValue": 0.607,
            "dataType": "NUMBER"
        },
        {
            "name": "power",
            "currentValue": 1929,
            "dataType": "NUMBER"
        }
    ],
    "capabilities": [
        "Configuration",
        "PowerMeter",
        {
            "attributes": [
                {
                    "name": "power",
                    "dataType": null
                }
            ]
        },
        "EnergyMeter",
        {
            "attributes": [
                {
                    "name": "energy",
                    "dataType": null
                }
            ]
        },
        "Sensor"
    ],
    "commands": [
        "configure",
        "reset"
    ]
}
cdhawan commented 2 years ago

Same here. I have almost similar device info as @CamSoper.

Looks like there is no support for energy device yet in this integration.

jason0x43 commented 2 years ago

Not yet. It shouldn't take much to add support, but I've been tied up for the last couple months and haven't had a chance to implement it yet.

cdhawan commented 2 years ago

Thank you @jason0x43 for this great project.

It was simple enough for me to try and add this support. Kindly take a look at following PRs. Tested and working for me.

cdhawan commented 2 years ago

@jason0x43 can you spare some time to merge above changes and release new packages for hubitatmaker and hacs-hubitat?

jason0x43 commented 2 years ago

Yes, I was planning to make some updates to the integration this week. 😄

cdhawan commented 2 years ago

Yes, I was planning to make some updates to the integration this week. 😄

Thank you!