sendCommand with a string

Welcome to the community!

Your sendCommand actions are identical, so it’s unclear as to what you’re trying to do. I think you meant to substitute your variable in the second version.

When you say it doesn’t work, what result do you get? The more detail you provide, the easier it is for others to help diagnose.

The best way to get started, in my opinion, is to search through the community and find examples of rules to study. If you don’t find something, just ask! In most cases, someone has tried that exact thing or something similar. As well, if you search for “design pattern”, you’ll find that some of our members have written great tutorials on how to accomplish specific tasks.

If you’re just getting started in openHAB, you might also want to skip right to using Jython rules, as this is the direction openHAB is moving. The current rule system will continue to work in the next version, but there are a lot of advantages to Jython. I haven’t jumped in yet, but there are lots of people to help if you run into troubles. This thread is a good place to start.