Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'vars' on Rules #2769

Merged
merged 1 commit into from
May 19, 2018
Merged

Fix 'vars' on Rules #2769

merged 1 commit into from
May 19, 2018

Conversation

ascillato
Copy link
Contributor

The 'vars' were not working from one rule to another because the declaration of the variable was not global and was being lost.

Problem shows when trying to make a thermostat as follows.

Inital config:

  • available physical button as button2
  • relay1 as controller
  • relay2 any unused pin (will be used as toggle memory for the status ON/StandBy of the thermostat)
  • button1 any unused pin
  • led1 as thermostat status (ON or StandBy)

On console:

Turn on rules
rule 1
check temp every minute
teleperiod 60
use power1 on mqtt messages
setoption26 1
dont save relay status on eeprom
setoption0 0
start all relays off
poweronstate 0

Rule:

On boot enable thermostat and enable start check of temp sensor connection
rule on system#boot do backlog event enabled=1; ruletimer1 70 endon

Set thermostat enable variable
on event#enabled do backlog var1; power2 %value%; ledpower %var% endon

An available button is configured as button2 and set also a relay 2 on any unused pin (to be used as a toggle memory to turn on and off the thermostat)
on power2#state do event enabled=%value% endon

check temp sensor connection. If fails, set to off and turn off thermostat. Also continue checking
on rules#timer=1 do backlog event enabled=0; ruletimer1 70; power1 0 endon

Resets checking timer if temperature is connected
on tele-am2301-12#temperature do ruletimer1 70 endon

Thermostat control - upper limit and lower limit
on tele-am2301-12#temperature>25 do power1 0 endon
on tele-am2301-12#temperature<24 do power1 %var1% endon

Thermostat can be turned on by:

  • pushing button2
  • by command on local console: event enabled=1
  • by command on any console: publish cmnd/topic/EVENT ENABLED=1
  • or MQTT at: publish cmnd/topic/EVENT ENABLED=1

Thermostat can be turned Off or by

  • pushing button2
  • by command on local console: event enabled=0
  • by command on any console: publish cmnd/topic/EVENT ENABLED=0
  • or MQTT at: publish cmnd/topic/EVENT ENABLED=0

Everything together:

INITIAL CONFIG:

backlog rule 1; teleperiod 60; setoption26 1; setoption0 0; poweronstate 0

RULES:

rule on system#boot do backlog event enabled=1; ruletimer1 70 endon on on event#enabled do backlog var1; power2 %value%; ledpower %var% endon on power2#state do event enabled=%value% endon on rules#timer=1 do backlog event enabled=0; ruletimer1 70; power1 0 endon on tele-am2301-12#temperature do ruletimer1 70 endon on tele-am2301-12#temperature>25 do power1 0 endon on tele-am2301-12#temperature<24 do power1 %var1% endon

The 'vars' was not working from one rule to another because the declaration of the variable was not global and was being lost.
@arendst arendst merged commit 85fcdcc into arendst:development May 19, 2018
@arendst
Copy link
Owner

arendst commented May 19, 2018

Great documentation!!! Thnx.

@ascillato ascillato deleted the patch-2 branch May 19, 2018 08:31
arendst added a commit that referenced this pull request May 19, 2018
5.14.0a
* Add feature information to Status 4
* Add tools folder with python script decode-status.py for decoding some
status fields like SetOption and Features
* Add python script fw-server.py in tools folder to create a simple OTA
server (#2759)
* Fix vars on rules (#2769)
* Fix bug in KNX menu (#2770)
curzon01 pushed a commit to curzon01/Tasmota that referenced this pull request Sep 7, 2018
curzon01 pushed a commit to curzon01/Tasmota that referenced this pull request Sep 7, 2018
5.14.0a
* Add feature information to Status 4
* Add tools folder with python script decode-status.py for decoding some
status fields like SetOption and Features
* Add python script fw-server.py in tools folder to create a simple OTA
server (arendst#2759)
* Fix vars on rules (arendst#2769)
* Fix bug in KNX menu (arendst#2770)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants