#KNX help
1 messages ยท Page 1 of 1 (latest)
what the heck is this Thread? ๐ So we are outside of the main channel right
Correct ๐
im not wasting enough time with discord ๐
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_").
ok it gives a list
ok i did. list shows all entities
(not just the ones above 0)
just in case
and it shows "off"
now i changed a setpoint temp and it went to "on"
There ya go.
thats hot
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.
so it is already like AND as well as OR logic that i need
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.
very very nioce, thank you very mich
does this logic need "knx" stuff or is that just for me to better read?
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.
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)
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.
if i create in UI, the yaml looks like this
(how to you enter code?)
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
menu and choose "Edit in YAML"
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:
- binary_sensor.fbh_anforderung
- 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
You're good. Don't worry about that.
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.
(for future reference ๐ )
So, take that if block that I posted up there and paste it into your automation.
No worries!
Usually the key above the TAB key ๐
so should i use the logic created by UI or your text logic?
in Germany there is the ยฐ and ^
Either or. Whatever you feel comfortable with.
lol, yeah, I'm not using a German keyboard ๐
๐
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
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.
i mixed i think trigger and action
so the id "on" and id "off" is to refer to that trigger when coding actions
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.
sure, but as it does not generate the ids i thought to ask for it
It can generate the ids. In your trigger block, there's a
menu. Click it and hit "Edit ID"
Ummmm, a little over 9 years now? Give or take a few months.
So close... lol
test
๐
There!
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
You don't need the second if: block. You can use else: in there.
ok i can try that too
thank you very much
will this sidebar stay for me (or is it even public)?
Yup. It'll be in the channel list on the left of your screen.
And you are most welcome. Happy to help!
Awesome. Glad to hear it! Yup. 08:24 in the morning here. ๐
oh holy, you are so fit already? weve got 2:25pm
hahaha yeah, I wake up early-ish and then work and stuff. Fun times ๐
๐ then have some more fun. thanks
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.
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 ๐
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.
That's kind of in the works already
๐