davesmeghead / visonic

Visonic Custom Component for integration with Home Assistant
Apache License 2.0
92 stars 20 forks source link

New feature request or how to do Dim Bright X10 #134

Closed ldupont226 closed 3 months ago

ldupont226 commented 3 months ago

Hi Dave, I know you are currently working on the latest version, which works extremely well and faster. But I would like to know if it is possible to send an X10 command to the panel. Before being with Home Assistant, I was with OpenHab and I could send DIM and BRIGHT commands to my X10 lights. It is not really urgent, but if a rainy day, you are looking for something to do :-).

davesmeghead commented 3 months ago

Hi,

The first thing to say is that I do not have X10 devices so I have no way of trying/testing anything....

The problem I have is that I do not know what kind of X10 device each one is, I haven't been able to spot this in the EPROM data from the panel. I currently set them all to "type: Dimmer Switch" but this is meaningless. I then only allow ON and OFF commands and I create a simple "switch" Entity in Home Assistant (that also only allows on/off).

However, on a positive, I've already implemented most of the code to do brightness control for X10 devices and have had it in there for years, I simply haven't created a Home Assistant way of commanding it.

So a couple of questions for you:

  1. In the alarm panel menu (on the panel itself), do you need to set the kind/type of X10 device that it is i.e. On/Off only or with a brightness control? Are there other settings?
  2. Should I change what I have ("switch" Entity) and assume a "light" Entity in Home Assistant with ON, OFF and Brightness Control?
  3. Would you be willing to do a few tests for me if I pass you the code? Are you able to "copy in" files such as pyvisonic.py, client.py in to the custom_components/visonic directory on your setup. I'm not keen to do these as formal HACS releases so I'd want to just pass you files to try.

Rgds Dave

ldupont226 commented 3 months ago

Hi Dave

  1. There is no selection in the panel to set the device type, nor in the PowerMaster application.

  2. In my personal case, I have 1 x10 wall socket, 6 dimmable wall switches and 2 non dimmable wall switches, In home assistant I change all the switches to light in the entity settings. I think that the majority of X10 device uses are lights. I think it would be more appropriate to define them as light. And if there is a switch unit we can change it in Home Assistant. But these light switches are not controllable in percentage (I think), it is only by ON, OFF, DIM or Bright commands. There is no intensity monitoring. You can check the OpenHab binding page: https://www.openhab.org/addons/bindings/powermax/

3- No problem to do the tests, I will be happy to do so.

davesmeghead commented 3 months ago

Here we go, there are 2 files in this zip file light.zip

Put both files in the /config/custom_components/visonic directory. client.py should replace what is there already, light.py is new.

Restart Home Assistant

This should, for every X10 device:

As I have no idea what I'm doing as I don't have any X10 devices, all I can do is verify that I believe the correct messages are being sent to the panel.

These files are just a test, if you set the brightness higher then it send a single command to the panel to increase brightness, similarly, if you set a brightness lower in HA then it sends a single command to the panel to decrease brightness.

The panel only tells me on and off state for X10 devices and not the brightness. So the integration does not understand what the current brightness level is of the device itself.

Can you let me know what happens (if anything).

ldupont226 commented 3 months ago

Hi Dave, It works well, the command is transmitted well, but it is a little counter-intuitive for people. Because the displayed gradation does not mean anything, and with a mobile we cannot use the arrows as with a PC, so we must do down, down, down slide up down, down But for me it meets my needs well, because I can control it .

But I would have another proposal, if you leave the light as non-variable and you create an action or command (service) that can transmit the DIM or BrIGHT command, with this we can create 2 buttons Dim and Bright .

davesmeghead commented 3 months ago

Hi,

I understand what you mean, I did wonder that myself but I thought I'd let you give it a go. If it's non-variable (i.e. on/off) then I'd rather leave it as a switch, for 2 reasons.

The first is that it doesn't change anything for existing users, for the people who have X10 devices then they already have them set up as switches in Home Assistant.

The second reason is that in Home Assistant you can change it anyway, like this image

So if we keep it as a Switch but I add a new service (action in the new HA release) to command off, on, dim or brighten against the switch entity that would be OK

Dave

ldupont226 commented 3 months ago

Yes I think that actions would be the best solution. I was already doing the switch conversion to light in HA. And indeed it will not change anything for other users.

By the way I am leaving this Sunday for a week and the network is not really available. So between the 11th and the 18th I will not be able to do a test.

ldupont226 commented 3 months ago

Hello Dave. Everything works very well. Thank you very much for this new feature.

Rgds Luc

davesmeghead commented 3 months ago

Closing this issue, I'll release it in to the main "master" release in the coming month or so.