Hello anyone, please can you help me i am the searching the whole day for sent an temperature C as an mqtt. message
How must i convert this? i want send float KompressorT with mqtt. i know i need an .toString or else
you see i have tested something ( in ### )
dallas:
- pin: GPIO3
update_interval: 5s
# Individual sensors
sensor:
- platform: dallas
address: 0xFF00000534CF9228
resolution: 11
id: KompressorT
name: "Kompressor Temperatur"
on_value:
then:
- mqtt.publish:
topic: Lager/temperature
payload: !lambda |-
return KompressorT.state;
# - mqtt.publish:
# topic: some/topic2
# payload: !lambda |-
# return std::to_string(my_global_int);
# return id(number).c_str();
# std::basic_string'b';
# return x;
# std::string num_text = std::to_string(number);
# std::string rounded = num_text.substr(0, num_text.find(".")+3);
# return num_text;
- if:
condition:
lambda: 'return id(KompressorT).state > 30;'
then:
- output.turn_on: s20_relay
- logger.log: "30,0-------_x___x___x___x___x___x__- Kühlung einschalten!"
- if:
condition:
lambda: 'return id(KompressorT).state < 29.5;'
then:
- output.turn_off: s20_relay
- logger.log: " 29,5---__________________ Kühlung aus!!!!!"