Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement]: Power für Gen2 Pro Dimmer #1037

Open
3 tasks done
mroesel opened this issue Sep 11, 2024 · 3 comments
Open
3 tasks done

[enhancement]: Power für Gen2 Pro Dimmer #1037

mroesel opened this issue Sep 11, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@mroesel
Copy link

mroesel commented Sep 11, 2024

I'm sure that

  • This issue is still present in the current beta version of this adapter
  • There is no other (open) issue with the same topic (use the search!)
  • This issue is not described in the adapter documentation / FAQ (read the docs!)

Shelly device

Shelly ProDimmer2PM (shellyprodm2pm)

Shelly firmware version

1.42

Protocol

MQTT

The problem

Hi Matthias,
könntest du bitte für folgende Versionen im gen2 helper für die Lights den Power parser einfügen ?
Habe es für mich so gelöst , aber nach jedem update fliegt es natürlich raus:

    deviceObj[`Light${lightId}.Power`] = {
        mqtt: {
            mqtt_publish: `<mqttprefix>/status/light:${lightID}`,
            mqtt_publish_funct: value => JSON.parse(value).apower,
        },
        common: {
            name: 'Power',
            type: 'number',
            role: 'value.power',
            read: true,
            write: false,
            def: 0,
            unit: 'W',
        },
    };

gerne auch die anderen values, waren für mich aber nicht wichtig.
Hier ein getstatus eines Pro Dimmer 2PM:

{
"ble": {},
"bthome": {
"errors": [
"bluetooth_disabled"
]
},
"cloud": {
"connected": false
},
"eth": {
"ip": null
},
"input:0": {
"id": 0,
"state": null
},
"input:1": {
"id": 1,
"state": null
},
"input:2": {
"id": 2,
"state": null
},
"input:3": {
"id": 3,
"state": null
},
"knx": {},
"light:0": {
"id": 0,
"source": "MQTT",
"output": false,
"brightness": 84,
"temperature": {
"tC": 38.8,
"tF": 101.8
},
"aenergy": {
"total": 118.726,
"by_minute": [
0,
0,
0
],
"minute_ts": 1726050120
},
"apower": 0,
"current": 0,
"voltage": 227
},
"light:1": {
"id": 1,
"source": "MQTT",
"output": false,
"brightness": 76,
"temperature": {
"tC": 45.4,
"tF": 113.8
},
"aenergy": {
"total": 119.73,
"by_minute": [
0,
0,
0
],
"minute_ts": 1726050120
},
"apower": 0,
"current": 0,
"voltage": 226.9
},
"mqtt": {
"connected": true
},
"sys": {
"mac": "xxx",
"restart_required": false,
"time": "12:22",
"unixtime": 1726050148,
"uptime": 519734,
"ram_size": 250908,
"ram_free": 111328,
"fs_size": 524288,
"fs_free": 180224,
"cfg_rev": 68,
"kvs_rev": 0,
"schedule_rev": 0,
"webhook_rev": 0,
"available_updates": {},
"reset_reason": 3
},
"wifi": {
"sta_ip": "xxx",
"status": "got ip",
"ssid": "xxx",
"rssi": -50
},
"ws": {
"connected": false
}
}

danke dir
grüße

iobroker.current.log (in debug mode!)

No response

Version of nodejs

v18.19.0

Version of ioBroker js-controller

5.0.19

Version of adapter

8.1.1

@mroesel mroesel added the bug Something isn't working label Sep 11, 2024
Copy link

Thanks for reporting a new issue @mroesel!

  1. Please make sure your topic is not covered in the documentation
  2. Please attach all necessary log files (in debug mode!), screenshots and other information to reproduce this issue
  3. Search for the issue topic in other/closed issues to avoid duplicates!

Otherwise this issue will be closed.

@mroesel mroesel changed the title [Improvement]: Power für Gen2 Pro Dimmer [enhancement]: Power für Gen2 Pro Dimmer Sep 11, 2024
@mcm1957
Copy link
Member

mcm1957 commented Sep 11, 2024

Ergänz doch bitte auch die für cih nicht wichtigen Werte (wenn du die notwendigen technischen Infos hast) und erstell einen PR. Mathias wird sich diesen sicher ansehen.

@mroesel
Copy link
Author

mroesel commented Sep 11, 2024

Leider habe ich keine Ahnung wie man einen Pull Request erstellt. Dafür mache ich zu wenig mit Github :-( Sorry.
Aber folgender Code bringt mir alle verfügbaren Daten des dm2pm in den iobroker.
Habe ihn der gen2-helper innerhalb der "function addLight" hinzugefügt. Keine Ahnung ob er im shellyprodm2pm.js besser aufgehoben wäre.

 deviceObj[`Light${lightId}.Energy`] = {
        mqtt: {
            mqtt_publish: `<mqttprefix>/status/light:${lightId}`,
            mqtt_publish_funct: value => JSON.parse(value).aenergy.total,
        },
        common: {
            name: 'Energy',
            type: 'number',
            role: 'value.power.consumption',
            read: true,
            write: false,
            def: 0,
            unit: 'Wh',
        },
    };

    deviceObj[`Light${lightId}.Power`] = {
        mqtt: {
            mqtt_publish: `<mqttprefix>/status/light:${lightId}`,
            mqtt_publish_funct: value => JSON.parse(value).apower,
        },
        common: {
            name: 'Power',
            type: 'number',
            role: 'value.power',
            read: true,
            write: false,
            def: 0,
            unit: 'W',
        },
    };

    deviceObj[`Light${lightId}.Current`] = {
        mqtt: {
            mqtt_publish: `<mqttprefix>/status/light:${lightId}`,
            mqtt_publish_funct: value => JSON.parse(value).current,
        },
        common: {
            name: 'Current',
            type: 'number',
            role: 'value.current',
            read: true,
            write: false,
            def: 0,
            unit: 'A',
        },
    };

    deviceObj[`Light${lightId}.Voltage`] = {
        mqtt: {
            mqtt_publish: `<mqttprefix>/status/light:${lightId}`,
            mqtt_publish_funct: value => JSON.parse(value).voltage,
        },
        common: {
            name: 'Voltage',
            type: 'number',
            role: 'value.voltage',
            read: true,
            write: false,
            def: 0,
            unit: 'V',
        },
    };

deviceObj[`Light${lightId}.temperatureC`] = {
    mqtt: {
        mqtt_publish: `<mqttprefix>/status/light:${lightId}`,
        mqtt_publish_funct: value => JSON.parse(value)?.temperature?.tC,
    },
    common: {
        name: 'Temperatur',
        type: 'number',
        role: 'value.temperature',
        read: true,
        write: false,
        unit: '°C',
    },
};

deviceObj[`Light${lightId}.temperatureF`] = {
    mqtt: {
        mqtt_publish: `<mqttprefix>/status/light:${lightId}`,
        mqtt_publish_funct: value => JSON.parse(value)?.temperature?.tF,
    },
    common: {
        name: 'Temperatur',
        type: 'number',
        role: 'value.temperature',
        read: true,
        write: false,
        unit: '°F',
    },
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants