Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom ESPHome firmware and Tuya integration
#11
(08-06-2024, 03:57 AM)admin Wrote: we have sent to your email.

Received and after putting it in the code I'm facing the exact same compilation error, due to the librairie and not the licence I previously had.
I don't understand how using the demo file and the librairie, you provided, I cannot flash it in an ESP, for the error you can see in my first post.

I guess I'm gonna use this board with KCS or without tuya integration....

Thanks anyway.
Reply
#12
how you done all step, post all screen photos.
Reply
#13
(08-06-2024, 09:00 AM)admin Wrote: how you done all step, post all screen photos.

All steps:
In ESPHome I create a new device, add your exemple code modifying with my personal informations and at the moment of compiling I have the error I showed you that points to an error in the format of the data sent to
Quote:json::parse_json
so seems directly linked to what 
Quote:esphome::tuya_iot::TuyaIotComponent:Confusedubscribe_json
 is returning.

The error:
Quote:error: invalid initialization of reference of type 'const json_parse_t&' {aka 'const std::function<bool(ArduinoJson6185_D1::ObjectRef)>&'} from expression of type 'esphome::tuya_iot::TuyaIotComponent:Confusedubscribe_json(const string&, const mqtt_json_callback_t&, uint8_t)::<lambda(const string&, const string&)>::<lambda(ArduinoJson::JsonObject)>'

The complete error:
Code:
src/esphome/components/tuya_iot/tuya_iot_component.cpp: In lambda function:
src/esphome/components/tuya_iot/tuya_iot_component.cpp:167:96: error: invalid initialization of reference of type 'const json_parse_t&' {aka 'const std::function<bool(ArduinoJson6185_D1::ObjectRef)>&'} from expression of type 'esphome::tuya_iot::TuyaIotComponent::subscribe_json(const string&, const mqtt_json_callback_t&, uint8_t)::<lambda(const string&, const string&)>::<lambda(ArduinoJson::JsonObject)>'
         json::parse_json(payload, [topic, callback](JsonObject root) { callback(topic, root); });
                                                                                                ^
In file included from src/esphome.h:21,
                 from src/esphome/components/tuya_iot/tuya_iot_component.h:3,
                 from src/esphome/components/tuya_iot/tuya_iot_component.cpp:1:
src/esphome/components/json/json_util.h:26:6: note: in passing argument 2 of 'bool esphome::json::parse_json(const string&, const json_parse_t&)'
bool parse_json(const std::string &data, const json_parse_t &f);
      ^~~~~~~~~~
Compiling .pioenvs/tuya-test/src/esphome/components/wifi/wifi_component_esp8266.cpp.o
*** [.pioenvs/tuya-test/src/esphome/components/tuya_iot/tuya_iot_component.cpp.o] Error 1
========================= [FAILED] Took 55.72 seconds =========================

Tried with the librairies in local, external, everything, I think.
Reply
#14
post your yaml file at here.
Reply
#15
(08-07-2024, 02:27 AM)admin Wrote: post your yaml file at here.

Of course, I created a pastebin so it's cleaner here, but if you want me to post the code directly here just tell me.

https://pastebin.com/48AWUBGr
Reply
#16
Hi @admin
Today I got KC868-M16v12 and add the provided yaml in you forum and while compiling getting below error


Compiling .pioenvs/m16v2/src/esphome/components/tuya_iot/tuya_iot_component.cpp.o
src/esphome/components/tuya_iot/tuya_iot_component.cpp: In lambda function:
src/esphome/components/tuya_iot/tuya_iot_component.cpp:167:96: error: invalid initialization of reference of type 'const json_parse_t&' {aka 'const std::function<bool(ArduinoJson6185_D1::ObjectRef)>&'} from expression of type 'esphome::tuya_iot::TuyaIotComponent:Confusedubscribe_json(const string&, const mqtt_json_callback_t&, uint8_t)::<lambda(const string&, const string&)>::<lambda(ArduinoJson::JsonObject)>'
json::parse_json(payload, [topic, callback](JsonObject root) { callback(topic, root); });
^
In file included from src/esphome/core/string_ref.h:10,
from src/esphome/core/entity_base.h:5,
from src/esphome/components/sensor/sensor.h:5,
from src/esphome/components/adc/adc_sensor.h:3,
from src/esphome.h:3,
from src/esphome/components/tuya_iot/tuya_iot_component.h:3,
from src/esphome/components/tuya_iot/tuya_iot_component.cpp:1:
src/esphome/components/json/json_util.h:26:6: note: in passing argument 2 of 'bool esphome::json::parse_json(const string&, const json_parse_t&)'
bool parse_json(const std:Confusedtring &data, const json_parse_t &f);
^~~~~~~~~~
*** [.pioenvs/m16v2/src/esphome/components/tuya_iot/tuya_iot_component.cpp.o] Error 1
========================= [FAILED] Took 163.48 seconds =========================

I used the same yaml as provided here https://www.kincony.com/forum/showthread.php?tid=3088
No change in yaml
Reply
#17
"KC868-M16v12" ??? which model you are using? KC868-M16v2??
Do you have uploaded 3 library files to your home assistant folder?
Reply
#18
(08-30-2024, 08:35 AM)admin Wrote: "KC868-M16v12"  ???  which model you are using?  KC868-M16v2??
Do you have uploaded 3 library files to your home assistant folder?

I got KC868-M16v2 Ethernet/wifi 16 channelEnergy metre
Yes I uploaded the 3 files to spedicified folder in HOme assistant
under/config/esphome/zmpt101b
ZMPT101B.cpp
ZMPT101B.h
zmpt101b_custom_sensor.h
Reply
#19
upload your yaml file at here.
Reply
#20
(08-30-2024, 12:48 PM)admin Wrote: upload your yaml file at here.

Its exactly the same yaml as you have in forum
Reply


Forum Jump:


Users browsing this thread: