#KNX help

1 messages ยท Page 1 of 1 (latest)

drifting abyss
#

Ok. So, you're going to create a template binary sensor (in the UI)

craggy pewter
#

what the heck is this Thread? ๐Ÿ˜„ So we are outside of the main channel right

drifting abyss
#

Correct ๐Ÿ™‚

craggy pewter
#

im not wasting enough time with discord ๐Ÿ˜„

drifting abyss
#

Helps to keep things organized.

#

(I'm here way too much) lol

#

Ok, so... in the UI in helpers, create a new helper, choose template and then template a binary sensor.

#

In the state template, you're going to use this, but you are going to change some things.

{% set ns = namespace(knx=[]) %}
{% for knx in states.climate|map(attribute="entity_id")|list %}
  {% if knx.startswith("climate.fbh_") %}
    {% set ns.knx = ns.knx + [state_attr(knx, "command_value")] %}
  {% endif %}
{% endfor %}
{{ (ns.knx | max) > 0 }}
#

So, the first thing is the knx.startswith("climate.home"). You're going to change that to knx.startswith("climate.fbh_").

craggy pewter
#

ok it gives a list

drifting abyss
#

Actually, paste in what I have now.

#

I edited it.

#

less typing lol

craggy pewter
#

ok i did. list shows all entities

#

(not just the ones above 0)

#

just in case

#

and it shows "off"

drifting abyss
#

Yup! Perfect.

#

Are any of your valves open right now?

craggy pewter
#

now i changed a setpoint temp and it went to "on"

drifting abyss
#

There ya go.

craggy pewter
#

thats hot

drifting abyss
#

So, you should now have a new entity: binary_sensor.[whatever you named it] that you can use in your automation. If it's on, then you have valves open. If it's off, all your valves are closed.

craggy pewter
#

so it is already like AND as well as OR logic that i need

drifting abyss
#

Plus, what I gave you is the "long" way of doing it. There are one-liners you can use to accomplish this. But, since you're learning, I felt it was better for you to see how it's done in a longer form.

#

Yup. Exactly.

#

Now you have a simple on/off to determine your valve status.

#

And iff you add or remove valves in the future, this will account for that automatically.

craggy pewter
#

very very nioce, thank you very mich

does this logic need "knx" stuff or is that just for me to better read?

drifting abyss
#

Well, it needs the knx stuff to target just your valves since they show up in the climate domain and you have other climate devices. Again, we could filter that out with a one-liner, but then it gets a little more complicated to read.

craggy pewter
#

ok understand

#

the icon now is a red "!" - did i miss something

drifting abyss
#

In the UI list?

#

Refresh the page.

craggy pewter
#

Refresh = solution ๐Ÿ˜„

and if i may ask something else.... how should i set up automations in general?

Im coming from a cyclic automation stuff (PLC) and i am not used to use triggers, but just the locig (like IF THEN)

#

like in this case, i should trigger something if this new sensor changes

and depending on the change i need to switch a switch

#

toggle a switch

#

๐Ÿ˜„

#

like new sensor goes off -> turn off a switch
new sensor goes on -> turn on a switch

(Switch is a modbus-switch that will turn on and off the pump)

drifting abyss
#
trigger:
  - platform: state
    entity_id: binary_sensor.value_group
    from: "off"
    to: "on"
    id: on
  - platform: state
    entity_id: binary_sensor.value_group
    from: "on"
    to: "off"
    id: off
#

Those 2 triggers in an automation will capture the new sensor you created going from off->on and on->off.

#

Then, in your action: sequence, you just use the trigger id in an if: block.

craggy pewter
#

if i create in UI, the yaml looks like this

(how to you enter code?)

drifting abyss
#
action:
  - if:
      - condition: trigger
        id:
          - on
    then:
      - action: switch.turn_on
        target:
          entity_id: switch.[whatever]
    else:
      - action: switch.turn_off
        target:
          entity_id: switch.[whatever]
#

In the automation, go to the far right dotsvertical menu and choose "Edit in YAML"

craggy pewter
#

alias: FBH Pumpe Aktivieren / Deaktivieren
description: ""
trigger:

  • platform: state
    entity_id:
    • binary_sensor.fbh_anforderung
      to: "on"
      for:
      hours: 0
      minutes: 0
      seconds: 5
      condition: []
      action:
  • action: switch.turn_on
    metadata: {}
    data: {}
    target:
    entity_id: switch.simaka_freigabe_heizkreis
    mode: single
#

thats created by UI. what about these ids and stuff?

I dont like to waste too much of your time ๐Ÿ˜•

#

binary_sensor.fbh_anforderung is the new binary template sensor

#

switch.simaka_freigabe_heizkreis is enabling the pump if true and switching off if false

drifting abyss
stable bayBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

drifting abyss
#

(for future reference ๐Ÿ™‚ )

#

So, take that if block that I posted up there and paste it into your automation.

craggy pewter
#

sorry, baby called

#

'''Test

drifting abyss
#

No worries!

craggy pewter
#

'''
Test
'''

#

i think i need to translate backticks ๐Ÿ˜„

#

thank you very much

drifting abyss
#

Usually the key above the TAB key ๐Ÿ˜‰

craggy pewter
#

so should i use the logic created by UI or your text logic?

#

in Germany there is the ยฐ and ^

drifting abyss
#

Either or. Whatever you feel comfortable with.

#

lol, yeah, I'm not using a German keyboard ๐Ÿ˜‰

craggy pewter
#

๐Ÿ™‚

#

what is the difference? Just to know

i see that you have a ID and i have a entity_id at the trigger part

#

ah no

drifting abyss
#

So, the entity_id is the entity that you are wanting to change (or trigger). The id: is called a trigger id and can be used to determine what trigger happened in your automation.

craggy pewter
#

i mixed i think trigger and action

#

so the id "on" and id "off" is to refer to that trigger when coding actions

drifting abyss
#

Ok, so here is what I would do for now. Create it all in the UI using the blocks. THEN, look at it in YAML. You'll get a better understanding of what is being generated.

#

Correct.

craggy pewter
#

sure, but as it does not generate the ids i thought to ask for it

drifting abyss
#

It can generate the ids. In your trigger block, there's a dotsvertical menu. Click it and hit "Edit ID"

craggy pewter
#

how long do you do this stuff?

#

๐Ÿ˜„

#

since when like

drifting abyss
#

Ummmm, a little over 9 years now? Give or take a few months.

craggy pewter
#

holy

#

ok

#

nice job

#

ยดยดยด
test
ยดยดยด

drifting abyss
#

So close... lol

craggy pewter
#
test
drifting abyss
#

hahaha

#

YES

craggy pewter
#

๐Ÿ˜„

drifting abyss
#

There!

craggy pewter
#

ive got this now

alias: FBH Pumpe Aktivieren / Deaktivieren
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.fbh_anforderung
    to: "on"
    for:
      hours: 0
      minutes: 0
      seconds: 5
    id: Trigger_FBH_Anforderung_ON
  - platform: state
    entity_id:
      - binary_sensor.fbh_anforderung
    to: "off"
    for:
      hours: 0
      minutes: 0
      seconds: 5
    id: Trigger_FBH_Anforderung_OFF
condition: []
action:
  - if:
      - condition: trigger
        id:
          - Trigger_FBH_Anforderung_ON
    then:
      - action: switch.turn_on
        target:
          entity_id: switch.simaka_freigabe_heizkreis
        data: {}
  - if:
      - condition: trigger
        id:
          - Trigger_FBH_Anforderung_OFF
    then:
      - action: switch.turn_off
        target:
          entity_id: switch.simaka_freigabe_heizkreis
        data: {}
mode: single
#

looks correct

drifting abyss
#

You don't need the second if: block. You can use else: in there.

craggy pewter
#

ok i can try that too

#

thank you very much

#

will this sidebar stay for me (or is it even public)?

drifting abyss
#

Yup. It'll be in the channel list on the left of your screen.

#

And you are most welcome. Happy to help!

craggy pewter
#

thanks great job im so happy

#

greetings to i guess USA

drifting abyss
#

Awesome. Glad to hear it! Yup. 08:24 in the morning here. ๐Ÿ™‚

craggy pewter
#

oh holy, you are so fit already? weve got 2:25pm

drifting abyss
#

hahaha yeah, I wake up early-ish and then work and stuff. Fun times ๐Ÿ™‚

craggy pewter
#

๐Ÿ™‚ then have some more fun. thanks

drifting abyss
#

lol oh, fun is not what I'm having right now. I have a HUGE script that I'm trying to debug/write better and HA is fighting me on it.

craggy pewter
#

are you doing that for living sort of or how come that youve got so much timE?

#

maybe we need to train copilot to be a HA master so we can just type what we want and AI gives us ๐Ÿ˜„

drifting abyss
#

I've been out of work for a couple of months, so I've had too much time to work on HA stuff. ๐Ÿ˜‰ But, yeah, this is a script for my house.

drifting abyss
craggy pewter
#

๐Ÿ˜„