Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 9,252
» Latest member: avajoseph375
» Forum threads: 4,103
» Forum posts: 20,563

Full Statistics

Online Users
There are currently 66 online users.
» 0 Member(s) | 49 Guest(s)
Amazonbot, Applebot, Baidu, Bing, Bytespider, Google, HeadlessChrome, PetalBot, Scrapy, bot

Latest Threads
DM16 output not turning o...
Forum: DM16
Last Post: admin
1 hour ago
» Replies: 24
» Views: 2,736
KinCony Pi5M32 – Raspberr...
Forum: News
Last Post: admin
Yesterday, 10:40 AM
» Replies: 0
» Views: 9
RS485 issue
Forum: B4M
Last Post: admin
Yesterday, 02:04 AM
» Replies: 6
» Views: 47
KinCony Pi5R32 – Raspberr...
Forum: News
Last Post: admin
06-24-2026, 02:54 PM
» Replies: 0
» Views: 22
how to set "momentary" & ...
Forum: B16M
Last Post: admin
06-24-2026, 08:06 AM
» Replies: 0
» Views: 19
[Bug] A16v3 (v3.24.3) - W...
Forum: "KCS" v3 firmware
Last Post: savingguillemot
06-23-2026, 08:22 AM
» Replies: 2
» Views: 310
Switching power supply wi...
Forum: KC868-A16v3
Last Post: admin
06-22-2026, 11:34 PM
» Replies: 1
» Views: 37
KCS v3 - Remote modificat...
Forum: KC868-A16
Last Post: admin
06-22-2026, 05:13 AM
» Replies: 9
» Views: 473
"KCS" v3.25.4 firmware BI...
Forum: "KCS" v3 firmware
Last Post: admin
06-22-2026, 05:11 AM
» Replies: 0
» Views: 115
A24 configure yaml for ES...
Forum: KinCony A24
Last Post: admin
06-21-2026, 12:52 PM
» Replies: 29
» Views: 8,678

  Modbus
Posted by: charles.garand - 09-04-2024, 10:56 AM - Forum: Extender module - No Replies

Hi!

anybody had implement Modbus ?
I'm having hard time to get mine working.
I'm using esp32ModbusRTU library.

here is my code;

esp32ModbusRTU modbus(&Serial1, -1); 


void modbusTask(void *pvParameters) {
  Serial1.begin(4800, SERIAL_8N1, RX, TX); 
  printf("Serial1 initialized for Modbus\n");
  vTaskDelay(pdMS_TO_TICKS(1000)); 

    // callbacks  Modbus
    modbus.onData([](uint8_t serverAddress, esp32Modbus::FunctionCode fc, uint8_t* data, size_t length) {
        printf("Modbus Response Received - Server ID: 0x%02x, Function Code: 0x%02x, Length: %u\n", serverAddress, fc, length);
        for (size_t i = 0; i < length; ++i) {
            printf("%02x ", data[i]);
        }
        printf("\n");
    });

    modbus.onError([](esp32Modbus::Error error) {
        printf("Modbus Error: 0x%02x\n", static_cast<uint8_t>(error));
    });

   
    modbus.begin();
  vTaskDelay(pdMS_TO_TICKS(1000)); 

   
    while (true) {
        modbus.readHoldingRegisters(0x01, 0x0000, 4); 
        //vTaskDelay(pdMS_TO_TICKS(1000)); 
    }
}

extern "C" void app_main(void)
{
  vTaskDelay(6000 / portTICK_PERIOD_MS);
  printf("Hello world!\n");
 
    xTaskCreate(modbusTask, "modbusTask", 8192, NULL, 5, NULL);

    while (true) {
        std::cout << "In the while\n" << std::endl;
        //vTaskDelay(pdMS_TO_TICKS(1000));
    }

}

...
#include <esp32ModbusRTU.h>
#include "driver/uart.h"

// Declaration Modbus
esp32ModbusRTU modbus(&Serial1, 10); // 10 is arbitary GPIO because don't use RTS pin


void modbusTask(void *pvParameters) {
// Configurer la communication UART pour Modbus
Serial1.begin(4800, SERIAL_8N1, RX, TX); // Initialise Serial1
printf("Serial1 initialized for Modbus\n");
vTaskDelay(pdMS_TO_TICKS(1000)); // stabilisation time

// Configurer les callbacks de Modbus
modbus.onData([](uint8_t serverAddress, esp32Modbus::FunctionCode fc, uint8_t* data, size_t length) {

printf("Modbus Response Received - Server ID: 0x%02x, Function Code: 0x%02x, Length: %u\n", serverAddress, fc, length);

if (length % 2 != 0) {
printf("Invalid data length\n");
return;
}

for (size_t i = 0; i < length; i += 2) {
uint16_t value = (data[i] << 8) | data[i + 1];
if(i < 5)
value = value / 10;
printf("Register %zu: %u \n", i / 2, value);
}

printf("\n");
});

modbus.onError([](esp32Modbus::Error error) {
printf("Modbus Error: 0x%02x\n", static_cast<uint8_t>(error));
});

// start Modbus
modbus.begin();
vTaskDelay(pdMS_TO_TICKS(1000)); // wait 1 sec to stabilise

while (true) {
modbus.readHoldingRegisters(0x01, 0x0000, 5); // slave address: 0x01
vTaskDelay(pdMS_TO_TICKS(1000));
}
}

extern "C" void app_main(void)
{
xTaskCreate(modbusTask, "modbusTask", 8192, NULL, 5, NULL);

while (true) {
std::cout << "In the while\n" << std::endl;
vTaskDelay(pdMS_TO_TICKS(2000));
}

}

Print this item

Wink KC868-A16 Power Input Voltage 12V(24)?
Posted by: kisman - 09-02-2024, 05:01 PM - Forum: KC868-A16 - Replies (7)

Hello,
Is any reason why documentation explains that this board can be powered only with with 12V?.
I checked schematic view(LDO) and XL1509-5 can support 24V(input). Any other modules uses 5V or 3.3V.
Can I safely use 24V DC Power Supply instead of 12V? (I assume, that input logic will change from 12V to 24V). Is it safe or maybe I'm missing something?.
The input/output 24V logic is very popular in Europe Wink.

Print this item

  PZEM-004T With A6 on Serial
Posted by: Techno - 09-02-2024, 01:56 PM - Forum: KC868-A6 - Replies (11)

Howdy!

Thanks for the A6 Board, im using the second one already and i enjoy it.
I encountered a problem, connected PZEM-004T to Serial on A6 (GPIO12, 13)

When i power the board, it doesnt boot. I plug out the PZEM-004T from A6, it boots. I plug pzem back in. It works normaly, and i receive all the needed data.
What is the problem i have on boot?

pastebin code:
https://pastebin.com/Rbujh2R1

code:

Code:
esphome:
name: kotela6
friendly_name: KotelA6
libraries:
- "Wire"
- "ArduinoJson"

 
esp32:
board: esp32dev
framework:
type: arduino
 
 
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
 
 
 
logger:
 
api:
encryption:
key:
 
captive_portal:
 
ota:
password: "
 
#########################
 
uart:
- id: ubus1
tx_pin: GPIO13
rx_pin: GPIO12
baud_rate: 9600
stop_bits: 1
 
 
 
 
 
i2c:
sda: GPIO4
scl: GPIO15 # Change SCL to GPIO22 to avoid issues with GPIO15
scan: true
 
 
 
##########################
pcf8574:
- id: 'pcf8574_hub_out_1' # for output channel 1-8
address: 0x24
- id: 'pcf8574_hub_in_1' # for input channel 9-16
address: 0x22
pcf8575: false
 
 
#####################
time:
- platform: ds1307
id: rtc_time
 
 
sensor:
 
#### PZEM-004T V3 ####
 
- platform: pzemac
address: 1
current:
name: "pMeter_current"
accuracy_decimals: 2
voltage:
name: "pMeter_voltage"
accuracy_decimals: 2
power:
name: "pMeter_power"
unit_of_measurement: W
accuracy_decimals: 2
id: pMeter_power
frequency:
name: "pMeter_frequency"
unit_of_measurement: Hz
accuracy_decimals: 2
power_factor:
name: "pMeter_power_factor"
accuracy_decimals: 2
id: pMeter_power_factor
energy:
name: "pMeter_energy"
unit_of_measurement: Wh
accuracy_decimals: 1
id: pMeter_energy
update_interval: 5s
 
 
- platform: template
name: "pMeter_cumulative power"
unit_of_measurement: "kWh"
accuracy_decimals: 1
update_interval: 5s
icon: mdi:power
lambda: return (( (id(pMeter_energy).state)/1000.0));
 
- platform: total_daily_energy
name: "pMeter_of_day"
power_id: pMeter_power
unit_of_measurement: "kWh"
accuracy_decimals: 2
id: pMeter_power_of_day
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
icon: mdi:counter
 
- platform: template
name: "pMeter_veille"
id: template_pMeter_veille
unit_of_measurement: "kwh"
accuracy_decimals: 2
icon: mdi:power
update_interval: 10s
 
- platform: template
name: "pMeter_power_apparente"
id: pMeter_power_apparente
unit_of_measurement: "VA"
accuracy_decimals: 2
update_interval: 10s
icon: mdi:power
lambda: return ( (id(pMeter_power).state/id(pMeter_power_factor).state));
 
- platform: template
name: "pMeter_power_reactive"
id: pMeter_power_reactive
unit_of_measurement: "VAr"
accuracy_decimals: 2
update_interval: 10s
icon: mdi:power
lambda: return ( ( sqrt( (id(pMeter_power_apparente).state)*(id(pMeter_power_apparente).state) - (id(pMeter_power).state)*(id(pMeter_power).state) ) ) );
 
- platform: wifi_signal
name: "WiFi power_pMeter"
update_interval: 10s
 
- platform: uptime
name: "up"
id: uptime_sec
 
 
 
 
 
 
 
text_sensor:
- platform: template
name: pMeter_uptime
lambda: |-
int seconds = (id(uptime_sec).state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
icon: mdi:clock-start
update_interval: 113s
 
################################################# SENSOR
binary_sensor:
 
 
- platform: status
name: "pMeter_status"
- platform: gpio
name: "flood_elling"
icon: mdi:home-flood
pin:
pcf8574: pcf8574_hub_in_1
number: 0
mode: INPUT
inverted: true
 
- platform: gpio
name: "flood_pool"
icon: mdi:home-flood
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: gpio
name: "flood_pump"
icon: mdi:home-flood
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: gpio
name: "KC868-A6-IN-4"
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: gpio
name: "KC868-A6-IN-5"
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: gpio
name: "KC868-A6-IN-6"
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
 
 
################################################# RELAYS
switch:
 
- platform: restart
name: "pMeter_restart"
 
### KINCONY 1
- platform: gpio
name: "Boiler ten"
id: relay_1
icon: mdi:fan
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true
 
 
- platform: gpio
name: "free"
id: relay_2
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true
 
########################### ######### BOILER PUMP
- platform: gpio
name: "Boiler Pump"
icon: mdi:pump
id: relay_3
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true
 
 
################################## #RECIRCULATE
 
 
- platform: gpio
name: "Recirculate Pump"
icon: mdi:pump
id: relay_4
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
 
######################## INTERLOCK WATER STOP ###########################
- platform: gpio
name: "HouseWater OFF"
icon: mdi:water-off-outline
 
id: relay_5
pin:
pcf8574: pcf8574_hub_out_1
number: 4
mode: OUTPUT
inverted: true
interlock: [relay_6] # Interlock with Grow Pump_6
 
- platform: gpio
name: "HouseWater ON"
icon: mdi:water
id: relay_6
pin:
pcf8574: pcf8574_hub_out_1
number: 5
mode: OUTPUT
inverted: true
interlock: [relay_5]
restore_mode: ALWAYS_ON
 



Attached Files Thumbnail(s)
   
Print this item

  ATF Arduino source code - Save DS18B20 Temperature Data on a micro SD Card by Excel
Posted by: admin - 09-02-2024, 03:41 AM - Forum: Extender module - No Replies

/*
  KinCony Company - https://www.kincony.com
  -----------------------------------------------------
  This program logs temperature data from a DS18B20 sensor
  to an SD card, including the current date and time.
  The date and time can be set via serial commands.
 
  Serial Command to Set Date and Time:
  ------------------------------------
  DYYYY-MM-DDTHH:MM:SS  (Example: D2024-09-01T20:00:00)
  - Sets the date to September 1, 2024, and the time to 20:00:00.
 
  Serial Command to Get Current Date and Time:
  --------------------------------------------
  current time
  - Returns the current date and time in the format:
    Current Date: YYYY-MM-DD
    Current Time: HH:MM:SS
*/



Code:
/*
  KinCony Company - https://www.kincony.com
  -----------------------------------------------------
  This program logs temperature data from a DS18B20 sensor
  to an SD card, including the current date and time.
  The date and time can be set via serial commands.
 
  Serial Command to Set Date and Time:
  ------------------------------------
  DYYYY-MM-DDTHH:MM:SS  (Example: D2024-09-01T20:00:00)
  - Sets the date to September 1, 2024, and the time to 20:00:00.
 
  Serial Command to Get Current Date and Time:
  --------------------------------------------
  current time
  - Returns the current date and time in the format:
    Current Date: YYYY-MM-DD
    Current Time: HH:MM:SS
*/

#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <SD.h>
#include <SPI.h>
#include <TimeLib.h>

// Pin assignments
#define ONE_WIRE_BUS 26
#define SD_CS_PIN 5

// DS18B20 sensor setup
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

// SD card setup
File dataFile;

void setup() {
  // Start serial communication
  Serial.begin(115200);
 
  // Start the DS18B20 sensor
  sensors.begin();
 
  // Start the SD card
  if (!SD.begin(SD_CS_PIN)) {
    Serial.println("SD card initialization failed!");
    return;
  }

  // Open the file for writing
  dataFile = SD.open("/temperature_log.csv", FILE_WRITE);
  if (dataFile) {
    // Write the header
    dataFile.println("Date,Time,Temperature (°C)");
    dataFile.close();
  } else {
    Serial.println("Error opening file for writing");
  }

  // Initialize the time to a default value
  setTime(0, 0, 0, 1, 1, 2020); // Default to Jan 1, 2020 00:00:00
}

void loop() {
  // Check for serial input
  if (Serial.available()) {
    String input = Serial.readStringUntil('\n');
   
    // Set the time if the input starts with 'D'
    if (input.startsWith("D")) {
      int year = input.substring(1, 5).toInt();
      int month = input.substring(6, 8).toInt();
      int day = input.substring(9, 11).toInt();
      int hour = input.substring(12, 14).toInt();
      int minute = input.substring(15, 17).toInt();
      int second = input.substring(18, 20).toInt();
     
      setTime(hour, minute, second, day, month, year);
      Serial.println("Time updated successfully!");
    }

    // Return the current time if the input is "current time"
    else if (input == "current time") {
      String currentDate = String(year()) + "-" + String(month()) + "-" + String(day());
      String currentTime = String(hour()) + ":" + String(minute()) + ":" + String(second());
      Serial.print("Current Date: ");
      Serial.println(currentDate);
      Serial.print("Current Time: ");
      Serial.println(currentTime);
    }
  }

  // Get the current date and time
  String formattedDate = String(year()) + "-" + String(month()) + "-" + String(day());
  String formattedTime = String(hour()) + ":" + String(minute()) + ":" + String(second());

  // Request temperature measurement
  sensors.requestTemperatures();
  float temperatureC = sensors.getTempCByIndex(0);

  // Open the file for appending
  dataFile = SD.open("/temperature_log.csv", FILE_APPEND);
  if (dataFile) {
    // Write the data as a new line
    dataFile.print(formattedDate);
    dataFile.print(",");
    dataFile.print(formattedTime);
    dataFile.print(",");
    dataFile.println(temperatureC, 2); // 2 decimal places for temperature
    dataFile.close();
   
    // Print to the Serial Monitor as well
    Serial.print(formattedDate);
    Serial.print(",");
    Serial.print(formattedTime);
    Serial.print(",");
    Serial.println(temperatureC, 2);
  } else {
    Serial.println("Error opening file for appending");
  }
 
  // Wait for 5 seconds before the next measurement
  delay(5000);
}
   
   
   

Print this item

  Analog current input
Posted by: Linnalahti - 09-01-2024, 11:36 AM - Forum: KC868-A16 - Replies (4)

How to use 0-20mA signal to analog input?

Admin did not anservered the qustion?
How to use 0-20mA signal insted off 4-20mA

Print this item

  Extending H32B Pro
Posted by: titan - 09-01-2024, 10:50 AM - Forum: KC868-HxB series Smart Controller - Replies (1)

Hello,

I am using a H32B Pro and Home Assistant to control an irrigation system and would like to add another 32 channels? How should I do this? Should I get another H32B Pro or is there an extension module I could use?

Thank you,

David

Print this item

  KC868-A8 Roller Blinds
Posted by: Paul - 08-31-2024, 02:10 PM - Forum: DIY Project - Replies (1)

Hello!!
Could I ask for instructions on how to make roller blinds for ESPhome ? I need some code to run it.
I can't find it on the Internet and what I found doesn't work. I have KC868-A8-V1.6


TXH

Print this item

  Inputs on KC868-A16. What is correct?
Posted by: Brouk - 08-30-2024, 10:55 AM - Forum: KC868-A16 - Replies (20)

I purchased KC868-A16 from you via Aliexpress ( Order ID: 3034630932938839).
As the menu/specification table says (see the attached image), the device should have:
> 16 digital input LOG1 = +8 to 12VDC
> and 2 analog inputs 4-20mA.

But
> the device does not have digital inputs working with a positive signal, i.e. PNP. So I have to buy logic signal converters :o( .

> and even (now I found out on your site https://www.kincony.com/esp32-board-16-c...dware.html ) that there are no analog current inputs. Is that so?

Do you have inaccurate information when selling? What is the truth?
Regards



Attached Files Thumbnail(s)
       
Print this item

Lightbulb eth and mqtt for KC868-A16
Posted by: lron - 08-30-2024, 09:34 AM - Forum: KC868-A16 - Replies (1)

Hallo kincony!
I need a code for aduino IDE with:
 - Ethernet
 - MQTT
 - 16 inputs
 - 16 outputs
 - small web server just for entering (and save it to eprom):
     - static ip
     - server\broker ip
     - server subnet
     - server mask
     - subscribe topic
     - publish topic

Print this item

  KC868-D16 dimmer controller MQTT configuration for home assistant fixed linear issue
Posted by: admin - 08-30-2024, 06:23 AM - Forum: KC868-HxB series Smart Controller - Replies (13)

new configuration.yaml file for home assistant MQTT. this file fixed linear issue.
   
   

Code:
mqtt:
  light:
    - name: D16-1
      unique_id: D16-1
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer1":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer1":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer1":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer1.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer1.value is defined -%}
        {{ (value_json.dimmer1.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}
       
    - name: D16-2
      unique_id: D16-2
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer2":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer2":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer2":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer2.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer2.value is defined -%}
        {{ (value_json.dimmer2.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}
       
    - name: D16-3
      unique_id: D16-3
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer3":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer3":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer3":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer3.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer3.value is defined -%}
        {{ (value_json.dimmer3.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-4
      unique_id: D16-4
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer4":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer4":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer4":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer4.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer4.value is defined -%}
        {{ (value_json.dimmer4.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-5
      unique_id: D16-5
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer5":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer5":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer5":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer5.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer5.value is defined -%}
        {{ (value_json.dimmer5.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-6
      unique_id: D16-6
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer6":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer6":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer6":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer6.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer6.value is defined -%}
        {{ (value_json.dimmer6.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-7
      unique_id: D16-7
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer7":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer7":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer7":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer7.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer7.value is defined -%}
        {{ (value_json.dimmer7.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}


    - name: D16-8
      unique_id: D16-8
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer8":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer8":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer8":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer8.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer8.value is defined -%}
        {{ (value_json.dimmer8.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-9
      unique_id: D16-9
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer9":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer9":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer9":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer9.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer9.value is defined -%}
        {{ (value_json.dimmer9.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-10
      unique_id: D16-10
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer10":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer10":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer10":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer10.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer10.value is defined -%}
        {{ (value_json.dimmer10.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-11
      unique_id: D16-11
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer11":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer11":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer11":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer11.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer11.value is defined -%}
        {{ (value_json.dimmer11.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-12
      unique_id: D16-12
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer12":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer12":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer12":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer12.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer12.value is defined -%}
        {{ (value_json.dimmer12.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-13
      unique_id: D16-13
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer13":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer13":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer13":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer13.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer13.value is defined -%}
        {{ (value_json.dimmer13.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-14
      unique_id: D16-14
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer14":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer14":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer14":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer14.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer14.value is defined -%}
        {{ (value_json.dimmer14.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-15
      unique_id: D16-15
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer15":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer15":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer15":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer15.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer15.value is defined -%}
        {{ (value_json.dimmer15.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

    - name: D16-16
      unique_id: D16-16
      schema: template
      command_topic: "dimmer/be06d3fd6311b55a970bba37/set"
      state_topic: "dimmer/be06d3fd6311b55a970bba37/state"
      command_on_template: >
        {%- if brightness is defined -%}
        {"dimmer16":{"value":{{ (brightness / 255 * 99) | int }}}
        {%- else -%}
        {"dimmer16":{"value":99}}
        {%- endif -%}
      command_off_template: '{"dimmer16":{"value":0}}'
      state_template: >
        {%- if value_json.dimmer16.value == 0 -%}
          off
        {%- else -%}
          on
        {%- endif -%}
      brightness_template: >
        {%- if value_json.dimmer16.value is defined -%}
        {{ (value_json.dimmer16.value / 99 * 255) | int }}
        {%- else -%}
        0
        {%- endif -%}

yaml file download: 
.txt   mqtt-kc868-d16-home-assistant-16-channel-config.txt (Size: 12.37 KB / Downloads: 525)
   
   
   
   
   
   
   
   
linedddar issuedd

Print this item