andrei-tatar / node-red-contrib-smartnora

Node Red Google Home integration
https://smart-nora.eu/
109 stars 24 forks source link

not able to dynamically add an action to notify #208

Closed tjerkhamer closed 2 years ago

tjerkhamer commented 2 years ago

Hello, First of all, really nice job with your work on SmartNora. I really like it.

But I can't get the actions on the notify working. It is possible to set an action in the node configuration, but when I want to set the action dynamically in the msg.payload, I receive an warning where the property is ignored.

I've tried a couple of configurations:

    actions: [{
        p: "OK", 
        v: "ok",
        vt: "str"
    }]

    actions: [{
        "p": "OK", 
        "v": "ok",
        "vt": "str"
    }]

    actions: [{
        label: "OK", 
        value: "ok"
    }]

    actions: [{
        Label: "OK", 
        Value: "ok"
    }]

but every time the warning is shown. Could you please help me? Capture

My user id is: gBVr0kBPJKMV5LrZuRH2DBTKETH2

andrei-tatar commented 2 years ago

Hi @tjerkhamer , Adding actions dynamically is not supported (yet). I can look into adding this.

The problem with dynamic actions is that you send some actions but by the time they are actioned, you may have sent another set of actions (and the output message is not passed all the way through).

tjerkhamer commented 2 years ago

I understand the issue you mentioned.

I've found a workaround, where I added a new notify node for each situation, but it's not the best situation. It does make me understand your issue.

I think it's the responsibility of the user to make sure the response for the action can be handled correctly, there should only be a warning/error log when it's not possible, but maybe I'm taking this too easy by assuming other users are smart enough to understand.

I'm new to node-red, but willing to help you and if I'm able, I wouldn't mind helping out by creating the support. (Just need some help with starting up)

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 14 days with no activity.

orelio1 commented 2 years ago

Hey is it possible to make a dimmer in nora red can only turn light on and off but not dim

Mvg Orelio

rgerrans commented 2 years ago

Just put it in as a switch instead.

On Tue, Sep 27, 2022 at 5:06 PM orelio1 @.***> wrote:

Hey is it possible to make a dimmer in nora red can only turn light on and off but not dim

Mvg Orelio

— Reply to this email directly, view it on GitHub https://github.com/andrei-tatar/node-red-contrib-smartnora/issues/208#issuecomment-1259722876, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOC2HF7HBYNINTX3RHACKLWAMLQRANCNFSM6AAAAAAQJYPBPU . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

andrei-tatar commented 2 years ago

@orelio1 not really related to this issue, but yes, you can just turn off "allow brightness control" and it will only be an on/off light.

image

andrei-tatar commented 2 years ago

@tjerkhamer Support for dynamic actions has been added. It's not in the documentation yet but here's a sample flow:

[{"id":"9807a439d37cb64d","type":"debug","z":"244894166ed790d5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1090,"y":660,"wires":[]},{"id":"50c307400296ca3b","type":"noraf-notify","z":"244894166ed790d5","tag":"","title":"Sample Title","body":"","icon":"","name":"","nora":"c38ae3d9.b9765","topic":"","actions":[],"closeNotification":false,"x":870,"y":660,"wires":[["9807a439d37cb64d"]]},{"id":"3b88a59d97a52f0e","type":"inject","z":"244894166ed790d5","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"actions\":[{\"title\":\"Test\",\"action\":\"Test Output\"},{\"title\":\"google\",\"action\":\"https://google.ro\"}]}","payloadType":"json","x":630,"y":660,"wires":[["50c307400296ca3b"]]},{"id":"c38ae3d9.b9765","type":"noraf-config","name":"Firebase [test group]","group":"test-desk","twofactor":"off","twofactorpin":"","localexecution":true,"structure":"","storeStateInContext":true,"disableValidationErrors":false}]
github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 14 days with no activity.

github-actions[bot] commented 2 years ago

This issue was closed because it has been inactive for 7 days since being marked as stale.