Skip to content

Commit

Permalink
* adjust github action
Browse files Browse the repository at this point in the history
* remove travis/appveyor
* (Apollon77) Optimize for js-controller 3.3
* (Apollon77) Add option to override the default ack flag in the message for OutNode
  • Loading branch information
Apollon77 committed Jul 16, 2021
1 parent 45591ee commit 583ddea
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [12.x, 14.x, 16.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
![Logo](admin/node-red.png)
# ioBroker node-red Adapter

![Number of Installations](http://iobroker.live/badges/node-red-installed.svg) ![Number of Installations](http://iobroker.live/badges/node-red-stable.svg) [![NPM version](http://img.shields.io/npm/v/iobroker.node-red.svg)](https://www.npmjs.com/package/iobroker.node-red)
[![Downloads](https://img.shields.io/npm/dm/iobroker.node-red.svg)](https://www.npmjs.com/package/iobroker.node-red)
[![Tests](https://travis-ci.org/ioBroker/ioBroker.node-red.svg?branch=master)](https://travis-ci.org/ioBroker/ioBroker.node-red)
![Number of Installations](http://iobroker.live/badges/node-red-installed.svg)
![Number of Installations](http://iobroker.live/badges/node-red-stable.svg)
[![NPM version](http://img.shields.io/npm/v/iobroker.node-red.svg)](https://www.npmjs.com/package/iobroker.node-red)

[![NPM](https://nodei.co/npm/iobroker.node-red.png?downloads=true)](https://nodei.co/npm/iobroker.node-red/)
![Test and Release](https://github.com/ioBroker/ioBroker.node-red/workflows/Test%20and%20Release/badge.svg)
[![Translation status](https://weblate.iobroker.net/widgets/adapters/-/node-red/svg-badge.svg)](https://weblate.iobroker.net/engage/adapters/?utm_source=widget)
[![Downloads](https://img.shields.io/npm/dm/iobroker.node-red.svg)](https://www.npmjs.com/package/iobroker.node-red)

Starts node-red instance and communicates with it.

Expand All @@ -26,6 +28,11 @@ This adapter uses the node-red server from https://github.com/node-red/node-red

## Changelog

### __WORK IN PROGRESS__
* (Apollon77) update to node-red 1.3.5
* (Apollon77) Optimize for js-controller 3.3
* (Apollon77) Add option to override the default ack flag in the message for OutNode

### 2.3.0 (2021-04-17)
* (Apollon77) BREAKING update from node-red-contrib-aggregator: topic is NOT converted to lowercase anymore!
* (Apollon77) update to node-red 1.3.2
Expand Down
21 changes: 0 additions & 21 deletions appveyor.yml

This file was deleted.

16 changes: 15 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
"name": "node-red",
"version": "2.3.0",
"title": "node-red",
"titleLang": {
"en": "node-red",
"de": "node-red",
"ru": "node-red",
"pt": "node-red",
"nl": "node-red",
"fr": "node-red",
"it": "node-red",
"es": "node-red",
"pl": "node-red",
"zh-cn": "node-red"
},
"news": {
"2.3.0": {
"en": "BREAKING update from node-red-contrib-aggregator: topic is NOT converted to lowercase anymore!\nupdate to node-red 1.3.2\nAdd done calls to OutNode",
Expand Down Expand Up @@ -267,7 +279,9 @@
"js-controller": ">=2.0.0"
}
],
"tier": 1
"tier": 1,
"connectionType": "none",
"dataSource": "none"
},
"native": {
"bind": "0.0.0.0",
Expand Down
1 change: 1 addition & 0 deletions nodes/ioBroker.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
<p>Connects to a ioBroker and publishes <b>msg.payload</b> either to the <b>msg.topic</b> or to the topic specified in the edit window. The value in the edit window has precedence.</p>
<p>If <b>msg.payload</b> contains an object it will be stringified before being sent.</p>
<p>If <b>msg.payload</b> contains "__create__", the object will be only created, but no value will be written.</p>
<p>If <b>msg.ack</b> if present (Boolean true/"true") overrides the default ack from the node config.</p>
<p>If <b>msg.stateName</b> is defined, the created object name will be set as this value. If <b>msg.stateName</b> is not defined, but <b>Name</b> is set, use this instead. If both node and msg do not set state name, the name will same as topic</p>
<p>If <b>msg.stateRole</b> is defined, the created object role will be set as this value. If <b>msg.stateRole</b> is not defined, but <b>Role</b> is set, use this instead.</p>
<p>If <b>msg.stateType</b> is defined, the created object common type will be set as this value. If <b>msg.stateType</b> is not defined, but <b>Type</b> is set, use this instead. If both node and msg do not set type, the type will be type of payload</p>
Expand Down
8 changes: 5 additions & 3 deletions nodes/ioBroker.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ module.exports = function(RED) {
id = adapter.namespace + '.' + id;
}

const msgAck = msg.ack !== undefined ? (msg.ack === 'true' || msg.ack === true) : node.ack

if (!ready) {
//log('Message for "' + id + '" queued because ioBroker connection not initialized');
nodeSets.push({node, msg});
Expand All @@ -396,7 +398,7 @@ module.exports = function(RED) {
// Create variable if not exists
if (node.autoCreate && !node.idChecked) {
if (!id.includes('*') && isValidID.test(id)) {
return checkState(node, id, assembleCommon(node, msg, id), {val: msg.payload, ack: node.ack}, isOk => {
return checkState(node, id, assembleCommon(node, msg, id), {val: msg.payload, ack: msgAck}, isOk => {
if (isOk) {
node.status({
fill: 'green',
Expand All @@ -419,7 +421,7 @@ module.exports = function(RED) {
// Check if state exists
adapter.getForeignObject(id, (err, obj) => {
if (!err && obj) {
adapter.setForeignState(id, {val: msg.payload, ack: node.ack}, (err, _id) => {
adapter.setForeignState(id, {val: msg.payload, ack: msgAck}, (err, _id) => {
if (err) {
node.status({
fill: 'red',
Expand Down Expand Up @@ -456,7 +458,7 @@ module.exports = function(RED) {
});
done();
} else {
setState(id, msg.payload, node.ack, (err, _id) => {
setState(id, msg.payload, msgAck, (err, _id) => {
if (err) {
node.status({
fill: 'red',
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,26 @@
"js2xmlparser": "^4.0.1",
"fs.notify": "^0.0.4",
"feedparser": "^2.2.10",
"mongodb": "^3.6.9",
"node-red-contrib-os": "^0.2.0"
"mongodb": "^3.6.10",
"node-red-contrib-os": "^0.2.1"
},
"dependencies": {
"node-red": "^1.3.5",
"node-red-dashboard": "^2.29.1",
"node-red-dashboard": "^2.30.0",
"node-red-contrib-aggregator": "^2.0.0",
"node-red-contrib-polymer": "^0.0.22",
"node-red-node-email": "^1.12.1",
"node-red-node-email": "^1.12.2",
"node-red-node-feedparser": "^0.2.1",
"node-red-node-sentiment": "^0.1.6",
"node-red-node-twitter": "^1.2.0",
"@iobroker/adapter-core": "^2.5.0"
},
"devDependencies": {
"@alcalzone/release-script": "^1.10.0",
"@alcalzone/release-script": "^2.2.0",
"axios": "^0.21.1",
"gulp": "^4.0.2",
"request": "^2.88.2",
"mocha": "^8.4.0",
"mocha": "^9.0.2",
"chai": "^4.3.4"
},
"bugs": {
Expand Down

0 comments on commit 583ddea

Please sign in to comment.