@Jos-Hendriks said in Node-red for pimatic available:
We could, however, create a node-red-pimatic plugin.
I have started a new project for this and I am planning to release a first version with limited functionality in the coming days.
node-red-contrib-pimatic
@Jos-Hendriks said in Node-red for pimatic available:
We could, however, create a node-red-pimatic plugin.
I have started a new project for this and I am planning to release a first version with limited functionality in the coming days.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig Great I was already looking at the specs for a node plugin for node-red and should not be that hard to convert.
@dynamite said in Node-red for pimatic available:
Great I was already looking at the specs for a node plugin for node-red and should not be that hard to convert
Yes, it is pretty much straightforward. At the moment I am trying to use the pimatic websocket API only which takes some time as it isn’t well documented. There will be a (hidden) controller node which will do all the comms with pimatic. The controller can be created or selected as a profile with the other nodes. This seems to be the best approach here as far as I can see.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
I have released a first version of the plugin for node-red! You can install it via “Manage Palette” as part of node-red. Just select the “install” tab and type “pimatic” in the “search modules” field.
Available nodes types are:
Device Action
calls a pimatic device action. Optionally, a parameter name andGet Variable
gets the value of the specified pimatic variable and sends it to theSet Variable
sets the received msg.payload
or a given value as the new value forController
is a supporting node type not shown in the palette. It manages the web socket"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
Great I have installed it in my Node Red
However I get an error message when trying to connect?
I have added a controller to my localhost (same raspberry)
I have added a get variable to test $Kaku.state
the error is: [deploy failed, no response from server]
Could you also explain the principle related to the action field of device action?
@dynamite said in Node-red for pimatic available:
the error is: [deploy failed, no response from server]
Where do you get this error message? Is it display below the node next to the red box?
Could you also explain the principle related to the action field of device action? The action is an action operation are operation on a device which can be called via the API. These are device method which have been declared as action of the device. See the SwitchActuator, for example:
class SwitchActuator extends Actuator
_state: null
actions:
turnOn:
description: "Turns the switch on"
turnOff:
description: "Turns the switch off"
changeStateTo:
description: "Changes the switch to on or off"
params:
state:
type: t.boolean
toggle:
description: "Toggle the state of the switch"
getState:
description: "Returns the current state of the switch"
returns:
state:
type: t.boolean
Below is an example of node which calls changeStateTo on a switch device. The action parameter value is sent in (msg.payload) using a dashboard switch.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
Perhaps it is easier for most users to use action expressions as used with rule actions. Thus I am planning to add other node type for this which then allows for soemthing like “switch edi-1 {{ msg.payload }}”
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig Hi thanks for the explanation, however I need to fix the connection first.
If I hit the deploy butten I get the error message in node-red top center screen: deploy failed …
And under the variable device there is a message: parameter not found.
@dynamite said in Node-red for pimatic available:
And under the variable device there is a message: parameter not found.
Are you sure it is “parameter not found”?
If it is “variable not found” may be you provided the variable name with leading $
sign? In case, remove the $
sign from the node configuration, e.g. write “responseTime” instead of “$responseTime”. Also avoid leading spaces
The next version will handle this automatically.
EDIT: Make sure to “Deploy” each time you make configuration changes to apply them.
EDIT2: I have a published a new version. When you reload the node-red in the browser, “Managed Palette” should highlight the update on the “Nodes” tab. When the update has been installed you’ll need to restart node-red.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig
It was indeed variable not found! However adding/removing the $ does not make a difference
I also tried the device action:
But during deploying it gives me the error message…
(deploy failed no response from server) in red top middle of the screen.
The config for the controller looks like this:
I have ran an dist-update to the system and a reboot and now things are starting to work!
@dynamite said in Node-red for pimatic available:
I have ran an dist-update to the system and a reboot and now things are starting to work!
Ah, OK. Did the “variable not found” error disappear?
How about the action? Are you still getting this “deploy failed no response from server” error from node-red?
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@dynamite said in Node-red for pimatic available:
But now I try it again but no response…?
Before you start the node-red server you can set environment variable PIMATIC_DEBUG
to some value to enable debug output on the console. Maybe you can redirect this to a file and send me the output and the flow file?
Here es an example I use for updating a dashboard UI switch widget and for executing an action when the switch widget is flipped.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig Hi can you tell me which plugin you have used for the switch?
I looks like my nodered is not running stable anymore? If I hit the deploy just after starting, no problem green message. But it stops after a while and I can not make any connection and have to restart. Don’t know if it is related to the dist-upgrade or the plugin install.
@dynamite said in Node-red for pimatic available:
But it stops after a while and I can not make any connection and have to restart. Don’t know if it is related to the dist-upgrade or the plugin install.
That’s strange. I have tested on Raspi 3 and Windows including a long running test without problems! Which version of node-red are you using? Is it the latest version available (0.17.4 at the time of writing)? If not, you should update.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig Hi, no it is not the latest version. It is still 15.something. I was already looking for the update procedure. (any hints on that?)
@dynamite said in Node-red for pimatic available:
I was already looking for the update procedure. (any hints on that?)
How did you install node-red?
sudo npm install -g node-red
?
If yes, just execute that again and it should install the latest version. To be safe make backups of your flows first.
EDIT: If you run node-red on user pi
the flows should be located in /home/pi/ .node-red
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig It took some effort to upgrade as I installed it by apt-get package. And upgrading as mentioned did not do the complete trick.
I have been able to build the test setup as mentioned earlier and it works!
But… I am still having stability issues.
edit1 If I restart node-red and the first time hit save I get a green bar succesfull.
If I hit the deploy again after a shift of a node I get an error message and I cannot acces node red anymore.
edit2 If I enable deploy on modified nodes I don’t get the error message.
@dynamite said in Node-red for pimatic available:
edit1 If I restart node-red and the first time hit save I get a green bar succesfull.
If I hit the deploy again after a shift of a node I get an error message and I cannot acces node red anymore.
edit2 If I enable deploy on modified nodes I don’t get the error message.
Strange, I need to reproduce that. Can you please let me know which node version you run. Ideally, please post the first lines of the node-red log output which should look as shown in the example below. Are you running a current Raspbian distribution?
17 Jul 22:18:19 - [info] Node-RED version: v0.17.4
17 Jul 22:18:19 - [info] Node.js version: v4.7.3
17 Jul 22:18:19 - [info] Windows_NT 10.0.15063 x64 LE
17 Jul 22:18:20 - [info] Loading palette nodes
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig
Hi here is the log when I start up node-red at my pimatic:
18 Jul 08:58:30 - [info] Node-RED version: v0.17.4
18 Jul 08:58:30 - [info] Node.js version: v4.6.2
18 Jul 08:58:30 - [info] Linux 4.9.35-v7+ arm LE
18 Jul 08:58:31 - [info] Loading palette nodes
18 Jul 08:58:34 - [info] Dashboard up and running
18 Jul 08:58:34 - [info] node-red-contrib-pimatic@1.0.2 started
node-telegram-bot-api deprecated Node.js v5.x and below will no longer be supported in the future module.js:409:26
18 Jul 08:58:37 - [info] Dashboard version 2.4.3-beta started at /ui
18 Jul 08:58:40 - [info] Settings file : /home/pi/.node-red/settings.js
18 Jul 08:58:40 - [info] User directory : /home/pi/.node-red
18 Jul 08:58:40 - [info] Flows file : /home/pi/.node-red/flows_RASPI3.json
18 Jul 08:58:40 - [info] Server now running at http://127.0.0.1:1880/
18 Jul 08:58:40 - [info] Starting flows
18 Jul 08:58:40 - [info] [socketio-config:12fd9073.7fb54] Created server bind to Node-red port
18 Jul 08:58:41 - [info] Started flows
18 Jul 08:58:41 - [info] [mqtt-broker:cd46eff.89e6b1] Connected to broker: mqtt://192.168.178.10:1883
Basically it looks like the front end is crashing. As the process keeps running but I can not enter the front end anymore. This also happens after a while of running. I did not look into it but can I increase the debug level of node-red?
I do not want to upgrade node.js as this will give a conflict with pimatic? Or am I wrong about this?
@dynamite said in Node-red for pimatic available:
Basically it looks like the front end is crashing. As the process keeps running but I can not enter the front end anymore.
Which browser are you using?
It might be server-side issue though. Check memory usage and the ulimits for the user running node-red. Do you start node-red from the command line by typing “node-red” or does the apt package installation comes along with some sort of service wrapper?
This also happens after a while of running. I did not look into it but can I increase the debug level of node-red?
node-red has a verbose option which you can use if you start node-red from the command line: node-red -v.
I do not want to upgrade node.js as this will give a conflict with pimatic? Or am I wrong about this?
Yes, for the time being please stick to node 4.x which I am also running it here due to the pimatic limitations.
Can you pelase also let me know which non-core nodes (additional packages) you have installed? It might be a combination of packages causing the issue.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law