Hi
I have an old KNX system with a tebis ts. I found out that i can switch off lights by adding a switch or a light but not turn on. In order to turn on i need to send payload [2, 12, 22, 32].
It works if i use the knx.send service then i can send it as an array, Is it possible to configure a switch or a light to send custom data for on/off. It only sends 0 or 1 now,
yes by wall switches.
Automation How? Can you intercept the outgoing event and change the payload?
I tried to make a template switch to call knx.send. But the template switch resets to onto off by auto because it needs value_template. How can i make a switch that just calls knx.send and pass adress and payload. Input boolean? Or can i just change the default payload for the knx switch in som file?
Ive managed to create an automation, but it is possible to load the adress dynamicly from the light. Otherwise i have to create one automation per light
id: ‘1566215459582’
alias: knx
trigger:
entity_id: light.knx_light
from: ‘off’
platform: state
to: ‘on’
condition: []
action:
data:
address: 1/0/11 //can this be dynamic?
payload:
2
12
22
32
service: knx.send
id: ‘1566215459582’
alias: knx
trigger:
entity_id: light.knx_light
from: ‘on’
platform: state
to: ‘off’
condition: []
action:
data:
address: 1/0/11 //can this be dynamic?
payload:
If you want to edit the knx implementation (eg. of light) for your needs:
Clone xknx and use it as a custom component
Replace the switch class in the light device with RemoteValueSensor with value_type ‘DPT-12’
and edit set_on() and set_off() to await self.switch.set(YourValueAsIntegerHere) and edit state().
Yes Int. DPT-12 will convert the raw bytes to int and vice versa - see xknx.knx.DPT4ByteUnsigned
[2, 12, 22, 32] -> 34742834
[0, 10, 20, 30] -> 1056816
The state will always be true because Python will evaluate eighter value as True -> bool(1056816) == True
so replace this with something like
if self.switch.value == 34742834:
return True
return False
I get an error when i use the wall switch. It seems like its trying to parse the message but fail i guess because the message is not standard knx. Do you know how to change so it can parse?
"2019-08-20 09:58:37 ERROR (MainThread) [xknx.log] Error while processing telegram <CouldNotParseTelegram description="payload invalid" device_name="Kontor höger taklampa" group_address="1/0/12" payload="<DPTArray value="[0x10]" />"/>"
Ive managed to create an automation, but it is possible to load the adress dynamicly from the light. Otherwise i have to create one automation per light
If you use scripts instead of automations you are able to pass on the address of a light as as variable