siku2 / hass-dingz

Home Assistant support for dingz wall switches
MIT License
14 stars 5 forks source link

switched socket support #56

Closed JorisM closed 1 month ago

JorisM commented 2 months ago

thanks for this! I currently migrate from a home baked dingz integration, which started to get buggy.

everything seems to work, except for some sockets which I switch over dingz. on dingz side i've set them up like:

image

currently it shows up as a light: image

and if toggled it returns an error: image

how would you handle this scenario? can i reconfigure this on the dingz or does this require a new feature?

siku2 commented 2 months ago

I have no experience with switched sockets, but it looks like it's gonna require some small modifications to the code. If you already know how they work based on your previous work and you can document it here then that would massively simplify the implementation process. The biggest problem is always that it's exceptionally hard to implement features that I don't actively use (or have the ability to test) thanks to the lacking Dingz docs.

I assume you would want to have a switch entity?

JorisM commented 2 months ago

I figured out a workaround which works so far: I just configure them as non-dimmable lights, and that seems to have the same effect (which makes sense, as it basically just an on/off behavior).

Maybe adding a switched socket would still be helpful to make this more complete?

I totally understand that testing this is hard if you don't have a local setup to test it out.

I see two options: a) You can maybe setup the basics, and I will take it from there and test it here b) I will google/think a bit about a mocking client

If you are up to go with a), I'm more than happy to research b) in parallel.

JorisM commented 2 months ago

This is what the GET http://<dingz-IP>/api/v1/output_config endpoint returns when type Switched Socket is selected


    {
    "outputs": [
        // ...
        {
        "active": true,
        "name": "Stehlampe",
        "type": "power_socket",
        "groups": "z",
        "feedback": { "color": "none", "brightness": 100 },
        "light": {
            "dimmable": true,
            "dimmer": {
            "type": "linear",
            "use_last_value": false,
            "range": { "min": 1, "max": 100 },
            "dynamic": { "day": 100, "twilight": 100, "night": 100 }
            },
            "onoff": {
            "group_on": { "day": true, "twilight": true, "night": true }
            }
        },
        "heater": { "type": "nc", "function": "heating" },
        "pulse": { "type": "positive", "length": { "min": 0.2, "max": 0 } },
        "fan": {
            "delay": { "pre": 180, "post": 5 },
            "ventilation": {
            "from": { "hour": 7, "minute": 0 },
            "to": { "hour": 21, "minute": 0 },
            "force_in_24": 0
            },
            "react": { "pir_during_slot": false, "btn_no_delay": false },
            "active": true
        },
        "garage_door": {
            "opening_travel_time": 12,
            "close_timeout": 60,
            "pulse_time": 1
        },
        "valve": { "duration": 60 }
        },
    ]
    }
siku2 commented 2 months ago

@JorisM I published a completely untested pre-release that should add support for power sockets. It's based on the information you shared but I had to fill some gaps with pure speculation. Again, this is completely untested so it might just crash out of the box, but let me know how it goes :)

JorisM commented 1 month ago

image

Tested and works perfectly. It also doesn't create any error logs, so should be good to go 👍 Thanks