Tiemooowh / pyTeletask

2 stars 2 forks source link

catching button press #3

Open jan-bogaerts opened 3 years ago

jan-bogaerts commented 3 years ago

Hi, Finally getting around this thing again. I'm trying another way (instead of trying to get the lib to work directly with home assistant). All I need is to control 1 or 2 lights and catch 2 or 3 buttons. Controlling the light was successful with the current library and the 'test.py' module with the short example. First off, is it possible to get the state of a relay? Right now, the callback is fired when the state of the light is changed, but it's values is always 'False'. I also tried to do something similar for catching a button press:

light = Switch(doip,
                  name='Eiland',
                  group_address_switch='9',
                  device_updated_cb=callback_test,
                  doip_component="dimmer")

Could you give a small example on how to catch a button press?

Tiemooowh commented 3 years ago

Catching buttons itself is not implemented. Focus was on "outputs" not on "inputs". Because the pyTeletask module is used in combination with HASS in my case, all inputs come direct from the HASS UI.

State fetch can be done like this: await light.current_state()

Best regards, T

On Sun, Jan 31, 2021 at 3:18 PM Jan Bogaerts notifications@github.com wrote:

Hi, Finally getting around this thing again. I'm trying another way (instead of trying to get the lib to work directly with home assistant). All I need is to control 1 or 2 lights and catch 2 or 3 buttons. Controlling the light was successful with the current library and the 'test.py' module with the short example. First off, is it possible to get the state of a relay? Right now, the callback is fired when the state of the light is changed, but it's values is always 'False'. I also tried to do something similar for catching a button press:

light = Switch(doip, name='Eiland', group_address_switch='9', device_updated_cb=callback_test, doip_component="dimmer")

Could you give a small example on how to catch a button press?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Tiemooowh/pyTeletask/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADA27LJ6FYIIKATK6NWNUUDS4VRD5ANCNFSM4W3MRQHA .

jan-bogaerts commented 3 years ago

Where do you get the info on the open doip protocol? I looked, but couldn't find much. If it is possible, perhaps I can do something about it? Another option I've been thinking about: try to link those buttons to 'dummy' relays' in my system and then monitor the relay events (those got triggered)

Tiemooowh commented 3 years ago

https://github.com/Tiemooowh/pyTeletask/blob/2a547b4ca9b0a498c5f72c4de61a7423eb727690/teletask/devices/remote_value.py#L87 Here you do the GET state

Regarding the dummy relays, that would be my option as well (where you get a FLAG instead of a relay), but you'll have to attach the button to the flag in the DoIP software itself ;-)

T

On Mon, Feb 1, 2021 at 1:34 PM Jan Bogaerts notifications@github.com wrote:

Where do you get the info on the open doip protocol? I looked, but couldn't find much. If it is possible, perhaps I can do something about it? Another option I've been thinking about: try to link those buttons to 'dummy' relays' in my system and then monitor the relay events (those got triggered)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Tiemooowh/pyTeletask/issues/3#issuecomment-770823783, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADA27LL7VQQLHQURT7JKEHDS42NU7ANCNFSM4W3MRQHA .

jan-bogaerts commented 3 years ago

ok, gonna try some stuff out in the weekend. Thanks.