Intro
You can create automations through Thingsplex flows to control devices based on reports from the Energy Bank.
To access Thingsplex, please follow the Thingsplex guide.
If you make a flow that works well for you, and you want to share it with the rest of the Futurehome community, please do so in forum.futurehome.io.
Automation example
As an example, we have created an automation to change the mode to "charging" if solar panels produce more than 3000W.
The source code is available at the bottom of this document. To make this flow work for you, follow these steps:
- Copy the source code at the bottom of this document.
- Click on «import» in flows and paste the source code provided.
- Click on the if condition node. Under value, you can change the value of which you want the flow to differentiate. In the source code below it is set to 3000 W.
- You can also change the Trigger node to trigger the automation by another event, or the Action node to change the outcome of the flow.
- Save.
Source code
-
{
"Id": "jDtHzGOzAcwrXsx",
"ClassId": "jDtHzGOzAcwrXsx",
"Author": "",
"Version": 0,
"CreatedAt": "2020-11-19T12:16:41.016268639+01:00",
"UpdatedAt": "2021-01-20T11:20:29.590106341+01:00",
"Name": "Energybank example",
"Group": "energybank",
"Description": "if solar>3000",
"Nodes": [
{
"Id": "1",
"Type": "trigger",
"Label": "trigger",
"SuccessTransition": "2",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:dev/rn:energybank/ad:1/sv:inverter_solar_conn/ad:1",
"Service": "inverter_solar_conn",
"ServiceInterface": "evt.meter_ext.report",
"Config": {
"InputVariableType": "",
"IsValueFilterEnabled": false,
"LookupServiceNameAndLocation": false,
"PropFilterName": "",
"PropFilterValue": "",
"RegisterAsVirtualService": false,
"Timeout": 0,
"ValueFilter": {
"Value": null,
"ValueType": "float_map"
},
"ValueJPath": "",
"ValueJPathResultType": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": null
},
"Ui": {
"nodeType": "",
"x": 119,
"y": 230
},
"TypeAlias": "Trigger"
},
{
"Id": "2",
"Type": "transform",
"Label": "get_p_export",
"SuccessTransition": "4",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": "",
"IsRVariableGlobal": false,
"IsTargetVariableGlobal": false,
"IsTargetVariableInMemory": true,
"LVariableName": "",
"RValue": {
"Value": 0,
"ValueType": "int"
},
"RVariableName": "",
"Rtype": "var",
"TargetVariableName": "",
"TargetVariableType": "",
"Template": "",
"TransformType": "jpath",
"ValueMapping": [],
"XPathMapping": [
{
"IsTargetVariableGlobal": true,
"Path": "$.val.p_export",
"TargetVariableName": "p_export",
"TargetVariableType": "float",
"UpdateInputVariable": false
}
]
},
"Ui": {
"nodeType": "",
"x": 119,
"y": 372
},
"TypeAlias": "Transform"
},
{
"Id": "4",
"Type": "if",
"Label": "if_>_3000",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "",
"LeftVariableIsGlobal": true,
"LeftVariableName": "p_export",
"Operand": "gt",
"RightVariable": {
"Value": 3000,
"ValueType": "float"
}
}
],
"FalseTransition": "6",
"TrueTransition": "5"
},
"Ui": {
"nodeType": "",
"x": 119,
"y": 518
},
"TypeAlias": "If condition"
},
{
"Id": "5",
"Type": "action",
"Label": "Set energybank = charging",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:dev/rn:energybank/ad:1/sv:battery_charge_ctrl/ad:1",
"Service": "battery_charge_ctrl",
"ServiceInterface": "cmd.mode.set",
"Config": {
"DefaultValue": {
"Value": "charging",
"ValueType": "string"
},
"IsVariableGlobal": false,
"Props": "charging",
"RegisterAsVirtualService": false,
"ResponseToTopic": "",
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 53,
"y": 697
},
"TypeAlias": "Action"
},
{
"Id": "6",
"Type": "action",
"Label": "Set energybank = idle",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:dev/rn:energybank/ad:1/sv:battery_charge_ctrl/ad:1",
"Service": "battery_charge_ctrl",
"ServiceInterface": "cmd.mode.set",
"Config": {
"DefaultValue": {
"Value": "idle",
"ValueType": "string"
},
"IsVariableGlobal": false,
"Props": "charging",
"RegisterAsVirtualService": false,
"ResponseToTopic": "",
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 301,
"y": 697
},
"TypeAlias": "Action"
}
],
"Settings": null,
"IsDisabled": false,
"IsDefault": false,
"ParallelExecution": "parallel"
}
Comments
0 comments
Please sign in to leave a comment.