improvement:
1. add relay control by webpage
2. support http command for developer integrate to third-party software to tun on/off relay and read relay state.
3. add web config password
4. add read input state http command for developer integrate to third-party software. you can send http command to get information of 4 channel digital input port state.
Command is like this, send: http://192.168.1.xx/sw_ctl.cgi?RelayFF=R…pwd=XXXXXX
Then will feedback all state.
5. support use MQTT function by Ethernet or WiFi. it will easy integrate to third-party software, like home assistant…
how to integrate to home assistant by MQTT, see this link: https://www.kincony.com/kc868-h32b-integrate-home-assistant-by-mqtt.html
6. add option on config webpage, you can chose whether relay will remember the state before power off. Just whether receover relay sate when power on.
7. add option on config webpage, you can chose any relay channel for momentary work mode, and set the delay time for auto off. Relay “Momentary Time” extend to “1-10000 seconds”
8. add scan device Broadcast command for UDP. This command for software developer scan KC868-H4B in network.
use local network port=4000 send Ansi-String “scan” to remote IP:255.255.255.255 Port:4001
all KC868-H4B in same network device will feedback: device’s IP,Port,UID,type
for example:
send->scan
feedback: 192.168.1.200:4196,uid:xxxxxxxxxxxxxxxxxxxxxxxx,type:H4B
9. Improve the stability of anti-interference, if ethernet line failure by interference , now will automatic restart ethernet chip.
make sure your KC868-H4B metal box top lable have “AT” words, like this photo. so that have 256KB flash memory enough for update. If not use the MCU chip, if you can weld, replace the MCU will support new firmware.
if you use MQTT, as follows:
Set your ethernet for MQTT in network setting webpage, set the broker IP,Port, MQTT user name and password.
Example configuration.yaml entry for relay1 output:
switch:
– platform: mqtt
name: ‘relay4B-1’
unique_id: relay4B-1
state_topic: ‘relay4/xxxxxxxxxxxxxxxxxxxxxxxx/state’
command_topic: ‘relay4/xxxxxxxxxxxxxxxxxxxxxxxx/set’
payload_on: ‘{“relay1”:{“on”:1}}’
payload_off: ‘{“relay1”:{“on”:0}}’
value_template: ‘{{ value_json.relay1.on }}’
state_on: 1
state_off: 0
Example configuration.yaml entry for input1 sensor:
binary_sensor:
– platform: mqtt
name: ‘H4B-input1’
unique_id: H4B-input1
state_topic: ‘relay4/xxxxxxxxxxxxxxxxxxxxxxxx/state’
value_template: ‘{{ value_json.input1.on }}’
payload_on: 1
payload_off: 0
Note: xxxxxxxxxxxxxxxxxxxxxxxx is your KC868-H4B’s ID, it’s 24bit. You can find in controller’s config webpage.