littleyoda / pysma

(FORK for Developement)
Other
4 stars 4 forks source link

Accessmethod "energymeter" does not exist #8

Closed mschlenstedt closed 3 months ago

mschlenstedt commented 3 months ago

We had a discussion to access energymeters with accessmethod "energxmeter" instead of "speedwireem":

FAQ also mentions "energymeter" for Energymeters: https://github.com/littleyoda/pysma/blob/master/doc/faq_DE.md#speedwire-em-0x6069-energymeter-vormals-speedwireem

But the accessmethod "energymeter" does not exist and the lib throws an error:

https://github.com/littleyoda/pysma/blob/55a2942895b4504ef74c5de8bfe0b3014f18b565/pysma/__init__.py#L46C5-L57C16

    if accessmethod == "webconnect":
        return SMAwebconnect(session, url, password=password, group=groupuser)
    if accessmethod == "ennexos":
        return SMAennexos(session, url, password=password, group=groupuser)
    if accessmethod in ["speedwire", "speedwireem"]:
        return SMAspeedwireEM()
    if accessmethod == "speedwireinv":
        return SMAspeedwireINV(host=url, password=password, group=groupuser)
    if accessmethod == "shm2":
        return SHM2(ip=url, password=password)
    _LOGGER.error("Unknown Accessmethod: %s", accessmethod)
    return None
littleyoda commented 3 months ago

Unfortunately, the terms are not uniform used through the api and the example.py. The terms from the linked document refer to example.py and not to the API interface. I advise against using the name of the API interface for user dialogs.

I have summarized the topic in the following table. I hope it helps.

Description Interface preferred name for users Also used names
Devices of the Webconnect generation webconnect webconnect  
Devices of the ennexos generation ennexos ennexos  
Energymeters speedwireem energymeter speedwireem, speedwire, speedwire 0x6069
Devices with speedwire Interface speedwireinv speedwire speedwireinv, speedwire, speedwire 0x6065
Sunny Home Manager with Grid Guard Code shm2 shm2 grid guard code  
mschlenstedt commented 3 months ago

Ah, that was the misunderstanding! I thought the accessmethod is "energymeter", but you mean "show the name energymeter to the user, but use speedwireem" as access method. This was a little bit confusing.... Now it's clear.