Skip to content

Commit

Permalink
Merge pull request #12 from Tom-Hirschberger/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Tom-Hirschberger authored Aug 20, 2024
2 parents 5a47fb0 + c35c790 commit 00cf435
Show file tree
Hide file tree
Showing 8 changed files with 570 additions and 62 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

MagicMirror² module which periodically calls configured scripts and sends the output as value of configurable notifications. The values can be displayed in modules like [MMM-ValuesByNotification](https://github.com/Tom-Hirschberger/MMM-ValuesByNotification).

Example scripts to read the temperature values of DHT11, DHT22, DS18B20, HTU21 or BME280 connected to the raspbarry or Miflora sensors in reach of bluetooth are included in the scripts directory. There is a documentation in the [scripts directory](./scripts/README.md), too.
Example scripts to read the temperature values of DHT11, DHT22, DS18B20, HTU21, SHT31d, SHTC3 or BME280 connected to the raspbarry or Miflora sensors in reach of bluetooth are included in the scripts directory. There is a documentation in the [scripts directory](./scripts/README.md), too.

## Basic installation

Expand Down
12 changes: 6 additions & 6 deletions node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ module.exports = NodeHelper.create({
if((typeof curCmdConfig["skips"] === "undefined") ||
(curCmdConfig["skips"] < self.cmdSkips[cmdIdx])
){

self.cmdSkips[cmdIdx] = 1

let curCommand = curCmdConfig["script"]

let modCommand = self.validateAndModifyPath(curCommand)

if ((modCommand.testPath == null) || fs.existsSync(modCommand.testPath)){
Expand All @@ -169,7 +169,7 @@ module.exports = NodeHelper.create({
isExecutable = false
}
}

if (isExecutable){
let curArgs = curCmdConfig["args"]
if(typeof curCmdConfig["args"] !== "undefined"){
Expand Down Expand Up @@ -207,7 +207,7 @@ module.exports = NodeHelper.create({
if (self.config.debug){
console.log(self.name+": Running "+ modCommand.thePath + " synchronous")
}

let spawnOutput = spawnSync(modCommand.thePath, curArgs, options)
returnCode = spawnOutput.status
output = spawnOutput.stdout
Expand Down Expand Up @@ -257,9 +257,9 @@ module.exports = NodeHelper.create({
console.log(self.name+": Postprocessing cmdIdx: "+cmdIdx)
console.log(self.name+": curCmdConfig: "+JSON.stringify(curCmdConfig))
console.log(output)
console.log(returnCode)
console.log("Return code: "+returnCode)
}

if(output !== null){
if (typeof curNotifications !== "undefined"){
if (self.validateConditions(curCmdConfig, output, returnCode)){
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MMM-CommandToNotification",
"version": "0.0.7",
"version": "0.0.8",
"description": "A MagicMirror² module which calls system-commands or scripts periodically and sends the output as notifications.",
"main": "MMM-CommandToNotification",
"dependencies": {},
Expand Down
Loading

0 comments on commit 00cf435

Please sign in to comment.