Skip to content

Berry questions: can i use a berry variable in tasmota.cmd? #22771

Answered by sfromis
forumlw06 asked this question in Q&A
Discussion options

You must be logged in to vote

Short answer, no you cannot use a Berry variable in a Tasmota command, as these are executed outside of Berry.

What you can do instead is to put the value of the variable in the command, like this use of f-strings:
tasmota.cmd(f'WebSend [m] script>D=16;P1={value}')

Using f-strings can also be quite handy for debugging print like:
print(f"-BE- DS1Handler ({value=} / {trigger=})")

As Berry integration tasmota.add_rule is unrelated to "classic" Tasmota rules, there are no similar space restrictions, and you need to make sure to have the Berry code setting up tasmota.add_rule (as with other Berry code) saved in the file system, as they are not persistent otherwise.

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@sfromis
Comment options

@forumlw06
Comment options

@sfromis
Comment options

@sfromis
Comment options

@forumlw06
Comment options

Answer selected by forumlw06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants