ir.getItem("ItemName").sendCommand(ON)

Why wouldn’t / shouldn’t this be made possible?

ir.getItem("ItemName").sendCommand(ON)

Limited time, lack of necessity, and limited resources! The sendCommand action is fully functional, so why would we need the method?

events.sendCommand("ItemName", str(ON))

Given ItemName as a DimmerItem, can I do this

events.sendCommand("ItemName", "100") 

instead of this:

events.sendCommand(ir.getItems("ItemName"), PercentType(100))

Yes… all combinations can be found here

1 Like

It’s more intuitive for those migrating from Rules DSL where we’ve spent years hammering into them that they should always use the method on the Item over the Action, there is even a section in the docs about it. I can’t say yet how big of a problem this is going to be for migrators in the future but I’m pretty certain that we will be seeing posts similar to above as more and more people migrate.

For those who are starting with Python to begin with, I agree, there is no need.

2 Likes

Indeed, that’s because of RulesDSL.

I wish there’s an equivalent of items.Item_Name (this returns the item’s state) that would represent the item itself, so that one can write it as something??.Item_Name.sendCommand(ON).

Ideally it would be: states.Item_Name to represent the item’s state, and items.Item_Name to represent the item object. Of course this would be impossible as it would break existing scripts.

I prefer this because the item is not represented by a string.