Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help setting up REM with ... #3

Closed
DrJeff opened this issue Mar 9, 2021 · 150 comments
Closed

Help setting up REM with ... #3

DrJeff opened this issue Mar 9, 2021 · 150 comments

Comments

@DrJeff
Copy link

DrJeff commented Mar 9, 2021

Help setting up REM to complement Virtual Pump, and IC60.
Ok my thoughts are to use this as my complete pool controller currently using nodejs-PoolController to operate the Pump and IC60 until a few days ago. Then I use an esp32 to control relays for actuators, heater, multiple pumps, blower, acid pump, Temperatures from 1 wire ds18b20, pressure from a transducer. Orp and PH from atlas. Just wondering what can be put into REM.

@DrJeff
Copy link
Author

DrJeff commented Mar 10, 2021

Can REM be used for recieving MQTT messages from esp32 for temps, pressure, and valves?

@DrJeff
Copy link
Author

DrJeff commented Mar 10, 2021

@rstrouse REM pins not saving with this error

0|REM      | error: Cannot read property 'setPinTriggerAsync' of undefined
0|REM      | Shutting down Relay Equipment Manager
0|REM      | info: Stopping GPIO Controller
0|REM      |
0|REM      | > [email protected] start /home/pi/REM
0|REM      | > npm run build && node dist/app.js
0|REM      |
0|REM      |
0|REM      | > [email protected] build /home/pi/REM
0|REM      | > tsc
0|REM      |

0|REM  | linux
0|REM  | info: Connecting mqtt to mqtt://192.168.0.4:1883
0|REM  | silly: Setting Dirty... true 214
0|REM  | info: Initializing GPIO Pins 2
0|REM  | info: Configuring Pin #40 Gpio #21:in on Header 1.
0|REM  | info: Pin #40 Gpio #21:in on Header 1 Configured.
0|REM  | info: Configuring Pin #3 Gpio #2:in on Header 1.
0|REM  | info: Pin #3 Gpio #2:in on Header 1 Configured.
0|REM  | info: Initializing SPI Bus #0
0|REM  | info: SPI Bus #0 Initialized
0|REM  | info: Initializing SPI Bus #1
0|REM  | info: SPI Bus #1 Initialized
0|REM  | info: Initializing i2c Interface
0|REM  | info: Detecting i2c Buses
0|REM  | silly: Setting Dirty... true 513
0|REM  | info: Server is now listening on 0.0.0.0:8080
0|REM  | info: Connected to njspc : http://192.168.0.179:4200
0|REM  | info: MQTT Connected to mqtt://192.168.0.4:1883
0|REM  | debug: Persisting Configuration data...
0|REM  | info: New socket client connected Vqa5M9nLEo7IMhLsAAAA -- 192.168.0.53
0|REM  | info: New socket client connected qLDhitNIZY1wqB4cAAAB -- 192.168.0.179
0|REM  | verbose: 192.168.0.53 PUT /config/pin/trigger/1/3 {"sourceId":1,"isActive":true,"id":0,"state":{"name":"on"},"eventName":"circuit","usePinId":false,"bindings":[{"binding":"id","isActive":true,"operator":"eq","bindValue":6},{"binding":"name","isActive":false,"bindValue":""},{"binding":"isOn","isActive":true,"operator":"eq","bindValue":true}],"expression":""}
0|REM  | info: [1:28:04 AM] 192.168.0.53 PUT /config/pin/trigger/1/3 {"sourceId":1,"isActive":true,"id":0,"state":{"name":"on"},"eventName":"circuit","usePinId":false,"bindings":[{"binding":"id","isActive":true,"operator":"eq","bindValue":6},{"binding":"name","isActive":false,"bindValue":""},{"binding":"isOn","isActive":true,"operator":"eq","bindValue":true}],"expression":""}
0|REM  | error: Cannot read property 'setPinTriggerAsync' of undefined

Also can temperatures be sent into it via MQTT? what topic?

@rstrouse
Copy link
Owner

Try running REM with sudo. Permissions are required to write to the io bus. There is a socket feed for pH temps.

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

Yes I'm running as root, still no joy. My system is virtual controller for intelliflo vs, and ic60 is that the issue and what can we do?
Screen Shot 2021-03-10 at 9 53 33 PM

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

@rstrouse
This is the dialog box that pops up
Screen Shot 2021-03-10 at 11 00 22 PM

MessageCannot read property 'setPinTriggerAsync' of undefined
TypeError: Cannot read property 'setPinTriggerAsync' of undefined
    at GpioPin.setPinTriggerAsync (/home/pi/REM/boards/Controller.ts:1100:24)
    at Gpio.setPinTriggerAsync (/home/pi/REM/boards/Controller.ts:790:66)
    at /home/pi/REM/web/services/Config.ts:254:44
    at Layer.handle [as handle_request] (/home/pi/REM/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/pi/REM/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/pi/REM/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/pi/REM/node_modules/express/lib/router/layer.js:95:5)
    at /home/pi/REM/node_modules/express/lib/router/index.js:281:22
    at param (/home/pi/REM/node_modules/express/lib/router/index.js:354:14)
    at param (/home/pi/REM/node_modules/express/lib/router/index.js:365:14)
    at param (/home/pi/REM/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/home/pi/REM/node_modules/express/lib/router/index.js:410:3)
    at next (/home/pi/REM/node_modules/express/lib/router/index.js:275:10)
    at /home/pi/REM/web/Server.ts:245:17
    at Layer.handle [as handle_request] (/home/pi/REM/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/pi/REM/node_modules/express/lib/router/index.js:317:13)

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

@rstrouse
Any thoughts on how to get these pins to work with the virtual controller. The pins react to REM via the gui pin on and off. I just can't tie them to nodejspc or I get that traceback error. I assume it's because of the Virtual controller but have no idea.

here is it running as root and that traceback error

TypeError: Cannot read property 'setPinTriggerAsync' of undefined
    at GpioPin.setPinTriggerAsync (/root/rem/boards/Controller.ts:1100:24)
    at Gpio.setPinTriggerAsync (/root/rem/boards/Controller.ts:790:66)
    at /root/rem/web/services/Config.ts:254:44
    at Layer.handle [as handle_request] (/root/rem/node_modules/express/lib/router/layer.js:95:5)
    at next (/root/rem/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/root/rem/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/root/rem/node_modules/express/lib/router/layer.js:95:5)
    at /root/rem/node_modules/express/lib/router/index.js:281:22
    at param (/root/rem/node_modules/express/lib/router/index.js:354:14)
    at param (/root/rem/node_modules/express/lib/router/index.js:365:14)
    at param (/root/rem/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/root/rem/node_modules/express/lib/router/index.js:410:3)
    at next (/root/rem/node_modules/express/lib/router/index.js:275:10)
    at /root/rem/web/Server.ts:245:17
    at Layer.handle [as handle_request] (/root/rem/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/root/rem/node_modules/express/lib/router/index.js:317:13)

@rstrouse
Copy link
Owner

This has nothing to do with njspc at this point. The GPIO pin is not being recognized Post your data/controllerConfig.json file here.

The other thing to do is reload the server and watch the console. You can do this by going to the general tab and clicking reload server.

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

root@rem:~/rem/data# cat controllerConfig.json
{
  "controllerType": "raspi",
  "gpio": {
    "pins": [
      {
        "id": 40,
        "headerId": 1,
        "isInverted": false,
        "direction": "output",
        "triggers": [],
        "feeds": [],
        "isActive": true,
        "name": "Pin #1-40",
        "state": "off"
      }
    ],
    "exported": [
      21
    ]
  },
  "spi0": {
    "isActive": false,
    "busNumber": 0,
    "channels": [],
    "referenceVoltage": 3.3,
    "spiClock": 1000
  },
  "spi1": {
    "isActive": false,
    "busNumber": 1,
    "channels": [],
    "referenceVoltage": 3.3,
    "spiClock": 1000
  },
  "i2c": {
    "isActive": false,
    "buses": [],
    "detected": [
      {
        "driver": "bcm2835 (i2c@7e804000)",
        "path": "/sys/class/i2c-dev/i2c-1",
        "name": "i2c-1",
        "busNumber": 1
      }
    ]
  },
  "connections": [
    {
      "id": 1,
      "isActive": true,
      "name": "nodejspc",
      "type": "njspc",
      "protocol": "http:",
      "ipAddress": "192.168.0.179",
      "port": 4200,
      "userName": "",
      "password": "",
      "sslKeyFile": "",
      "sslCertFile": "",
      "options": {}
    }
  ],
  "genericDevices": {
    "isActive": true,
    "buses": [],
    "detected": []
  },
  "lastUpdated": "3/11/2021, 10:51:25 AM",
  "configVersion": 1

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

and after a restart of server logs set to silly

0|REM  | info: Connected to nodejspc : http://192.168.0.179:4200
0|REM  | verbose: 192.168.0.53 PUT /config/reset {"controllerType":"raspi","app":{"level":"silly","logToFile":false},"spi0":{"isActive":false},"spi1":{"isActive":false},"name":"nodejspc","type":{"desc":"nodejs-PoolController"}}
0|REM  | info: [11:00:09 AM] 192.168.0.53 PUT /config/reset {"controllerType":"raspi","app":{"level":"silly","logToFile":false},"spi0":{"isActive":false},"spi1":{"isActive":false},"name":"nodejspc","type":{"desc":"nodejs-PoolController"}}
0|REM  | info: Stopping GPIO Controller
0|REM  | info: Initializing GPIO Pins 1
0|REM  | info: Configuring Pin #40 Gpio #21:out on Header 1.
0|REM  | info: Pin #40 Gpio #21:out on Header 1 Configured.
0|REM  | info: Initializing SPI Bus #0
0|REM  | info: SPI Bus #0 Initialized
0|REM  | info: Initializing SPI Bus #1
0|REM  | info: SPI Bus #1 Initialized
0|REM  | info: Initializing i2c Interface
0|REM  | info: Detecting i2c Buses
0|REM  | info: Detecting i2c Buses /sys/class/i2c-dev/i2c-1
0|REM  | silly: Setting Dirty... true 22286
0|REM  | debug: Persisting Configuration data...
0|REM  | info: Connected to nodejspc : http://192.168.0.179:4200

And after trying to connect the pin to a trigger see how it is actually working in the gui

0|REM  | verbose: 192.168.0.53 GET /config/options/gpio?null {}
0|REM  | info: [11:03:57 AM] 192.168.0.53 GET /config/options/gpio?null {}
0|REM  | verbose: 192.168.0.53 GET /config/options/pin/1/40?null {}
0|REM  | info: [11:03:59 AM] 192.168.0.53 GET /config/options/pin/1/40?null {}
0|REM  | verbose: 192.168.0.53 PUT /state/setPinState {"gpioId":21,"state":true}
0|REM  | info: [11:04:26 AM] 192.168.0.53 PUT /state/setPinState {"gpioId":21,"state":true}
0|REM  | info: Writing Pin #1:40 -> GPIO #21 to 1
0|REM  | silly: Setting Dirty... true 256299
0|REM  | debug: Persisting Configuration data...
0|REM  | verbose: 192.168.0.53 PUT /state/setPinState {"gpioId":21,"state":false}
0|REM  | info: [11:04:33 AM] 192.168.0.53 PUT /state/setPinState {"gpioId":21,"state":false}
0|REM  | info: Writing Pin #1:40 -> GPIO #21 to 0
0|REM  | silly: Setting Dirty... true 7505
0|REM  | debug: Persisting Configuration data...
0|REM  | verbose: 192.168.0.53 GET /config/options/trigger/1/40/0?null {}
0|REM  | info: [11:04:38 AM] 192.168.0.53 GET /config/options/trigger/1/40/0?null {}
0|REM  | verbose: 192.168.0.53 SEARCH /config/connection/bindings {"name":"njspc"}
0|REM  | info: [11:04:41 AM] 192.168.0.53 SEARCH /config/connection/bindings {"name":"njspc"}
0|REM  | verbose: 192.168.0.53 PUT /config/pin/trigger/1/40 {"sourceId":1,"isActive":true,"id":0,"state":{"name":"on"},"eventName":"circuit","usePinId":false,"bindings":[{"binding":"id","isActive":true,"operator":"eq","bindValue":6},{"binding":"name","isActive":false,"bindValue":""},{"binding":"isOn","isActive":true,"operator":"eq","bindValue":true}],"expression":""}
0|REM  | info: [11:05:04 AM] 192.168.0.53 PUT /config/pin/trigger/1/40 {"sourceId":1,"isActive":true,"id":0,"state":{"name":"on"},"eventName":"circuit","usePinId":false,"bindings":[{"binding":"id","isActive":true,"operator":"eq","bindValue":6},{"binding":"name","isActive":false,"bindValue":""},{"binding":"isOn","isActive":true,"operator":"eq","bindValue":true}],"expression":""}
0|REM  | error: Cannot read property 'setPinTriggerAsync' of undefined

@rstrouse
Copy link
Owner

Well look at that it isn't initializing the trigger definitions for events. I'll do some debugging to find out the path to this and post a fix. It is fine when the pin had a previous trigger.

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

Thanks 😄

@rstrouse
Copy link
Owner

Do a pull it should allow you to define the trigger on a new pin.

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

Yes it works now one more thing if using mqtt where are the topics? event name? How do i formulate it?
Thanks!

@rstrouse
Copy link
Owner

If you create an MQTT connection on the connections page, you can set whatever topic and payload you like as a feed.

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

Ok the feed is the payload, The pin is working in the gui for setting the gpio on and off (led), but when the trigger is happening (njspc logic) only gui shows the change the actual gpio (led) is not changing.

1|REM  | verbose: 192.168.0.53 GET /config/options/pin/1/40?null {}
1|REM  | info: [12:25:53 PM] 192.168.0.53 GET /config/options/pin/1/40?null {}
1|REM  | verbose: 192.168.0.53 GET /config/options/general?null {}
1|REM  | info: [12:25:59 PM] 192.168.0.53 GET /config/options/general?null {}
1|REM  | verbose: 192.168.0.53 PUT /config/reset {"controllerType":"raspi","app":{"level":"silly","logToFile":false},"spi0":{"isActive":false},"spi1":{"isActive":false},"name":"mqtt","type":{"desc":"MQTT Client"}}
1|REM  | info: [12:26:01 PM] 192.168.0.53 PUT /config/reset {"controllerType":"raspi","app":{"level":"silly","logToFile":false},"spi0":{"isActive":false},"spi1":{"isActive":false},"name":"mqtt","type":{"desc":"MQTT Client"}}
1|REM  | info: Stopping GPIO Controller
1|REM  | info: Initializing GPIO Pins 1
1|REM  | info: Configuring Pin #40 Gpio #21:out on Header 1.
1|REM  | info: Pin #40 Gpio #21:out on Header 1 Configured.
1|REM  | info: Connecting mqtt to mqtt://192.168.0.4:1880
1|REM  | silly: Setting Dirty... true 8205
1|REM  | info: Initializing SPI Bus #0
1|REM  | info: SPI Bus #0 Initialized
1|REM  | info: Initializing SPI Bus #1
1|REM  | info: SPI Bus #1 Initialized
1|REM  | info: Initializing i2c Interface
1|REM  | info: Detecting i2c Buses
1|REM  | info: Detecting i2c Buses /sys/class/i2c-dev/i2c-1
1|REM  | silly: Setting Dirty... true 8218
1|REM  | info: Connected to nodejspc : http://192.168.0.179:4200
1|REM  | info: Binding circuit from nodejspc
1|REM  | debug: Persisting Configuration data...
1|REM  | verbose: 192.168.0.53 GET /config/options/gpio?null {}
1|REM  | info: [12:26:04 PM] 192.168.0.53 GET /config/options/gpio?null {}
1|REM  | verbose: 192.168.0.53 GET /config/options/pin/1/40?null {}
1|REM  | info: [12:26:07 PM] 192.168.0.53 GET /config/options/pin/1/40?null {}
1|REM  | verbose: 192.168.0.53 DELETE /config/pin/trigger/1/40/2 {}
1|REM  | info: [12:26:12 PM] 192.168.0.53 DELETE /config/pin/trigger/1/40/2 {}
1|REM  | silly: Setting Dirty... true 7359
1|REM  | silly: Setting Dirty... true 7361
1|REM  | verbose: 192.168.0.53 GET /config/options/general?null {}
1|REM  | info: [12:26:14 PM] 192.168.0.53 GET /config/options/general?null {}
1|REM  | debug: Persisting Configuration data...
1|REM  | verbose: 192.168.0.53 PUT /config/reset {"controllerType":"raspi","app":{"level":"silly","logToFile":false},"spi0":{"isActive":false},"spi1":{"isActive":false},"name":"mqtt","type":{"desc":"MQTT Client"}}
1|REM  | info: [12:26:15 PM] 192.168.0.53 PUT /config/reset {"controllerType":"raspi","app":{"level":"silly","logToFile":false},"spi0":{"isActive":false},"spi1":{"isActive":false},"name":"mqtt","type":{"desc":"MQTT Client"}}
1|REM  | info: Stopping GPIO Controller
1|REM  | info: Initializing GPIO Pins 1
1|REM  | info: Configuring Pin #40 Gpio #21:out on Header 1.
1|REM  | info: Pin #40 Gpio #21:out on Header 1 Configured.
1|REM  | info: Connecting mqtt to mqtt://192.168.0.4:1880
1|REM  | silly: Setting Dirty... true 672
1|REM  | info: Initializing SPI Bus #0
1|REM  | info: SPI Bus #0 Initialized
1|REM  | info: Initializing SPI Bus #1
1|REM  | info: SPI Bus #1 Initialized
1|REM  | info: Initializing i2c Interface
1|REM  | info: Detecting i2c Buses
1|REM  | info: Detecting i2c Buses /sys/class/i2c-dev/i2c-1
1|REM  | silly: Setting Dirty... true 681
1|REM  | info: Connected to nodejspc : http://192.168.0.179:4200
1|REM  | info: Binding circuit from nodejspc
1|REM  | verbose: 192.168.0.53 GET /config/options/gpio?null {}
1|REM  | info: [12:26:18 PM] 192.168.0.53 GET /config/options/gpio?null {}
1|REM  | debug: Persisting Configuration data...
1|REM  | verbose: 192.168.0.53 GET /config/options/pin/1/40?null {}
1|REM  | info: [12:26:19 PM] 192.168.0.53 GET /config/options/pin/1/40?null {}
1|REM  | silly: Setting Dirty... true 5413
1|REM  | debug: Persisting Configuration data...
1|REM  | verbose: 192.168.0.53 GET / {}
1|REM  | verbose: 192.168.0.53 GET /config/options/general?null {}
1|REM  | info: [12:26:30 PM] 192.168.0.53 GET /config/options/general?null {}
1|REM  | info: New socket client connected t-dxzVAxZD2qD6z5AAAF -- 192.168.0.53
1|REM  | verbose: 192.168.0.53 GET /config/options/i2c?null {}
1|REM  | info: [12:26:30 PM] 192.168.0.53 GET /config/options/i2c?null {}
1|REM  | verbose: 192.168.0.53 GET /config/options/gpio?null {}
1|REM  | info: [12:26:32 PM] 192.168.0.53 GET /config/options/gpio?null {}
1|REM  | verbose: 192.168.0.53 GET /config/options/pin/1/40?null {}
1|REM  | info: [12:26:34 PM] 192.168.0.53 GET /config/options/pin/1/40?null {}

@rstrouse
Copy link
Owner

I am not sure I follow. If you turn on the circuit id you specified on the trigger from njspc it should be setting the gpio on the pi.

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

So the circuit is triggering the pi in REM's gui (pin state) but not REM's actual GPIO pin

@rstrouse
Copy link
Owner

Hmmm. I'm not sure how that can happen as the pin states are read back from the pi to ensure the setting is correct. Is this attached to a relay?

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

Just a LED

@rstrouse
Copy link
Owner

Did you create a trigger for the on state as well as the off state in REM?

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

Did you create a trigger for the on state as well as the off state in REM?

Yes

@DrJeff
Copy link
Author

DrJeff commented Mar 11, 2021

Maybe after the update something is hanging around. I will reset/remove the data folder contents this evening and try again

@rstrouse
Copy link
Owner

Yeah that is odd. If the pin state is changed in the ui, it is driven by the return from the GPIO on the pi.

@rstrouse
Copy link
Owner

Do a pull on REM. There was a socket upgrade that was causing the GPIO to wait. You may have been seeing only the transition from the socket.

@DrJeff
Copy link
Author

DrJeff commented Mar 12, 2021

Do a pull on REM

Yes it is working!
Thanks

Now how to use mqtt. I see this page
Screen Shot 2021-03-11 at 9 50 58 PM

Screen Shot 2021-03-11 at 9 48 16 PM

I don't understand where you put the topic pool\state\pin\40 and where the payload will go? Filtered Expression? how to capture an on is it just {"value":"on"}?

@rstrouse
Copy link
Owner

rstrouse commented Mar 12, 2021

No this is the wrong wat to go about this. If you want to trigger a circuit you must do it from njspc. REM is along for the ride in your case, so a trigger from an MQTT broker is not applicable here. If you would like to publish data from REM in this case for use by other apps then simply add a Feed not a Trigger. For your use case, to trigger the activation of a circuit, do that by using the MQTT interface in njspc.

Now if this were something other than a controllable component of another system, then feel free to add MQTT triggers to control the pin because your REM device would be its master. To do that you put in the statement
return true; to set the desired state or return false; to not trigger the state. The closure -- the lines after => { to } -- is a full blown javascript closure in which you can put any logic you like. Just return true when you want to set the state selected in the dropdown above.

NOTE: Not setting the state simply means that the Desired State value is not set. It does not mean that it sets the opposite of it.

I get it that when you are referring to GPIO it is typically on/off however REM also does neat tricks with SPI and I2c devices that have a much greater data payload. Simple Example: a pH sensor has a temperature compensation value, the current slope, probe voltage, and status values. All of this is exposed through the REM trigger/feed interface.

@DrJeff
Copy link
Author

DrJeff commented Mar 12, 2021

Awesome Sauce you are Amazing! I get it now now i'm going to ask @tagyoureit if there is a way to add more features to njspc I can not add virtual circuits (I'm not using a real controller). Features work fine but my pumps extra speeds (4) are being used as features. I need about 17 features for valves and relays. I really want to get my PH and ORP working on this next. I need to order new carrier boards just running current setup on breadboard.

@rstrouse
Copy link
Owner

There is a project that has been started called Nixie. In fact when you boot njspc you will see a message saying Initializing Nixie controller. What this is is a virtual controller that has the ability for manage bodies, circuits, features, groups, schedules, valves, heaters, remotes... etc.

If you go to the config pages you can add virtual valves. The way valves work is that they are triggered by circuits or features. From there you can have it trigger either an I2c or GPIO relay.

If you are using atlas gear I would suggest the Whitebox tentacle. It has 3 carriers for pH, ORP, and non-isolated temperature RTD. There are also 2 ports that can be used for EZO-PRS or any other I2c devices.

@DrJeff
Copy link
Author

DrJeff commented Mar 12, 2021

project that has been started called Nixie

I saw that on startup and was like OK but will look more now 😀 where do I get to that? I see it in the code https://github.com/tagyoureit/nodejs-poolController/tree/master/controller/nixie but how do I go about using it.

If you go to the config pages you can add virtual valves. The way valves work is that they are triggered by circuits or features. From there you can have it trigger either an I2c or GPIO relay.

Every time in dashPanel I get errors about ID this is for features but also Valves. Permissions? So to add features I used webClient.

1|poolController  | [3/12/2021, 10:57:33 AM] info: [10:57:33 AM] 192.168.0.53 PUT /config/feature {"id":-1,"nameId":202,"type":0,"showInFeatures":true,"freeze":false,"dontStop":true,"eggTimer":720}
1|poolController  | [3/12/2021, 10:57:33 AM] error: Invalid feature id: -1

Screen Shot 2021-03-12 at 10 23 07 AM

For atlas I have some isolated Gen1 boards and PH, ORP Embedded with cheap probes but the isolated boards were acting up so I breadboarded the embedded and worked fine for now. But Thinking of better setup with the Pi now and REM instead of esphome and a python script I stole.
Can pressure be an analog via arduino? something like this https://www.electronics-lab.com/build-i2c-sensor/
with a sensor like this?
https://www.amazon.com/Pressure-Transducer-Sender-Sensor-Stainless/dp/B074QPD5RT/ref=sr_1_30?dchild=1&keywords=water+pressure+sensor+i2c&qid=1615576416&s=industrial&sr=1-30

Can flow sensor be the IC60 flow sensor or need an external to get at that? any suggestions?

@rstrouse
Copy link
Owner

Your best bet is definitely getting the hat. The problem with I2c is that any cable length makes it ugly and the hat eliminates all that. In the next couple of weeks I will be testing an I2c extender that is supposed to make it square wave at 100+ feet.

Yes there is a pressure transducer device in REM under the Generic devices but why would you want to put that on an Arduino. You can just go direct from the pi. @tagyoureit has this setup running on his system right now.

@rstrouse
Copy link
Owner

rstrouse commented Apr 2, 2021

Pull njspc and lets see whether it obtains the available heater options. This will be in poolState,json under the bodies section and should look something like this.

    "bodies": [
      {
        "id": 1,
        "heatMode": {
          "val": 1,
          "name": "off",
          "desc": "Off"
        },
        "setPoint": 92,
        "name": "Pool",
        "circuit": 6,
        "heatStatus": {
          "val": 0,
          "name": "off",
          "desc": "Off"
        },
        "temp": 69,
        "isOn": true,
        "heaterOptions": {
          "total": 2,
          "gas": 1,
          "solar": 1,
          "heatpump": 0,
          "ultratemp": 0,
          "hybrid": 0,
          "maxetherm": 0,
          "mastertemp": 0
        },
        "type": {
          "val": 0,
          "name": "pool",
          "desc": "Pool"
        }
      },

@DrJeff
Copy link
Author

DrJeff commented Apr 3, 2021

Yes! It's there now.
Screen Shot 2021-04-02 at 9 30 54 PM

So I see the heaters with IDs of Gas=257 Solar=256 in poolState.json but can not trigger the relay to start gas heater, solar will have to try tomorrow

  "heaters": [
    {
      "id": 256,
      "isVirtual": true,
      "name": "Solar Heater",
      "type": {
        "val": 2,
        "name": "solar",
        "desc": "Solar Heater",
        "hasAddress": false
      },
      "isOn": false
    },
    {
      "id": 257,
      "isVirtual": true,
      "name": "Gas Heater",
      "type": {
        "val": 1,
        "name": "gas",
        "desc": "Gas Heater",
        "hasAddress": false
      },
      "isOn": false
    }
  ]

Now in REM I set a triggers to look for Event Name heater with id 257 but no go there? i did try with name as Gas Heater and gas but no go also.
Screen Shot 2021-04-02 at 9 32 34 PM

So close here are my poolState and Config attached
Oh yes the clocks working!! 😀
Archive.zip

Here is REM
controllerConfig.json.zip

@rstrouse
Copy link
Owner

rstrouse commented Apr 3, 2021

I’ll check the emitter tomorrow. The heater status isn’t being set. With the settings you are displaying the heat status should be Heater and a little gas flame should flicker next to the status.

@rstrouse
Copy link
Owner

rstrouse commented Apr 3, 2021

Ok pull njspc. After you do that switch the heat mode to off then back to heater. I saw a mismatch between the configuration and the state that would cause this as it checks integrity before emitting a state change like that.

@DrJeff
Copy link
Author

DrJeff commented Apr 3, 2021

Still no joy status stays off

@rstrouse
Copy link
Owner

rstrouse commented Apr 3, 2021

Are you seeing any errors in the njspc console?

@DrJeff
Copy link
Author

DrJeff commented Apr 3, 2021

none

1|poolController  | [4/3/2021, 10:10:10 AM] info: {"id":1216,"valid":true,"dir":"in","proto":"pump","pkt":[[],[255,0,255],[165,0,33,96,1,2],[9,16],[1,66]],"ts": "2021-04-03T10:10:10.502-0700"}
1|poolController  | [4/3/2021, 10:10:10 AM] info: [10:10:10 AM] 192.168.0.53 PUT /state/body/heatMode {"id":1,"mode":3}
1|poolController  | [4/3/2021, 10:10:10 AM] silly: MQTT send:
1|poolController  | topic: virtual-controller/state/temps/bodies/1/pool/heatMode
1|poolController  | message: {"heatMode":{"val":3,"name":"heater","desc":"Heater"}}
1|poolController  | opts:{"retain":true,"qos":0}
1|poolController  | [4/3/2021, 10:10:10 AM] verbose: Chem mixing acid remaining: 2hrs 52min 44sec
1|poolController  | [4/3/2021, 10:10:11 AM] verbose: Chem mixing acid remaining: 2hrs 52min 43sec
1|poolController  | [4/3/2021, 10:10:12 AM] info: {"id":1217,"valid":true,"dir":"out","proto":"chlorinator","pkt":[[],[],[16,2,80,17],[100],[215,16,3]],"ts":"2021-04-03T10:10:12.122-0700"}
1|poolController  | [4/3/2021, 10:10:12 AM] verbose: Wrote packet [16,2,80,17,100,215,16,3].  Retries remaining: 2
1|poolController  | [4/3/2021, 10:10:12 AM] info: {"id":1218,"valid":true,"dir":"in","proto":"chlorinator","pkt":[[],[],[16,2,0,18],[70,128],[234,16,3]],"ts": "2021-04-03T10:10:12.164-0700"}
1|poolController  | [4/3/2021, 10:10:12 AM] info: {"id":1219,"valid":true,"dir":"out","proto":"pump","pkt":[[],[255,0,255],[165,0,96,33,7,0],[],[1,45]],"ts":"2021-04-03T10:10:12.503-0700"}
1|poolController  | [4/3/2021, 10:10:12 AM] verbose: Wrote packet [255,0,255,165,0,96,33,7,0,1,45].  Retries remaining: 1
1|poolController  | [4/3/2021, 10:10:12 AM] debug: MQTT: Inbound virtual-controller/state/temps: {"solar":58}
1|poolController  | [4/3/2021, 10:10:12 AM] info: {"id":1220,"valid":true,"dir":"in","proto":"pump","pkt":[[],[255,0,255],[165,0,33,96,7,15],[10,0,0,3,22,9,16,0,0,0,0,0,1,9,0],[1,130]],"ts": "2021-04-03T10:10:12.554-0700"}
1|poolController  | [4/3/2021, 10:10:12 AM] debug: MQTT: Inbound virtual-controller/state/temps: {"air":55}
1|poolController  | [4/3/2021, 10:10:12 AM] debug: MQTT: Inbound virtual-controller/state/temps: {"waterSensor1":65}
1|poolController  | [4/3/2021, 10:10:12 AM] silly: MQTT send:
1|poolController  | topic: virtual-controller/state/time
1|poolController  | message: 2021-04-03T10:10:12.971-0700
1|poolController  | opts:{"retain":true,"qos":0}
1|poolController  | [4/3/2021, 10:10:13 AM] verbose: Chem mixing acid remaining: 2hrs 52min 42sec
1|poolController  | [4/3/2021, 10:10:13 AM] info: {"id":1221,"valid":true,"dir":"out","proto":"pump","pkt":[[],[255,0,255],[165,0,96,33,4,1],[255],[2,42]],"ts":"2021-04-03T10:10:13.096-0700"}
1|poolController  | [4/3/2021, 10:10:13 AM] verbose: Wrote packet [255,0,255,165,0,96,33,4,1,255,2,42].  Retries remaining: 1
1|poolController  | [4/3/2021, 10:10:13 AM] info: {"id":1222,"valid":true,"dir":"in","proto":"pump","pkt":[[],[255,0,255],[165,0,33,96,4,1],[255],[2,42]],"ts": "2021-04-03T10:10:13.170-0700"}
1|poolController  | [4/3/2021, 10:10:13 AM] info: {"id":1223,"valid":true,"dir":"out","proto":"pump","pkt":[[],[255,0,255],[165,0,96,33,6,1],[10],[1,55]],"ts":"2021-04-03T10:10:13.677-0700"}
1|poolController  | [4/3/2021, 10:10:13 AM] verbose: Wrote packet [255,0,255,165,0,96,33,6,1,10,1,55].  Retries remaining: 1
1|poolController  | [4/3/2021, 10:10:13 AM] info: {"id":1224,"valid":true,"dir":"in","proto":"pump","pkt":[[],[255,0,255],[165,0,33,96,6,1],[10],[1,55]],"ts": "2021-04-03T10:10:13.726-0700"}
1|poolController  | [4/3/2021, 10:10:14 AM] verbose: Chem mixing acid remaining: 2hrs 52min 41sec
1|poolController  | [4/3/2021, 10:10:15 AM] verbose: Chem mixing acid remaining: 2hrs 52min 40sec
1|poolController  | [4/3/2021, 10:10:15 AM] info: {"id":1225,"valid":true,"dir":"out","proto":"pump","pkt":[[],[255,0,255],[165,0,96,33,1,4],[2,196,9,16],[2,10]],"ts":"2021-04-03T10:10:15.691-0700"}
1|poolController  | [4/3/2021, 10:10:15 AM] verbose: Wrote packet [255,0,255,165,0,96,33,1,4,2,196,9,16,2,10].  Retries remaining: 1
1|poolController  | [4/3/2021, 10:10:15 AM] info: {"id":1226,"valid":true,"dir":"in","proto":"pump","pkt":[[],[255,0,255],[165,0,33,96,1,2],[9,16],[1,66]],"ts": "2021-04-03T10:10:15.741-0700"}
1|poolController  | [4/3/2021, 10:10:15 AM] silly: MQTT send:
1|poolController  | topic: virtual-controller/state/time
1|poolController  | message: 2021-04-03T10:10:15.974-0700
1|poolController  | opts:{"retain":true,"qos":0}
1|poolController  | [4/3/2021, 10:10:16 AM] info: {"id":1227,"valid":true,"dir":"out","proto":"chlorinator","pkt":[[],[],[16,2,80,17],[100],[215,16,3]],"ts":"2021-04-03T10:10:16.123-0700"}
1|poolController  | [4/3/2021, 10:10:16 AM] verbose: Wrote packet [16,2,80,17,100,215,16,3].  Retries remaining: 2
1|poolController  | [4/3/2021, 10:10:16 AM] verbose: Chem mixing acid remaining: 2hrs 52min 39sec
1|poolController  | [4/3/2021, 10:10:16 AM] info: {"id":1228,"valid":true,"dir":"in","proto":"chlorinator","pkt":[[],[],[16,2,0,18],[70,128],[234,16,3]],"ts": "2021-04-03T10:10:16.176-0700"}
1|poolController  | [4/3/2021, 10:10:16 AM] info: [10:10:16 AM] 192.168.0.53 PUT /state/body/heatMode {"id":1,"mode":0}
1|poolController  | [4/3/2021, 10:10:16 AM] silly: MQTT send:
1|poolController  | topic: virtual-controller/state/temps/bodies/1/pool/heatMode
1|poolController  | message: {"heatMode":{"val":0,"name":"off","desc":"Off"}}
1|poolController  | opts:{"retain":true,"qos":0}
1|poolController  | [4/3/2021, 10:10:16 AM] verbose: REM server request initiated. GET /state/device/generic:202:1
1|poolController  | [4/3/2021, 10:10:16 AM] verbose: REM server request returned. GET /state/device/generic:202:1
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: REM server request initiated. GET /status/device/i2c:1:5
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: REM server request returned. GET /status/device/i2c:1:5
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: REM server request initiated. GET /status/device/i2c:1:4
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: REM server request returned. GET /status/device/i2c:1:4
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: REM server request initiated. GET /status/device/i2c:1:6:3
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: REM server request returned. GET /status/device/i2c:1:6:3
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: Chem mixing acid remaining: 2hrs 52min 38sec
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: REM server request initiated. PUT /feed/device/i2c:1:4 {"tempF":65}
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: REM server request returned. PUT /feed/device/i2c:1:4 {"tempF":65}
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: Chem begin calculating demand: 7.716 setpoint: 7.6 body: 43000
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: REM server request initiated. PUT /state/device/i2c:1:6:3 {"state":false}
1|poolController  | [4/3/2021, 10:10:17 AM] verbose: REM server request returned. PUT /state/device/i2c:1:6:3 {"state":false}

@DrJeff
Copy link
Author

DrJeff commented Apr 3, 2021

Solar no errors but not status update in njspc or relay triggers in REM

1|poolController  | [4/3/2021, 10:42:36 AM] info: [10:42:36 AM] 192.168.0.53 PUT /state/body/heatMode {"id":1,"mode":5}
1|poolController  | [4/3/2021, 10:42:36 AM] silly: MQTT send:
1|poolController  | topic: virtual-controller/state/temps/bodies/1/pool/heatMode
1|poolController  | message: {"heatMode":{"val":5,"name":"solar","desc":"Solar Only"}}
1|poolController  | opts:{"retain":true,"qos":0}

Screen Shot 2021-04-03 at 10 44 29 AM

@rstrouse
Copy link
Owner

rstrouse commented Apr 3, 2021

Do another pull. I modified the logic so that things occur in sequence.

@DrJeff
Copy link
Author

DrJeff commented Apr 3, 2021

Still no joy here is the replay
replay-9.zip

The clocks still working! 😁

@DrJeff
Copy link
Author

DrJeff commented Apr 3, 2021

oh wait a pull at njspc correct? Noticed changes @ REM so pulled that also. Still no joy

@rstrouse
Copy link
Owner

rstrouse commented Apr 3, 2021

Alright just to be sure you were in heater mode at some point the output you posted showed the body heat mode as off. The status will always be off when the mode is off.

@DrJeff
Copy link
Author

DrJeff commented Apr 3, 2021

Alright just to be sure you were in heater mode at some point the output you posted showed the body heat mode as off. The status will always be off when the mode is off.

Yes, I did switch into Heater but status was off. Also Solar Only but status was off also

@rstrouse
Copy link
Owner

rstrouse commented Apr 3, 2021

Do a pull on njspc. I added some debug messages to the console when it is evaluating the heater states. Pull njspc and set the logging level to debug and send the log to a file. This is under the hamburger menu --> Logging --> Application section.

Then make several changes to the heat mode. This way I can see what is evaluated. My spare pi (which was my virtual test bed) is currently undergoing a facelift.

@DrJeff
Copy link
Author

DrJeff commented Apr 4, 2021

Huston we have a problem it's saying Heaters aren't associated with the Pool
replay-10.zip
Screen Shot 2021-04-03 at 10 07 16 PM

@rstrouse
Copy link
Owner

rstrouse commented Apr 4, 2021

Ok so this is helpful. Before I post a fix though I need you to change the Set Point to another value. Then look at the poolState.json and verify that it got changed in there.

@DrJeff
Copy link
Author

DrJeff commented Apr 4, 2021

with heater on here is the poolState.json

    "bodies": [
      {
        "id": 1,
        "heaterOptions": {
          "total": 2,
          "gas": 1,
          "solar": 1,
          "heatpump": 0,
          "ultratemp": 0,
          "hybrid": 0,
          "maxetherm": 0,
          "mastertemp": 0
        },
        "heatMode": {
          "val": 3,
          "name": "heater",
          "desc": "Heater"
        },
        "name": "Pool",
        "circuit": 6,
        "heatStatus": {
          "val": 0,
          "name": "off",
          "desc": "Off"
        },
        "isOn": true,
        "temp": 54,
        "setPoint": 99
      }
    ],
    "solar": 85,
    "waterSensor1": 54,
    "air": 55,
    "waterSensor2": 54
  },
  "status": {
    "val": 1,
    "name": "ready",
    "desc": "Ready",
    "percent": 100
  },
  "equipment": {
    "model": "Virtual Controller",
    "maxBodies": 1
  },

@DrJeff
Copy link
Author

DrJeff commented Apr 4, 2021

with heater off

    "bodies": [
      {
        "id": 1,
        "heaterOptions": {
          "total": 2,
          "gas": 1,
          "solar": 1,
          "heatpump": 0,
          "ultratemp": 0,
          "hybrid": 0,
          "maxetherm": 0,
          "mastertemp": 0
        },
        "heatMode": {
          "val": 0,
          "name": "off",
          "desc": "Off"
        },
        "name": "Pool",
        "circuit": 6,
        "heatStatus": {
          "val": 0,
          "name": "off",
          "desc": "Off"
        },
        "isOn": true,
        "temp": 64,
        "setPoint": 99
      }
    ],
    "solar": 96,
    "waterSensor1": 64,
    "air": 56,
    "waterSensor2": 55
  },
  "status": {
    "val": 1,
    "name": "ready",
    "desc": "Ready",
    "percent": 100
  },
  "equipment": {
    "model": "Virtual Controller",
    "maxBodies": 1
  },

@rstrouse
Copy link
Owner

rstrouse commented Apr 4, 2021

Perfect. It looks like the reason the setPoint on the state was 55 was because of the reload. Do a njspc pull, it looks like I figured out the associations for a virtual controller. If it doesn't work do the same steps as before with the console log in debug mode. We are narrowing down the final bits of data.

In my case the OCP is filling in the holes with the pool status message and if I turn it off all the other stuff complains. I need to get my Virtual controller back up and running. Not that replicating every setup can be done but this makes it easier.

@DrJeff
Copy link
Author

DrJeff commented Apr 4, 2021

YES!
That did it also works for Gas and changing relay
Thanks
Screen Shot 2021-04-04 at 11 29 48 AM
Screen Shot 2021-04-04 at 11 31 23 AM

@rstrouse
Copy link
Owner

rstrouse commented Apr 4, 2021

Awesome, I knew we would get to the bottom of it. Next we'll figure out that shared body function. Then the intake and returns will move appropriately and the spillway control will be automatic.

@DrJeff
Copy link
Author

DrJeff commented Apr 26, 2021

Wow! Nixie is here and is a beauty! @rstrouse and @tagyoureit how do i add a pump the dropdown menu for model is blank
missingmodel1
missingmodel2

@DrJeff
Copy link
Author

DrJeff commented Apr 26, 2021

Never mind I committed config and state bankruptcy and restarted now setting it all up! :)

@rstrouse
Copy link
Owner

Yeah I am sure we will need some little tweaks. That model dropdown isn't supposed to show for VS pumps. It should have a circuits setup to allow you to enter all the circuits that will control the pump speeds. I assume that after you restarted it showed you the proper interface. That model feature is for single speed and dual speed pumps so a power curve can be calculated for it.

@rstrouse
Copy link
Owner

rstrouse commented May 1, 2021

Moved to njspc on git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants