Hi all!!
I am using ESPHOME and trying to send a mqtt value to uart text senor. How can I transmit a mqtt received value to uart text sensor??? I have already succeeded to receive mqtt values. I have already succeeded to write to uart text sensor an ASCII character.
Any advise will be appreciated.
I have the following error:
/config/esphome/test.yaml: In lambda function:
/config/esphome/test.yaml:115:25: error: conversion from ‘esphome::mqtt_subscribe::MQTTSubscribeSensor*’ to non-scalar type ‘std::__cxx11::string’ {aka ‘std::__cxx11::basic_string’} requested
my yaml file has the following code among other:
mqtt:
broker: …
username: …
password: …
birth_message:
topic: sensor/$devicename/status
payload: online
will_message:
topic: sensor/$devicename/status
payload: offline
sensor:
- platform: mqtt_subscribe
name: “temp”
id: temp
topic: Measurements/temp
logger:
level: VERBOSE #makes uart stream available in esphome logstream
baud_rate: 115200
uart:
id: uart_bus
tx_pin: 17
rx_pin: 16
baud_rate: 115200
debug:
direction: BOTH
dummy_receiver: false
after:
delimiter: “\n”
sequence:
- lambda: UARTDebug::log_string(direction, bytes);
interval:
- interval: 2s
then:- uart.write:
data: !lambda |-
std::size_t pos;
std::string str = id(temp);
while ((pos = str.find("\r")) != std::string::npos)
str.replace(pos, 2, “\r”);
std::vector<uint8_t> vec(str.begin(), str.end());
return vec;
- uart.write: