vinteo / hass-opensprinkler

OpenSprinkler Integration for Home Assistant
MIT License
204 stars 40 forks source link

Feat show valid service entities #281

Closed EdLeckert closed 6 months ago

EdLeckert commented 6 months ago

Show only valid entities in the UI when configuring services. Fixes Issue #280 .

Services that affect the controller will list switch.<controller>_enabled.

Services that affect programs will list all switch.<program>_program_enabled entities.

Services that affect stations will list all switch.<station>_station_enabled entities.

Services that affect more than one of the above will list multiple types of entities.

The UI will not list values under Choose area or Choose device, as these would then select inappropriate entities for the service.

While other legitimate entities such as sensor.<station>_station_status could have also been listed, they provide no additional value and were left out to prevent clutter. However, nothing prevents a user from using these in YAML, so existing automations and scripts using these types of entities will continue to work.

services.yaml now uses the target keyword rather than fields to specify valid entities.

I've tested this against the examples in the docs, but additional testing by others would be appreciated.

sonarcloud[bot] commented 6 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

EdLeckert commented 6 months ago

Really should figure out how to get a test environment set up for this sort of stuff.

I use VirtualBox on Windows. I only have the one physical OpenSprinkler controller, so I just disable the integration on my production system when testing with the virtual one.

I noticed that there's no selector for run_seconds in the run service. Technically a different issue but should we just add it here?

Well, it was there at one point in my testing. Now it's back. :smirk:

curlydingo commented 6 months ago

I use VirtualBox on Windows. I only have the one physical OpenSprinkler controller, so I just disable the integration on my production system when testing with the virtual one.

I find the HA devcontainer works really well for a test instance of the integration, but I'm hoping to find a way to run the OpenSprinkler firmware as a stub somewhere and avoid using my actual hardware. Relying on the hardware means I can't test all features, and I can only test when I don't have clothes out on the line :)