Yes, but this is legacy HW which vás already working this way in my previous setup also i want to left heater valve intact, only adding WI-FI capabiliz
Maybe add one full second delay between all down cycles and all up cycles. Your hardware might be picky about very quick changes on rotary direction.
Also check your YAML indentation. It looks broken to me. Add logging between each command so you can be sure they are all executed.
I do half of the original cycles because I switch on AND off in one cycle while your original loop switches on in one cycle and off in the next (through modulo calculation). This is exactly what I meant: You don’t understand your original code. Without understanding you won’t be successful.
One seond delay addet → no change
Indentation checked → by 2 people other than me → correct
this is not nesesearry true since you are not dooing half of cicle since:
- Full circle is one wave so pin one on , pin tow on, pin one off, pin two off this is one full circle this is what you are doing right
- I was dooing half of that an by Z i was counting if pin should on and off.
- i really dont see what i am not understanding maybe there is some language barier, i am not native speeker so may be a am writin somethin whitch mean something els if you know what i mean
also if i try to add log to inside of repeat under then ESP stop responding i need to remove it and flash it over ota again to start comunicating!
Actual version of code:
sensor:
- platform: template
id: x
lambda: !lambda |-
return float(id(variable_temp));
output:
- platform: gpio
pin: 12
id: gpio_d1
- platform: gpio
pin: 13
id: gpio_d2
# Example single-point configuration entry (for heating only)
climate:
- platform: thermostat
name: "Thermostat Climate Controller"
id: temperature_sensor
sensor: x
default_target_temperature_low: 20 °C
min_heating_off_time: 300s
min_heating_run_time: 300s
min_idle_time: 30s
visual:
min_temperature: 0.5 °C
max_temperature: 30 °C
temperature_step: 0.5 °C
heat_action:
- logger.log: "Idle"
idle_action:
- logger.log: "Idle"
on_state:
- logger.log:
format: "The temperature set value %.1f virtual senzor %.1f global"
args: [ 'id(temperature_sensor).target_temperature', 'id(x).state']
- globals.set:
id: variable_temp
value: !lambda 'return id(temperature_sensor).target_temperature;'
- repeat:
count: 30
then:
- logger.log: "loop"
#- output.turn_on: gpio_d1
#- delay: 30ms
#- output.turn_on: gpio_d2
#- delay: 30ms
#- output.turn_off: gpio_d1
#- delay: 30ms
#- output.turn_off: gpio_d2
#- delay: 30ms
- logger.log: "null"
- delay: 1s
- repeat:
count: 26
then:
#- output.turn_off: gpio_d2
#- delay: 30ms
#- output.turn_off: gpio_d1
#- delay: 30ms
#- output.turn_on: gpio_d2
#- delay: 30ms
#- output.turn_on: gpio_d1
#- delay: 30ms
- logger.log:
format: "set %.1f "
args: [ 'id(x).state']
- delay: 1s
Ok, let’s go through that step by step:
Your OLD code:
int z = 0;
// Set temperature to OFF
for (uint8_t i = 0; i < 60; ++i)
{
digitalWrite(ROTARY_ENC_PIN_2, z);
delay(30);
digitalWrite(ROTARY_ENC_PIN_1, z);
delay(30);
z = (z + 1) % 2;
}
My NEW sketch:
- repeat:
count: 30
then:
- output.turn_on: gpio_d2
- delay: 30ms
- output.turn_on: gpio_d1
- delay: 30ms
- output.turn_off: gpio_d2
- delay: 30ms
- output.turn_off: gpio_d1
- delay: 30ms
OLD output:
Pin2: 0–1–
Pin1: –0–1 ... and repeats this 30 times
NEW output:
Pin2: 1–0–
Pin1: –1–0 ... and repeats this 30 times
So YES, there is a difference. But only in polarity.
Is it possible, that your encoder needs inverted signals on its inputs???
If so you can either set the GPIOs to inverted or you can swap the turn_on / turn_off commands in my example.
I am sorry to say but this is starting to consume way to much of my time. You have to find out these things for yourself. Sorry again.
I understand and thank zou for your time :]
what you writen was what i trzed to explayn i already triet to switch polarity. But problem is still the sma onlz first ever repeat section work!
I think there is indead language barier
I think ESP home is not really easy for those custome stuffs
Thanky for your help!
maybe someone else can sugest something
After going through your old code, this shouldn’t be too complicated.
Could you please tell how you wired the valves, so I can reproduce it? (preferably even a schematic or photo) Did you used any resistors or transistor?
Thanks