Comments (10)
Hi, can you please give some more details, especially which node you are talking about?
Have you already read the docs? There you can find a lot of information as well as examples.
from node-red-contrib-chronos.
i have readed all docs but i cant find info suitable for me, maybe you can point me to right direction :)
scheduler node.
from node-red-contrib-chronos.
Ok, so if I understand you correctly, you want to insert the contents of 'flow.boo' using some kind of templating language? This is not supported by the node, but why don't you just put a change node behind the scheduler node and replace payload by the contents of the flow variable? Or use a template node instead of the change node and pass the template to that node.
from node-red-contrib-chronos.
i dont want template anything if possible. i have stored ON/OFF commands for each hour and want them pass as payload. i just looked your example at docs https://github.com/jensrossbach/node-red-contrib-chronos/wiki/images/node_scheduler_output_fullmsg_json.png and thougth i can replace hardcoded payload to flow, global etc...
from node-red-contrib-chronos.
But your example of your initial description seems to be Mustache-like templates (using e.g. {{...}}
) and this is not supported by the scheduler node. You can only load a complete schedule from a context variable as described here. In this case one of your context variables should look like this:
// boiler_today_14
{
"trigger":
{
"type": "time",
"value": "14:00",
"offset": 0,
"random": false
},
"output":
{
"type": "fullMsg",
"value":
{
"topic": "topic/POWER1",
"payload": "ON"
}
}
}
In your node configuraton, you should then have something like this (just one schedule as example; the configured output is ignored / overridden by the context variable):
As already indicated earlier, I see additional alternatives:
- Use a change node to replace the
msg.payload
of the scheduler node output with the content of the flow variable:
[{"id":"68f53a5762cecd74","type":"tab","label":"Using change node","disabled":false,"info":"","env":[]},{"id":"ca4a493c254d90a4","type":"chronos-scheduler","z":"68f53a5762cecd74","name":"","config":"9c6224aade162652","schedule":[{"trigger":{"type":"time","value":"14:00","offset":0,"random":false},"output":{"type":"fullMsg","value":"{\"topic\": \"topic/POWER1\", \"payload\": \"\"}"}}],"multiPort":false,"disabled":false,"outputs":1,"x":270,"y":220,"wires":[["c438c5f3a945c98d"]]},{"id":"c438c5f3a945c98d","type":"change","z":"68f53a5762cecd74","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"boiler_today_14","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":220,"wires":[[]]},{"id":"9c6224aade162652","type":"chronos-config","name":"Home","sunPositions":[]}]
- Use a template node to replace the placeholder set in scheduler node by the content of the flow variable:
[{"id":"68f53a5762cecd74","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"ca4a493c254d90a4","type":"chronos-scheduler","z":"68f53a5762cecd74","name":"","config":"9c6224aade162652","schedule":[{"trigger":{"type":"time","value":"14:00","offset":0,"random":false},"output":{"type":"fullMsg","value":"{\"topic\":\"topic/POWER1\",\"template\":\"{{flow.boiler_today_14}}\"}"}}],"multiPort":false,"disabled":false,"outputs":1,"x":270,"y":220,"wires":[["e3855f6589b2456c"]]},{"id":"e3855f6589b2456c","type":"template","z":"68f53a5762cecd74","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"","output":"str","x":430,"y":220,"wires":[[]]},{"id":"9c6224aade162652","type":"chronos-config","name":"Home","sunPositions":[]}]
from node-red-contrib-chronos.
thanx for your input, appreciate it.
tried both suggestions. i really dont get how should i use change node if stored value and variable changing every hour :( in template node... i have now correct payload, but this solution is not passing topic to mqtt... pls advise.
edit: template still working. so all good for now. but i would love to see in the future possibility to use stored values as i explained.
from node-red-contrib-chronos.
Yes, you are right. The template node unfortunately does not passthrough the msg.topic
.
Could you maybe provide me a basic flow of what you want to achieve because it is not 100% clear to me how to evaluate the flow variable to be used.
from node-red-contrib-chronos.
but i got it working, i had just some typo... its working :)
trying to explain. we have electricity price which is changing every hour, depending price is low or high system calculates best hours to use for heat etc, i'm storing those values as on/off for every hour. 15.00 "ON", 16.00 "OFF" etc etc....
from node-red-contrib-chronos.
Great that it's working now. So what is your conclusion? Do you see this topic solved? If yes, could you please close the issue?
One hint for the future: topics like this here should better be placed into the discussion forum. Issues should only be used for bugs and feature requests.
from node-red-contrib-chronos.
@kuradi Please have a look at release 1.16.0 which I published today. Now you can specify the output using a JSONata expression which in fact allows you to include content from context variables.
For instance, taking your example from the beginning of this discussion, you can write something like this:
{
"topic": "topic/POWER1",
"payload": $flowContext("boo")
}
from node-red-contrib-chronos.
Related Issues (20)
- Delay node: Dynamic durations and until times from context variables HOT 3
- Repeat node: Dynamic repetition data and until times from context variables HOT 3
- Delay node: Add queued until output port HOT 1
- Repeat node: Add next message output port HOT 1
- Error on sending "reload" to Scheduler node HOT 3
- Angle of custom sun position with decimal value HOT 3
- time filter with multiple outputs HOT 3
- Elevation in config HOT 2
- Deprecated API warning: Calls to RED.util.evaluateJSONataExpression must include a callback HOT 6
- Able to receive environment variable on the config node (latitude and longitude) HOT 7
- SCHEDULER : Publish current event HOT 5
- Time Input to allow choose from global, flow, msg property value HOT 11
- Time Switch node reset itself with "Sun Position" based conditions HOT 1
- node status on scheduler block HOT 5
- scheduler node do not consistently apply offset HOT 4
- Offset value is only applied if it is divisible by 5 HOT 1
- Use Chronos Config to set date/time HOT 2
- The flows:started event listener is not removed when the node is closed HOT 2
- Local Time vs Server Time and Astronomical Phenomenon HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-red-contrib-chronos.