Skip to content

Communication

The Pekaway System supports several ways of communication between devices. Please read below for detailed information.

HTTP API

With the HTTP API you can get information about the states and names of switches etc., as well as change the state and rename them. To request the HTTP API keep in mind, that you'll need the IP-address of your Raspberry Pi device and the port for Node-Red (standard is 1880). the following requests are supported:

Names:

  • GET /names - displays all names (as shown in frontend) and the respective global variables (used in backend)
  • PUT /names/<device>/<input>/<value> - set new names for the frontend, with <device> being the device you want to address, <input> the device number and <value> being the new name.
  • For the device you can use "relay", "wrelay", "dimmer", "level" or "temp", device number ( = <input>) can be 1-10
  • Example: PUT http://RPI-IP:1880/names/relay/3/Lights Kitchen - the name of relay 3 will then be shown as Lights Kitchen in the frontend

Battery:

  • GET /batt - displays current battery status

Level:

  • GET /level - displays current waterlevel status

Temperature:

  • GET /temp - displays current temperature status

Heater:

  • GET /heater - displays current heater status
  • PUT /heater/<truefalse> - turns the heater on or off, with truefalse being either true or false
  • PUT /heater/<truefalse>/<temp> - turns the heater on or off with a target temperature in Celsius, <temp> has to be set to a number between 12 and 35
  • PUT /heater/<truefalse>/<temp>/<time> - turns the heater on or off, with a target temperature and a timer in minutes, <time> has to be a number between 1 and 600. Notice that there is no timer counting down in the frontend, it only runs in the backend.

Relays:

  • GET /relay/<input> - displays current relay state of choosen relay, <input> can be one to ten, or 1 to 10 or all
  • GET /relay - displays all current relay states, same as GET /relay/all
  • PUT /relay/<input>/<value> - change the choosen relay state, <input> can be one to ten, or 1 to 10 and <value> has to be true or false for on/off
  • PUT /toggle/relay/<input> - toggle the choosen relay state, <input> can be one to ten, or 1 to 10, based on the current state it will turn either on or off

Wifi-Relays:

  • GET /wrelay/<input> - displays current wifi-relay state of choosen relay, <input> can be one to eight, or 1 to 8 or 'all'
  • GET /wrelay - displays all current wifi-relay states, same as GET /wrelay/all
  • PUT /wrelay/<input>/<value> - change the choosen wifi-relay state, <input> can be one to eight, or 1 to 8 and <value> has to be true or false for on/off
  • PUT /toggle/wrelay/<input> - toggle the choosen wifi-relay state, <input> can be one to eight, or 1 to 8, based on the current state it will turn either on or off

Dimmers:

  • GET /dimmer/<input> - displays the current dimmer state as a range from 0 to 100, <input> can be one to eight, or 1 to 8 or 'all'
  • GET /dimmer - displays all current dimmer states, same as GET /dimmer/all
  • PUT /dimmer/<input>/<value> - change the dimmer state, <input> can be one to eight, or 1 to 8 and <value> has to be a number between 0-100 (0 is off, 100 fully on)

MQTT API

A Mosquitto MQTT Broker is served on the standardport 1883. Please note that all topics and payloads are case sensitive! Also make sure there are no additional spaces in your payload. In the pekaway configuration tab there's a switch "Send stats via MQTT" - Turning it on will send all stats every 5min under topic pkw/tele/#. Use the following topics to address your devices:

Battery:

  • pkw/stat/batt - publishing anything to this topic will return current battery stats under pkw/tele/batt

Level:

  • pkw/stat/level - publishing anything to this topic will return current level stats under pkw/tele/level

Temperature:

  • pkw/stat/temp - publishing anything to this topic will return current temperature stats under pkw/tele/temp

Heater:

  • pkw/stat/heater - publishing anything to this topic will return current heater stats under pkw/tele/heater
  • pkw/cmnd/heater/POWER - publish a payload with "on" or "off" to this topic to turn the heater on or off
  • pkw/cmnd/heater/POWER/<temp> - publish a payload with "on" or "off" to this topic to turn the heater on or off with <temp> being the desired temperature from 12 to 35 in Celsius
  • pkw/cmnd/heater/POWER/<temp>/<time> - publish a payload with "on" or "off" to this topic to turn the heater on or off with a target temperature and a timer in minutes, <time> has to be a number between 1 and 600. Notice that there is no timer counting down in the frontend, it only runs in the backend.

Relays:

  • pkw/cmnd/relay/<input>/POWER - publish a payload with "on" or "off" to set the respective relay, with <input> being a number between 1 and 10

Wifi-Relays:

  • pkw/cmnd/wrelay/<input>/POWER - publish a payload with "on" or "off" to set the respective wifi-relay, with <input> being a number between 1 and 8

Dimmers:

  • pkw/cmnd/dimmer/<input>/POWER - publish a payload with "0" up to "100" to set the respective dimmer, with <input> being a number between 1 and 8

Homebridge

Homebridge is included in the Pekaway image and runs by default. You can turn it off in the config tab. The reason having it run by default is simply that on the very first boot it generates a new pin number. The pin can be shown in the frontend GUI (config tab) or you can reach the Homebridge admin panel on its standard port 8581. When your Raspberry Pi is in Access Point mode, Homebridge can also be reached at http://homebridge.van.pi (via nginx). If you turn Homebridge off it will stay deactivated even after reboot, until you turn it back on.

USB Serial & MULTIUART

Since many devices are using a serial interface to exchange data, the Pekaway system can connect to 2 USB-serial-adapters. Supported devices can be set via the frontend in the config tab. It is important to understand that the different devices are using different current levels!

On the Pekaway circuit boards we also brought out the UART3 port of the Raspberry Pi, which can be used for communication. We describe this port as "MULTIUART" and it can be connected to with a JST-PH (4 pin) plug.

MULTIUART can only handle 3.3V and max amps of 50mA!

MULTIUART PORT (JST CONNECTOR) is connected to /dev/ttyAMA1 (UART5) BREAKOUT UART

RaspberryPI4 UART overview

(RPI3 and Zero2 can only use UART1)

TXD1 - GPIO14 - Pin8 DISPLAY - UART1 TX1 RX1 BREAKOUT WHEN RASPBERRY ZERO RXD1 - GPIO15 - Pin10 DISPLAY - UART1 TX1 RX1 BREAKOUT WHEN RASPBERRY ZERO TXD2 - GPIO0 - Pin27 conencted to raspberry zero pads RXD2 - GPIO1 - Pin28 connected to raspberry zero pads TXD3 - GPIO5 - Pin29 - not in use RXD3 - GPIO4 - Pin7 - not in use TXD4 - GPIO8 - Pin24 connected to wemos esp port and breakout RX2 TX2 NOT WORKING NOW RXD4 - GPIO9 - Pin21 connected to wemos esp port and breakout RX2 TX2 NOT WORKING NOW TXD5 - GPIO12 - Pin32 Relayboard breakout TX5 RX5 + MultiUart RXD5 - GPIO13 - Pin33 Relayboard breakout TX5 RX5 + MultiUart

On our first PCBs (the blue ones) we used UART3 for the Multiuart.

To use these hardware UART you have to setup the "dtoverlay=uart2,uart3,uart4,uart5" on the boot/config.txt.

On the VANPI IMAGE we are using only UART5 because of software problems. This will be fixed soon.

USB SERIAL

To have a stable connection between you usb-serial-adapter we setup a udev rule to bind the specific usb-ports on the PI to a fixed serial device name. If you dont have fixed names for it sometimes after rebooting the system the connection where swapped.

/etc/udev/rules.d/

setupUDEV

setupUDEV

Victron

Devices of VictronCE send their stats every second using the VE.Direct interface. Currently the Pekaway System is lny able to read and display those values.

Victron Devices can be connected either via the MULTIUART or the USB interface.

Victron devices are using either 5V or 3.3V. It is important to not directly connect the 3.3V MULTIUART interface to a 5V device! It is crucial to have a level converter between them.

In our shop section we do offer USB adapters with integrated level convertes, which can be used with all Victron devices.!

For further details about Victron devices, Victron offers well written documentations regarding the protocols they are using.

Daly BMS

Daly BMS uses two communication protocols - bluetooth (6pin) and monit (3pin). Both protocols are built into the Pekaway system and can be set via the config tab. It will then show values for cell voltages, ampere, drift, total voltage, temperatures (only bluetooth) and state of charge.

If Daly BMS is connected via MULTIUART, there should be at least a 1k resistor soldered into the ground wire! Otherwise the ground circuit of the BMS will be bridged and the current will flow through th MULTIUART connection!

The Daly BMS has also a sleep function when no current is flow. You can disable it in your BMS app by set the sleeptime to 15300 or 65535.

Daly Bluetooth Protocol

Baudrate 9600

request frame: 0xD2 0x03 0x00 0x00 0x00 0x3E 0xD7 0xB9

answer

JBD BMS

coming soon

EACTIVE

comming soon

Back to top