[SOLVED] Send 0 or 1 knx

hello

i’m new in your group and i’m french, so sorry for my English.

i use home assistant and knx with raspberry. i made a floorplan and all it’s works but i have a problem juste for send 0 or 1.

i want tu use a switch (or light) and send always 1 or always 0.

could you help me,

thank you verry much

Hi!
Use the knx.send service or customize a switch with ‘assumed_state = True’

thank you for you answer verry quicly.

have you got an exempl of yalm configuration.

thank you

No, but there is documentation :wink:

i had try but it’s not working.

i read that, do you know if it’s right.:

i tryed put a switch in my config.yalm :slight_smile:
switch:

- name: controletempbureau
  address: '0/2/35' 

after i put that in loveli ui configuration

        - element: controletempbureau
          entity: switch.controletempbureau
          action:
            service: send
            service Data:
              address: 0/2/35
              payload: 1
              type: ''

i have an error when i put on my switch :

service call failure "send/undefinied.

have you got an idea

thanks

The service name is knx.send not send. Omit “type” for binary.

i m disepoint it’s not working. i tryed knx.send an delete ligne type.

but i have another error :
service call failure “send/undefinied” extra keys not allowed @data[“entity_id”]

thanks

i fixed it.

the solution is :

input a switch in configuration.yalm

switch:

- name: controletempbureau
  address: '0/2/35'

and in lovelace ui configuration put :

        - action:
            service: homeassistant.turn_on
            data:
               entity_id: switch.controletempbureau
          element: controletempbureau 
        - action:
            service: homeassistant.turn_off
            data:
               entity_id: switch.controletempbureau
          element: controletempbureauoff   

now you could with two elements in your florplan send 0 or 1, i need that for up and down the température.

thank you for your help farmio you give me the start of the solution.

have a good day

Hi , Im using turn_on and turn_off service and I found out that turn_on only send if state of the entity is off so if you want to setup a button that only send ON´s" it will not work ( like command to pulse output to open the gate) turn_off service do send always you call it .
Do you faced the same issue ?
my core version is 2021.5.5

I’d create a HA script using knx.send. This can send 1 or 0 repeated and has the same UI element as a scene.
Open your Home Assistant instance and show your scripts.

Thanks , Im using it on node red and workaround the issue with send service
What about trigger a flow with a general KNX commands that only send 0?
I would say we need ignore_internal_state on light commands …

Not really sure what you are trying to do.
For incoming a binary_sensor could do this I guess. So could knx_event.
If you want to send the 0 knx.send is the way to go again.
Why would this be needed on light? When it’s off, it’s off. You can’t turn it offer…

I took this approach as workaround , but this is not really the way KNX works
On KNX You can use several group addresses ( general house off, general room off, local on/off) and only local on/off have status.
so when you will replicate this “general commands” on HA as general commands are in fact only used to always send off as example and do not receive status they assume they are already off next time you command it and nothing happens .
Funny is that Lovelace turn off seems to work , only nodered not …

Such a “general off” button can be perfectly implemented as HA service. I don’t see where this would be an undesirable workaround.
The HA service represents a stateless trigger in HA.
You seem to try (I can only guess from your descriptions) to configure a HA light entity as “general off” light - which doesn’t work because a light in HA is a stateful entity whereas the Knx function is not →

But maybe I didn’t fully understand your approach.

That said there will always be some discrepancy between the HA entity model and KNX device functionality. Not even every manufacturers Knx devices behave similar in some respects.
The HA native way to control multiple lights is a group or area. These will turn off every active light individually - it will send one telegram per light. That’s not the “perfect” solution from knx eyes, but unless you want to turn off 40 lights at once you’ll be fine (if you did expect something like 1-2 seconds lag :man_shrugging: ).

(I don’t know how you use NodeRed but keep in mind it uses its own Knx integration that is completely separate to HAs.)