flic / node-red-contrib-hal2

A set of nodes to help with basic home automation logic
2 stars 1 forks source link

actions do not work with topic filter != "" #8

Closed RSWilli closed 2 years ago

RSWilli commented 2 years ago

actions don't do anything, when a topicfilter has been set

although you can choose the item to update, it wont actually update the item

without the topicfilter, the target thing will update all items to the value given to action, which is undesired in my opinion

flic commented 2 years ago

Not sure I understand what you mean. Can you show me an example of what you're trying to do?

RSWilli commented 2 years ago

image

I have a thermostat thing type and 5 thermostat things, each with a different id as attribute

I have set the topic filter for each of the items: battery, temp and target

I now want to set each of the items somehow and I figured I'd do it via the action node, where I can select an item and set a value either from payload or directly

image

but the action doesn't actually update the item, when a topicfilter is set

when I remove the topicfilter, all items get updated, not just the temp item

flic commented 2 years ago

Oh, okay, I see.

My thinking here is that a Thing represents a physical device. The input should be coming from the device, and the output should be sent out to the device. A command is supposed to be sent from the Thing to the device, hopefully result in a status change, which the device would then send out to be received by the Thing input, and thus update the Item value.

I realized fairly recently that there are scenarios where you'd want to create a virtual thing, for example a thing representing a scene, and so I added the option to loopback the command. It's pretty much a virtual wire connecting the Thing output to the Thing input, nothing more. As such, the command payload and topic must be formatted in a way that the input understands and accepts.

Try this:

Skärmavbild 2022-01-07 kl  15 58 23

I'm considering making it possible to update an item value directly, which I think is what you'd like to do, but it would break the concept of the Thing being a virtual representation of a physical device so I'm not sure. Still thinking about it.

flic commented 2 years ago

I made some changes in v1.8.0 that might be closer to what you want.

The value node can both get and set item values now. The item state is set directly without passing through any topic filters or ingress functions.

Skärmavbild 2022-01-08 kl  18 15 40