rstrouse / relayEquipmentManager

A hardware controller for GPIO, I2c, SPI, and generic devices.
GNU General Public License v3.0
36 stars 19 forks source link

Help setting up REM with ... #3

Closed DrJeff closed 3 years ago

DrJeff commented 3 years ago

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 commented 3 years ago

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

DrJeff commented 3 years ago

@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      | > relay-equipment-manager@0.0.0 start /home/pi/REM
0|REM      | > npm run build && node dist/app.js
0|REM      |
0|REM      |
0|REM      | > relay-equipment-manager@0.0.0 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 commented 3 years ago

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

DrJeff commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago
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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

Thanks 😄

rstrouse commented 3 years ago

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

DrJeff commented 3 years ago

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

rstrouse commented 3 years ago

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

DrJeff commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

rstrouse commented 3 years ago

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 commented 3 years ago

Just a LED

rstrouse commented 3 years ago

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

DrJeff commented 3 years ago

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

Yes

DrJeff commented 3 years ago

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

rstrouse commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

project that has been started called Nixie

I saw that on startup and was like OK but will look more now :grinning: 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 commented 3 years ago

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.

DrJeff commented 3 years ago

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.

Analog on Pi?

Your best bet is definitely getting the hat

👍🏽

is the nixie just located @ the port set in the config file or am I missing something it is enabled

      "valveRelay": {
        "name": "Valve Relays",
        "enabled": true,
        "fileName": "valveRelays.json",
        "vars": {
          "valveIds": []
        },
        "options": {
          "host": "0.0.0.0",
          "port": 8081
        },
1|poolController  | Init state for Pool Controller
1|poolController  | [3/12/2021, 11:34:40 AM] info: Starting up SSDP server
1|poolController  | [3/12/2021, 11:34:40 AM] info: Init http interface: Valve Relays
1|poolController  | [3/12/2021, 11:34:40 AM] info: Init mqtt interface: MQTT
1|poolController  | [3/12/2021, 11:34:40 AM] info: Init rem interface: Relay Equipment Manager
1|poolController  | [3/12/2021, 11:34:40 AM] info: Opening Relay Equipment Manager socket on http://rem.local:8080
1|poolController  | [3/12/2021, 11:34:40 AM] info: Initializing Nixie Controller
1|poolController  | [3/12/2021, 11:34:40 AM] info: Nixie Controller Initialized
1|poolController  | [3/12/2021, 11:34:40 AM] info: Server is now listening on 0.0.0.0:4200
1|poolController  | [3/12/2021, 11:34:40 AM] info: Net connect (socat) connected to: 192.168.0.241:5000
1|poolController  | [3/12/2021, 11:34:40 AM] info: Net connect (socat) ready and communicating: 192.168.0.241:5000
1|poolController  | [3/12/2021, 11:34:40 AM] silly: SSDP/UPnP Server started.
1|poolController  | [3/12/2021, 11:34:40 AM] info: New socket client connected MfPDqGCp-Trh_3w9AAAA -- 192.168.0.179
1|poolController  | [3/12/2021, 11:34:41 AM] info: New socket client connected IPdBAeumKQq1dKDWAAAB -- 192.168.0.53
1|poolController  | [3/12/2021, 11:34:41 AM] info: [11:34:41 AM] 192.168.0.53 GET /state/all {}
1|poolController  | [3/12/2021, 11:34:41 AM] info: [11:34:41 AM] 192.168.0.53 GET /state/all {}
1|poolController  | [3/12/2021, 11:34:41 AM] info: [11:34:41 AM] 192.168.0.53 GET /config/all {}
1|poolController  | [3/12/2021, 11:34:41 AM] info: [11:34:41 AM] 192.168.0.53 GET /config/all {}
1|poolController  | [3/12/2021, 11:34:43 AM] info: MQTT connected to mqtt://192.168.0.4:1883
rstrouse commented 3 years ago

I believe @tagyoureit used an ADSx chip (you can get them for a few cents on a breakout board).

You can disable the valve relays interface as this is for the IntelliValve when we finally get it decoded. Our roadblock is that after you send it 4 or 5 million commands, we believe the flash memory wears out and it stops responding to the buttons on the front of the valve.

I'll have a look at the Virtual OCP. It is probably not assigning equipment Ids for that controller as this was not originally the case with -webClient.

DrJeff commented 3 years ago

I believe @tagyoureit used an ADSx chip (you can get them for a few cents on a breakout board).

Duh, I wasn't thinking. Sometimes I can get really dumb :smile: Got those laying around I was stuck on I2c (mental block)

I'll have a look at the Virtual OCP. It is probably not assigning equipment Ids for that controller as this was not originally the case with -webClient.

OK thanks again

You can disable the valve relays interface as this is for the IntelliValve when we finally get it decoded. Our roadblock is that after you send it 4 or 5 million commands, we believe the flash memory wears out and it stops responding to the buttons on the front of the valve.

So thats different than nixie then?

rstrouse commented 3 years ago

So thats different than nixie then?

Yes Nixie is much more sophisticated than that. Simply set up a trigger for the relay with the valve event. It will take care of the diverted/non-diverted positions based upon the currently running circuits and features within the Nixie Control Panel (NCP). Currently we don't have a way for you to define Intake and Return valves for shared systems but that is one of the first orders of business when I get back to it. This will take into account Pool vs Spa vs Spillway modes and send the appropriate positioning information to REM to set the relays in their appropriate positions.

The idea with Nixie is to actually manage the pool/spa operation from within njspc while using REM to control the hardware bits.

DrJeff commented 3 years ago

I want in!

DrJeff commented 3 years ago

@rstrouse Got I2c connected to relay board and EZO, now how do I connect the I2c relays to njspc? To control them? Triggers?

There is no + to add then to triggers

Screen Shot 2021-03-15 at 2 47 25 PM Screen Shot 2021-03-15 at 3 15 18 PM

tagyoureit commented 3 years ago

This isn't implemented in the UI yet.

DrJeff commented 3 years ago

This isn't implemented in the UI yet.

Ok thanks

DrJeff commented 3 years ago

I setup Generic Devices Pressure Transducer and Ads1115 how does the voltage/psi get sent to the Generic device? Screen Shot 2021-03-18 at 9 31 09 AM Screen Shot 2021-03-18 at 9 35 39 AM

To use solar heating in Virtual Controller how is that set.

How Do I set Spillway in Virtual Controller

rstrouse commented 3 years ago

Create a feed from the ads channel to the generic device.

DrJeff commented 3 years ago

That works, simple.

rstrouse commented 3 years ago

If you pull the latest REM the triggers are enabled for i2c and GPIO over MQTT.

DrJeff commented 3 years ago

Sweeeeeet! Thanks again

rstrouse commented 3 years ago

I just checked in a javascript fix for when creating a new trigger. It wasn't showing the relay # when using an i2c relay.

After you are done adding your triggers go to the general tab and reset server. Right now it doesn't dynamically subscribe to MQTT topics or open/close new sockets.

DrJeff commented 3 years ago

Screen Shot 2021-03-21 at 11 09 49 PM Ok got some issues with I2c not sure what it is but I have no control over relays see the problem below is there a replay in REM. Also I couldn't figure out how REM CHEM was supposed to get the PH and ORP into njspc but figured that out with the feeds. 😀 Screen Shot 2021-03-21 at 11 06 55 PM But now I don't see how to use the Intellichlor60 for the ORP I check the box but what else do I need to do? Set the chlorine Generator to something?

Another thing to use Solar How do I do that with my setup I add it to Virtual Heaters but gives ID of -1. So how does njspc see it and use it? How is that tied to a relay I assume I can use a feed to njspc with the "name" I set but how do I turn it on from the front end njspc?

1|REM  | silly: Setting Dirty... true 12489
1|REM  | debug: Persisting Configuration data...
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | silly: Setting Dirty... true 2396
1|REM  | silly: Setting Dirty... true 2434
1|REM  | silly: Sending on MQTT Channel {"eventName":"  pool/state/chem/voltage","value":1.01}
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Atlas_EZO-pH command R bytes written:1 result:8.090
1|REM  | silly: Setting Dirty... true 3126
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Atlas_EZO-pH command T,? bytes written:3 result:?T,13.33
1|REM  | silly: Setting Dirty... true 3435
1|REM  | silly: Sending on MQTT Channel {"eventName":"pool/state/chem/ph","value":8.09}
1|REM  | verbose: Emitting: /chemController : {"pHLevel":8.09,"id":50}
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: ORP command R bytes written:1 result:747.5
1|REM  | silly: Setting Dirty... true 5224
1|REM  | silly: Sending on MQTT Channel {"eventName":"pool/state/chem/orp","value":747.5}
1|REM  | verbose: Emitting: /chemController : {"orpLevel":747.5,"id":50}
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | silly: Setting Dirty... true 7434
1|REM  | silly: Sending on MQTT Channel {"eventName":"  pool/state/chem/voltage","value":1.01}
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Atlas_EZO-pH command Status bytes written:6 result:?STATUS,P,4.98
1|REM  | silly: Setting Dirty... true 8797
1|REM  | silly: Setting Dirty... true 8798
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | verbose: 192.168.0.179 GET /state/device/generic:202:1 {}
1|REM  | info: [11:01:57 PM] 192.168.0.179 GET /state/device/generic:202:1 {}
1|REM  | getDeviceState: generic:202:1
1|REM  | verbose: 192.168.0.179 GET /status/device/i2c:1:5 {}
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | info: [11:01:57 PM] 192.168.0.179 GET /status/device/i2c:1:5 {}
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | verbose: 192.168.0.179 GET /status/device/gpio:1:36 {}
1|REM  | info: [11:01:57 PM] 192.168.0.179 GET /status/device/gpio:1:36 {}
1|REM  | verbose: 192.168.0.179 GET /status/device/i2c:1:4 {}
1|REM  | info: [11:01:57 PM] 192.168.0.179 GET /status/device/i2c:1:4 {}
1|REM  | verbose: 192.168.0.179 GET /status/device/gpio:1:38 {}
1|REM  | info: [11:01:57 PM] 192.168.0.179 GET /status/device/gpio:1:38 {}
1|REM  | verbose: 192.168.0.179 PUT /feed/device/i2c:1:4 {"tempF":56}
1|REM  | info: [11:01:57 PM] 192.168.0.179 PUT /feed/device/i2c:1:4 {"tempF":56}
1|REM  | verbose: 192.168.0.179 PUT /state/device/gpio:1:38 {"state":false}
1|REM  | info: [11:01:57 PM] 192.168.0.179 PUT /state/device/gpio:1:38 {"state":false}
1|REM  | setDeviceState: gpio:1:38 - {"state":false}
1|REM  | error: Could not set gpio state: setDeviceState: Error setting pin state: Error: ENODEV: no such device, read
1|REM  | verbose: 192.168.0.179 PUT /state/device/gpio:1:36 {"state":false}
1|REM  | info: [11:01:57 PM] 192.168.0.179 PUT /state/device/gpio:1:36 {"state":false}
1|REM  | setDeviceState: gpio:1:36 - {"state":false}
1|REM  | error: Could not set gpio state: setDeviceState: Error setting pin state: Error: ENODEV: no such device, read
1|REM  | debug: Atlas_EZO-pH command T,13.33 bytes written:7 result:
1|REM  | silly: Setting Dirty... true 10237
1|REM  | debug: Persisting Configuration data...
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
1|REM  | debug: ORP command Status bytes written:6 result:?STATUS,P,5.02
1|REM  | silly: Setting Dirty... true 1205
1|REM  | silly: Setting Dirty... true 1205
1|REM  | debug: Executed read command 0x12 byte read:0xff
1|REM  | debug: Executed read command 0x13 byte read:0xff
1|REM  | error: Multi-Relay Board Read Command: Invalid I2C command undefined
rstrouse commented 3 years ago

Which relay board do you have? I don't have all of these so the command list is from the documentation on the raw chip. It is interesting that the 0x12 and 0x13 registers are returning 0xFF. How many relays are on your board?

DrJeff commented 3 years ago

The relays are connected to an expansion board this is one of them, https://www.amazon.com/gp/product/B07JGSZJ73/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1

There are 8 relays on on one chip on another address there are 16 relays but both chips are mcp23017

I can see and control both chips from the same pi via Node Red

rstrouse commented 3 years ago

There should be only one chip with 2 8-bit registers on the mcp23017. Register 0x12 is for the first 8 I/O and register 0x13 for the second 8. Perhaps the I/O direction is not persisted on them when first set up.

DrJeff commented 3 years ago

There should be only one chip with 2 8-bit registers on the mcp23017. Register 0x12 is for the first 8 I/O and register 0x13 for the second 8. Perhaps the I/O direction is not persisted on them when first set up.

So re-setup only one even with different addresses?

rstrouse commented 3 years ago

Oh so you have 2 mcp23017 boards on different addresses for a total of 32 I/Os?