csuermann / node-red-contrib-presence-faker

Node-RED node that fakes presence in a smart home by switching devices (e.g. lights) on and off at random times.
MIT License
24 stars 2 forks source link

Feature Request: boolean vs string #27

Closed valbuz closed 3 years ago

valbuz commented 3 years ago

hi

is it also posible to send a boolean when the node is going to disable:

image

thanks pat

csuermann commented 3 years ago

Hi @valbuz,

If you configured your OFF message to emit something other than false, you could do the following:

image

[{"id":"6406390e.e8b888","type":"presence-faker","z":"3156dd60.366d12","name":"Presence Faker","onPayload":"ON","onPayloadType":"str","onTopic":"","offPayload":"OFF","offPayloadType":"str","offTopic":"","windowBegin":"07:30","windowEnd":"17:30","minDurationHours":0,"minDurationMinutes":"4","minDurationSeconds":0,"minDuration":"240","maxDurationHours":0,"maxDurationMinutes":"20","maxDurationSeconds":0,"maxDuration":"1200","minCount":1,"maxCount":1,"startupBehavior":"onStartup","actionOnDisable":"none","firstBlockType":"off","lastBlockType":"off","isLoggingEnabled":false,"x":1320,"y":540,"wires":[["e9097f8.517fa8"]]},{"id":"a575ec6c.78b72","type":"inject","z":"3156dd60.366d12","name":"disable PF","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":1120,"y":540,"wires":[["6406390e.e8b888","e34c777c.e92db8"]]},{"id":"e9097f8.517fa8","type":"debug","z":"3156dd60.366d12","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1630,"y":540,"wires":[]},{"id":"e34c777c.e92db8","type":"function","z":"3156dd60.366d12","name":"emit \"false\" when PF gets disabled","func":"if (msg.payload === false) {\n    return {\n        payload: false\n    }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1380,"y":600,"wires":[["e9097f8.517fa8"]]}]

Hope that helps!

valbuz commented 3 years ago

ok, it's a workaround...

Thanks you pat