NOTICE: This forum has been archived (i.e. registration and posting is disabled).

Please go to the new forum at https://forum.kylegabriel.com

MQTT data reading p...
 
Notifications
Clear all

[Solved] MQTT data reading problem from esp32

Page 1 / 2

andris_mz
(@andris_mz)
Active Member
Joined: 8 months ago
Posts: 8
Topic starter  

Hello!
Many thanks Kyle for creating the Mycodo system! Awesome!

But there is a small problem with MQTT.

I created a system for testing:
Raspberry PI 4 8GB MyCodo, MQTT, Node-red

ESP32 with LED and BME280 according to a simple circuit and code from
https://randomnerdtutorials.com/esp32-mqtt-publish-subscribe-arduino-ide/

Mycodo function:
reads the temperature via MQTT from esp32/temperature
if  temperature >26C then via MQTT switches the esp32 LED ON    esp32/output
if  temperature <25C then via MQTT switches the esp32 LED OFF   esp32/output

while the function is disabled the measurements from esp32/temperature are read
when the function is activated, it stops reading esp32/temperature via MQTT from esp32
it happens when esp32/output is running

At the same time, the Node-red reads the temperature measurements from esp32 .
Also the LED on esp32 via MQTT from Mycodo and Node-red can be turned ON and OFF only temperature readind stop.

In the log file I see but don't understand what is incorrectly configured or still have a problem with Mycodo itself ...

Please help.
Sincerely,
Andris

 

Screen shots:

Version

live data

MQTT input

MQTT output

function

 log:

2021-01-23 0932,103 - DEBUG - mycodo.daemon - Starting all activated Custom controllers
2021-01-23 0932,103 - INFO - mycodo.daemon - All activated Custom controllers started
2021-01-23 0932,103 - DEBUG - mycodo.daemon - Starting Widget Controller
2021-01-23 0932,107 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Connected to 'None', rc: 0
2021-01-23 0932,109 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Subscribing to mqtt topic: None, 1, (0,)
2021-01-23 0932,110 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Subscribing to mqtt topic: None, 2, (0,)
2021-01-23 0932,167 - DEBUG - mycodo.controllers.controller_widget - Initializing Widgets
2021-01-23 0932,415 - DEBUG - mycodo.controllers.controller_widget - Widgets Initialized
2021-01-23 0932,416 - INFO - mycodo.controllers.controller_widget - Activated in 311.9 ms
2021-01-23 0932,870 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.50
2021-01-23 0932,873 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.5, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 32, 870691)}}
2021-01-23 0932,878 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.34
2021-01-23 0932,881 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.34, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 32, 878853)}}
2021-01-23 0932,916 - DEBUG - mycodo.daemon - Widget Controller fully started
2021-01-23 0933,417 - INFO - mycodo.daemon - Mycodo daemon started in 3.089 seconds
2021-01-23 0933,419 - INFO - mycodo.daemon - 44.07 MB RAM in use
2021-01-23 0933,872 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.50
2021-01-23 0933,874 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.5, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 33, 872173)}}
2021-01-23 0933,883 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.34
2021-01-23 0933,886 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.34, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 33, 883814)}}
2021-01-23 0934,872 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.50
2021-01-23 0934,876 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.5, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 34, 872170)}}
2021-01-23 0934,883 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0934,888 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 34, 883623)}}
2021-01-23 0935,876 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.51
2021-01-23 0935,878 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.51, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 35, 876118)}}
2021-01-23 0935,883 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0935,886 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 35, 883353)}}
2021-01-23 0936,875 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.51
2021-01-23 0936,879 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.51, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 36, 875413)}}
2021-01-23 0936,884 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0936,887 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 36, 884408)}}
2021-01-23 0937,875 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0937,878 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 37, 875808)}}
2021-01-23 0937,885 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.34
2021-01-23 0937,890 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.34, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 37, 885466)}}
2021-01-23 0938,884 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.51
2021-01-23 0938,886 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.51, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 38, 884336)}}
2021-01-23 0938,890 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0938,894 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 38, 890813)}}
2021-01-23 0939,922 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0939,925 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 39, 922807)}}
2021-01-23 0939,929 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0939,931 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 39, 929109)}}
2021-01-23 0940,939 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0940,941 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 40, 939154)}}
2021-01-23 0941,142 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.34
2021-01-23 0941,145 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.34, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 41, 142199)}}
2021-01-23 0941,954 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0941,957 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 41, 954914)}}
2021-01-23 0942,123 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.34
2021-01-23 0942,125 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.34, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 42, 123127)}}
2021-01-23 0942,881 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0942,883 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 42, 881585)}}
2021-01-23 0942,888 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0942,890 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 42, 888303)}}
2021-01-23 0943,881 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0943,884 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 43, 881140)}}
2021-01-23 0943,888 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.37
2021-01-23 0943,890 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.37, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 43, 888386)}}
2021-01-23 0944,882 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0944,884 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 44, 882308)}}
2021-01-23 0944,888 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.40
2021-01-23 0944,892 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.4, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 44, 888865)}}
2021-01-23 0945,883 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0945,885 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 45, 883315)}}
2021-01-23 0945,890 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.41
2021-01-23 0945,894 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.41, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 45, 890352)}}
2021-01-23 0946,884 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0946,887 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 46, 884217)}}
2021-01-23 0946,943 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.39
2021-01-23 0946,946 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.39, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 46, 943894)}}
2021-01-23 0947,884 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0947,887 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 47, 884724)}}
2021-01-23 0947,891 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.38
2021-01-23 0947,893 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.38, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 47, 891226)}}
2021-01-23 0948,886 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0948,890 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 48, 886823)}}
2021-01-23 0948,897 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.37
2021-01-23 0948,899 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.37, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 48, 896954)}}
2021-01-23 0949,894 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0949,897 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 49, 894484)}}
2021-01-23 0949,902 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0949,905 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 49, 902845)}}
2021-01-23 0950,888 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0950,890 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 50, 888114)}}
2021-01-23 0950,895 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0950,897 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 50, 894971)}}
2021-01-23 0951,888 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0951,890 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 51, 888079)}}
2021-01-23 0951,894 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0951,897 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 51, 894597)}}
2021-01-23 0952,890 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0952,893 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 52, 890517)}}
2021-01-23 0952,897 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0952,901 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 52, 897830)}}
2021-01-23 0953,891 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0953,894 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 53, 891744)}}
2021-01-23 0953,900 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0953,903 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 53, 900687)}}
2021-01-23 0954,892 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0954,894 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 54, 892045)}}
2021-01-23 0954,899 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0954,902 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 54, 899145)}}
2021-01-23 0955,892 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0955,897 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 55, 892377)}}
2021-01-23 0955,902 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0955,905 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 55, 902498)}}
2021-01-23 0956,894 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0956,898 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 56, 894368)}}
2021-01-23 0956,904 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.35
2021-01-23 0956,908 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.35, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 56, 904461)}}
2021-01-23 0957,895 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0957,898 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 57, 894935)}}
2021-01-23 0957,902 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.34
2021-01-23 0957,906 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.34, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 57, 902467)}}
2021-01-23 0958,905 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0958,907 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 58, 904958)}}
2021-01-23 0958,911 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.34
2021-01-23 0958,915 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.34, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 58, 911694)}}
2021-01-23 0959,899 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0959,902 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 59, 899491)}}
2021-01-23 0959,907 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.34
2021-01-23 0959,913 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.34, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 31, 59, 907796)}}
2021-01-23 0900,897 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.52
2021-01-23 0900,899 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.52, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 32, 0, 897331)}}
2021-01-23 0900,904 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.34
2021-01-23 0900,909 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.34, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 32, 0, 904340)}}
2021-01-23 0901,876 - DEBUG - mycodo.controllers.controller_conditional_bc4ae4ca - Conditional Statement (pre-replacement):
self.logger.info("This INFO log entry will appear in the Daemon Log")
self.logger.error("This ERROR log entry will appear in the Daemon Log")

measurement = self.condition("{90152159}")   # mqtt paho temperature measurement:  esp32/temperature
self.logger.info("Check this measurement in the Daemon Log. The value is {val}".format(val=measurement))

if measurement is not None:  # If a measurement exists
    self.message += "This message appears in email alerts and notes.\n"

    if measurement < 25:  
        self.message += "Measurement is ok, led off ! Measurement is {meas}\n".format(meas=measurement)
        self.run_action("{53f17c0b}", message=self.message)  # Run a single Action: mqtt led off
  
    if measurement > 26:  
        self.message += "Measurement is too High, led on ! Measurement is {meas}\n".format(meas=measurement)
        self.run_action("{a3a73190}", message=self.message)  # Run a single Action: mqtt led on
2021-01-23 0901,877 - DEBUG - mycodo.controllers.controller_conditional_bc4ae4ca - Conditional Statement (post-replacement):
import os
import sys
sys.path.append(os.path.abspath('/var/mycodo-root'))
from mycodo.mycodo_client import DaemonControl
control = DaemonControl()

class ConditionalRun:
    def __init__(self, logger, function_id, message):
        self.logger = logger
        self.function_id = function_id
        self.variables = {}
        self.message = message
        self.running = True

    def run_all_actions(self, message=None):
        if message is None:
            message = self.message
        control.trigger_all_actions(self.function_id, message=message)

    def run_action(self, action_id, message=None):
        if message is None:
            message = self.message
        control.trigger_action(action_id, message=message, single_action=True)

    @staticmethod
    def condition(condition_id):
        return control.get_condition_measurement(condition_id)

    @staticmethod
    def condition_dict(condition_id):
        string_sets = control.get_condition_measurement_dict(condition_id)
        if string_sets:
            list_ts_values = []
            for each_set in string_sets.split(';'):
                ts_value = each_set.split(',')
                list_ts_values.append({'time': ts_value[0], 'value': float(ts_value[1])})
            return list_ts_values
        return None

    def stop_conditional(self):
        self.running = False

    def conditional_code_run(self):
        self.logger.info("This INFO log entry will appear in the Daemon Log")
        self.logger.error("This ERROR log entry will appear in the Daemon Log")

        measurement = self.condition("90152159-cf6c-476d-8078-bb0e3c1818cc")   # mqtt paho temperature measurement:  esp32/temperature
        self.logger.info("Check this measurement in the Daemon Log. The value is {val}".format(val=measurement))

        if measurement is not None:  # If a measurement exists
            self.message += "This message appears in email alerts and notes.\n"

            if measurement < 25:  
                self.message += "Measurement is ok, led off ! Measurement is {meas}\n".format(meas=measurement)
                self.run_action("53f17c0b-2a8e-47a6-ae49-062c8f86ac83", message=self.message)  # Run a single Action: mqtt led off
  
            if measurement > 26:  
                self.message += "Measurement is too High, led on ! Measurement is {meas}\n".format(meas=measurement)
                self.run_action("a3a73190-e753-4f62-afa7-d747bab6a5fd", message=self.message)  # Run a single Action: mqtt led on

2021-01-23 0901,877 - INFO - mycodo.controllers.controller_conditional_bc4ae4ca - This INFO log entry will appear in the Daemon Log
2021-01-23 0901,878 - ERROR - mycodo.controllers.controller_conditional_bc4ae4ca - This ERROR log entry will appear in the Daemon Log
2021-01-23 0901,899 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/temperature, Value: 23.53
2021-01-23 0901,903 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 23.53, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 32, 1, 899556)}}
2021-01-23 0901,911 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Message received: Channel: esp32/humidity, Value: 31.34
2021-01-23 0901,915 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Adding measurement to influxdb: {1: {'measurement': 'humidity', 'unit': 'percent', 'value': 31.34, 'timestamp_utc': datetime.datetime(2021, 1, 23, 7, 32, 1, 911110)}}
2021-01-23 0901,939 - INFO - mycodo.controllers.controller_conditional_bc4ae4ca - Check this measurement in the Daemon Log. The value is 23.53
2021-01-23 0902,012 - DEBUG - mycodo.controllers.controller_output - output_on_off(d76f5140-01e4-47dd-a87f-b1023a3632c6, off, 0, None, 0.0, 0.0, True)
2021-01-23 0902,014 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Disconnected result code 1
2021-01-23 0903,016 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Connected to 'None', rc: 0
2021-01-23 0932,046 - DEBUG - mycodo.controllers.controller_conditional_bc4ae4ca - Conditional Statement (pre-replacement):
self.logger.info("This INFO log entry will appear in the Daemon Log")
self.logger.error("This ERROR log entry will appear in the Daemon Log")

measurement = self.condition("{90152159}")   # mqtt paho temperature measurement:  esp32/temperature
self.logger.info("Check this measurement in the Daemon Log. The value is {val}".format(val=measurement))

if measurement is not None:  # If a measurement exists
    self.message += "This message appears in email alerts and notes.\n"

    if measurement < 25:  
        self.message += "Measurement is ok, led off ! Measurement is {meas}\n".format(meas=measurement)
        self.run_action("{53f17c0b}", message=self.message)  # Run a single Action: mqtt led off
  
    if measurement > 26:  
        self.message += "Measurement is too High, led on ! Measurement is {meas}\n".format(meas=measurement)
        self.run_action("{a3a73190}", message=self.message)  # Run a single Action: mqtt led on
2021-01-23 0932,046 - DEBUG - mycodo.controllers.controller_conditional_bc4ae4ca - Conditional Statement (post-replacement):
import os
import sys
sys.path.append(os.path.abspath('/var/mycodo-root'))
from mycodo.mycodo_client import DaemonControl
control = DaemonControl()

class ConditionalRun:
    def __init__(self, logger, function_id, message):
        self.logger = logger
        self.function_id = function_id
        self.variables = {}
        self.message = message
        self.running = True

    def run_all_actions(self, message=None):
        if message is None:
            message = self.message
        control.trigger_all_actions(self.function_id, message=message)

    def run_action(self, action_id, message=None):
        if message is None:
            message = self.message
        control.trigger_action(action_id, message=message, single_action=True)

    @staticmethod
    def condition(condition_id):
        return control.get_condition_measurement(condition_id)

    @staticmethod
    def condition_dict(condition_id):
        string_sets = control.get_condition_measurement_dict(condition_id)
        if string_sets:
            list_ts_values = []
            for each_set in string_sets.split(';'):
                ts_value = each_set.split(',')
                list_ts_values.append({'time': ts_value[0], 'value': float(ts_value[1])})
            return list_ts_values
        return None

    def stop_conditional(self):
        self.running = False

    def conditional_code_run(self):
        self.logger.info("This INFO log entry will appear in the Daemon Log")
        self.logger.error("This ERROR log entry will appear in the Daemon Log")

        measurement = self.condition("90152159-cf6c-476d-8078-bb0e3c1818cc")   # mqtt paho temperature measurement:  esp32/temperature
        self.logger.info("Check this measurement in the Daemon Log. The value is {val}".format(val=measurement))

        if measurement is not None:  # If a measurement exists
            self.message += "This message appears in email alerts and notes.\n"

            if measurement < 25:  
                self.message += "Measurement is ok, led off ! Measurement is {meas}\n".format(meas=measurement)
                self.run_action("53f17c0b-2a8e-47a6-ae49-062c8f86ac83", message=self.message)  # Run a single Action: mqtt led off
  
            if measurement > 26:  
                self.message += "Measurement is too High, led on ! Measurement is {meas}\n".format(meas=measurement)
                self.run_action("a3a73190-e753-4f62-afa7-d747bab6a5fd", message=self.message)  # Run a single Action: mqtt led on

2021-01-23 0932,047 - INFO - mycodo.controllers.controller_conditional_bc4ae4ca - This INFO log entry will appear in the Daemon Log
2021-01-23 0932,047 - ERROR - mycodo.controllers.controller_conditional_bc4ae4ca - This ERROR log entry will appear in the Daemon Log
2021-01-23 0932,090 - INFO - mycodo.controllers.controller_conditional_bc4ae4ca - Check this measurement in the Daemon Log. The value is 23.53
2021-01-23 0932,173 - DEBUG - mycodo.controllers.controller_output - output_on_off(d76f5140-01e4-47dd-a87f-b1023a3632c6, off, 0, None, 0.0, 0.0, True)
2021-01-23 0932,176 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Disconnected result code 1
2021-01-23 0933,180 - DEBUG - mycodo.inputs.mqtt_paho_ff736ce7 - Connected to 'None', rc: 0

Quote
Topic Tags
andris_mz
(@andris_mz)
Active Member
Joined: 8 months ago
Posts: 8
Topic starter  

Greetings to all!

Have any of the forum readers really encountered the following problem: MQTT reads data from esp32 or Node-red, everything works.
As soon as MQTT_output on/off or MQTT_output value is activated, its data reading is stopped and does not resume.
At the same time, the MQTT_output function works.

From the log file, if I understand correctly that the MQTT input is switched off after activating the MQTT output.

Please help resolve this issue.

Sincerely,
Andris

P.S. Below I add for import Node-red flow:

[{"id":"d056b3db.161e7","type":"mqtt in","z":"7648c759.4997c8","name""esp32/temperature","qos""31d33c0d.70eea4","x"[["8fa136b5.e916b8"]]},{"id":"31d33c0d.70eea4","type""192.168.1.200","port"""}]

 

Mycodo log files:

2021-01-31 1954,071 - INFO - mycodo.daemon - Mycodo daemon v8.8.8 starting
2021-01-31 1954,770 - INFO - mycodo.outputs.mqtt_3b6f5df5 - Initialized in 171.6 ms
2021-01-31 1954,879 - INFO - mycodo.outputs.mqtt_value_24a81a27 - Initialized in 107.4 ms
2021-01-31 1954,880 - INFO - mycodo.controllers.controller_output - Activated in 555.3 ms
2021-01-31 1955,381 - INFO - mycodo.daemon - All activated Conditional controllers started
2021-01-31 1955,381 - INFO - mycodo.daemon - All activated Trigger controllers started
2021-01-31 1955,737 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_117r Client created with ID mycodo_mqtt_client
2021-01-31 1955,737 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r128 Connecting MQTT callback functions
2021-01-31 1955,738 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r133 MQTT callback functions connected
2021-01-31 1955,738 - INFO - mycodo.inputs.mqtt_paho_751d0e5a - inp_r144 Connected to 192.168.1.200 as mycodo_mqtt_client
2021-01-31 1955,739 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - r155 Subscribed to MQTT channel 'paho/node/integer'
2021-01-31 1955,740 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - r155 Subscribed to MQTT channel 'esp32/temperature'
2021-01-31 1955,740 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - r155 Subscribed to MQTT channel 'esp32/humidity'
2021-01-31 1955,742 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - r162 Connected to 'None', rc: 0
2021-01-31 1955,743 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r166 Subscribing to mqtt topic: None, 1, (0,)
2021-01-31 1955,743 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r166 Subscribing to mqtt topic: None, 2, (0,)
2021-01-31 1955,743 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r166 Subscribing to mqtt topic: None, 3, (0,)
2021-01-31 1955,744 - INFO - mycodo.controllers.controller_input_751d0e5a - Activated in 201.7 ms
2021-01-31 1955,744 - INFO - mycodo.daemon - All activated Input controllers started
2021-01-31 1955,745 - INFO - mycodo.daemon - All activated Math controllers started
2021-01-31 1955,746 - INFO - mycodo.daemon - All activated PID controllers started
2021-01-31 1955,746 - INFO - mycodo.daemon - All activated LCD controllers started
2021-01-31 1955,746 - INFO - mycodo.daemon - All activated Custom controllers started
2021-01-31 1955,995 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r174 Message received: Channel: paho/node/integer, Value: 37
2021-01-31 1955,999 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r222 Adding measurement to influxdb: {0: {'measurement': 'volume', 'unit': 'l', 'value': 37.0, 'timestamp_utc': datetime.datetime(2021, 1, 31, 17, 57, 55, 994942)}}
2021-01-31 1956,017 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r174 Message received: Channel: esp32/temperature, Value: 24.51
2021-01-31 1956,020 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r222 Adding measurement to influxdb: {1: {'measurement': 'temperature', 'unit': 'C', 'value': 24.51, 'timestamp_utc': datetime.datetime(2021, 1, 31, 17, 57, 56, 17081)}}
2021-01-31 1956,075 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r174 Message received: Channel: esp32/humidity, Value: 26.40
2021-01-31 1956,078 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r222 Adding measurement to influxdb: {2: {'measurement': 'humidity', 'unit': 'percent', 'value': 26.4, 'timestamp_utc': datetime.datetime(2021, 1, 31, 17, 57, 56, 75173)}}
2021-01-31 1956,139 - INFO - mycodo.controllers.controller_widget - Activated in 392.3 ms
2021-01-31 1956,988 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r174 Message received: Channel: paho/node/integer, Value: 38
2021-01-31 1956,991 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r222 Adding measurement to influxdb: {0: {'measurement': 'volume', 'unit': 'l', 'value': 38.0, 'timestamp_utc': datetime.datetime(2021, 1, 31, 17, 57, 56, 988683)}}
2021-01-31 1957,016 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r174 Message received: Channel: esp32/temperature, Value: 24.51
2021-01-31 1957,019 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r222 Adding measurement to influxdb: {1: {'measurement': 'temperature', 'unit': 'C', 'value': 24.51, 'timestamp_utc': datetime.datetime(2021, 1, 31, 17, 57, 57, 16193)}}
2021-01-31 1957,027 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r174 Message received: Channel: esp32/humidity, Value: 26.44
2021-01-31 1957,031 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r222 Adding measurement to influxdb: {2: {'measurement': 'humidity', 'unit': 'percent', 'value': 26.44, 'timestamp_utc': datetime.datetime(2021, 1, 31, 17, 57, 57, 27832)}}
2021-01-31 1957,141 - INFO - mycodo.daemon - Mycodo daemon started in 3.069 seconds
2021-01-31 1957,142 - INFO - mycodo.daemon - 43.63 MB RAM in use
2021-01-31 1957,989 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r174 Message received: Channel: paho/node/integer, Value: 39
2021-01-31 1957,992 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r222 Adding measurement to influxdb: {0: {'measurement': 'volume', 'unit': 'l', 'value': 39.0, 'timestamp_utc': datetime.datetime(2021, 1, 31, 17, 57, 57, 989550)}}
2021-01-31 1958,005 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r174 Message received: Channel: esp32/temperature, Value: 24.51
 ****
2021-01-31 1908,999 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r222 Adding measurement to influxdb: {0: {'measurement': 'volume', 'unit': 'l', 'value': 2.0, 'timestamp_utc': datetime.datetime(2021, 1, 31, 17, 58, 8, 996874)}} 2021-01-31 1909,017 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r174 Message received: Channel: esp32/temperature, Value: 24.48 2021-01-31 1909,020 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r222 Adding measurement to influxdb: {1: {'measurement': 'temperature', 'unit': 'C', 'value': 24.48, 'timestamp_utc': datetime.datetime(2021, 1, 31, 17, 58, 9, 17463)}} 2021-01-31 1909,025 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r174 Message received: Channel: esp32/humidity, Value: 26.59 2021-01-31 1909,029 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r222 Adding measurement to influxdb: {2: {'measurement': 'humidity', 'unit': 'percent', 'value': 26.59, 'timestamp_utc': datetime.datetime(2021, 1, 31, 17, 58, 9, 24994)}} 2021-01-31 1909,245 - DEBUG - mycodo.outputs.mqtt_3b6f5df5 - output_on_off(on, 0, sec, 3.0, 0.0, True) 2021-01-31 1909,247 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r229 input Disconnected result code 1 2021-01-31 1909,249 - DEBUG - mycodo.outputs.mqtt_3b6f5df5 - Output 3b6f5df5-19c9-4bde-a312-34e2370ff978 CH0 (esp32/output) on for 3.0 seconds. Output returned: None 2021-01-31 1910,249 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - r162 Connected to 'None', rc: 0 2021-01-31 1912,250 - DEBUG - mycodo.outputs.mqtt_3b6f5df5 - output_on_off(off, 0, None, 0.0, 0.0, True) 2021-01-31 1912,254 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - inp_r229 input Disconnected result code 1 2021-01-31 1912,256 - DEBUG - mycodo.outputs.mqtt_3b6f5df5 - Output 3b6f5df5-19c9-4bde-a312-34e2370ff978 CH0 (esp32/output) OFF at 2021-01-31 1912. Output returned: None 2021-01-31 1913,255 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - r162 Connected to 'None', rc: 0

ReplyQuote
Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 7 years ago
Posts: 612
 

This is a fairly strange issue. It's likely a conflict with using the same library in separate processes. I haven't had the capability to run tests, but this should be able to be fixed somehow. Are you familiar with Python and can try to find a fix or do some searches for people having similar issues that may have found a fix?

I just created issue #927

Mycodo Developer


ReplyQuote
Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 7 years ago
Posts: 612
 

I just tested with an MQTT Input and MQTT Value Output and I can successfully send values from the Output that get stored with the Input. There have been a lot of changes since v8.8.8 and the current head of the repo that have code changes slated for the v8.9.0 release. Therefore, for you to test you'll need to upgrade to master.

Can you upgrade to master and see if the issue persists?

Mycodo Developer


ReplyQuote
andris_mz
(@andris_mz)
Active Member
Joined: 8 months ago
Posts: 8
Topic starter  

Hi, Kyle.
Thank you for start solving the problem that hurt me so much.

Yes, I had already upgraded to Master, just now I upgraded to the latest version of Master again. Now Database Version: cc7261a89a87

BUT, the problem still persists...
While only reading data via MQTT from esp32 and Node-red is ok.

So as to send on/off command or data via MQTT output,
its MQTT input stops working.

But Output continues to send data.
When the Backend restart is performed, Mycodo starts reading the data again via the MQTT input from esp32 and Node-red.

If you have not found such a problem, maybe in my case the MQTT broker on the Raspberry PI is not installed correctly version ...?!
I have install the Mosquitto Broker for MQTT
from  https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/
From where You installed?

 

2021-02-03 0901,855 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Payload is float: 47.0
2021-02-03 0901,857 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Adding measurement to influxdb: {0: {'measurement': 'volume', 'unit': 'l', 'value': 47.0, 'timestamp_utc': datetime.datetime(2021, 2, 3, 7, 8, 1, 854724)}}
2021-02-03 0902,667 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Message received: Channel: esp32/temperature, Value: 22.26
2021-02-03 0902,667 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Found channel with topic 'esp32/temperature': 1
2021-02-03 0902,668 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Payload is float: 22.26
2021-02-03 0902,671 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Adding measurement to influxdb: {1: {'measurement': 'temperature', 'unit': 'C', 'value': 22.26, 'timestamp_utc': datetime.datetime(2021, 2, 3, 7, 8, 2, 666995)}}
2021-02-03 0902,677 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Message received: Channel: esp32/humidity, Value: 32.87
2021-02-03 0902,677 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Found channel with topic 'esp32/humidity': 2
2021-02-03 0902,678 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Payload is float: 32.87
2021-02-03 0902,680 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Adding measurement to influxdb: {2: {'measurement': 'humidity', 'unit': 'percent', 'value': 32.87, 'timestamp_utc': datetime.datetime(2021, 2, 3, 7, 8, 2, 677162)}}
2021-02-03 0902,854 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Message received: Channel: paho/node/integer, Value: 48
2021-02-03 0902,854 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Found channel with topic 'paho/node/integer': 0
2021-02-03 0902,855 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Payload is float: 48.0
2021-02-03 0902,857 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Adding measurement to influxdb: {0: {'measurement': 'volume', 'unit': 'l', 'value': 48.0, 'timestamp_utc': datetime.datetime(2021, 2, 3, 7, 8, 2, 854511)}}
2021-02-03 0903,142 - DEBUG - mycodo.outputs.mqtt_value_24a81a27 - output_on_off(on, 0, value, 777.0, 0.0, True)
2021-02-03 0903,146 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Disconnected result code 1
2021-02-03 0904,148 - DEBUG - mycodo.inputs.mqtt_paho_751d0e5a - Connected to 'None', rc: 0

ReplyQuote
Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 7 years ago
Posts: 612
 
Posted by: @andris_mz

From where You installed?

The only command I used to install mosquitto was "sudo apt install mosquitto"

Without the issue presenting itself on my system, I'm unable to investigate the issue. Can you provide step-by-step instructions to reproduce the issue outside of your system (i.e. instructions that will replicate the issue on my system)? Are any of your MQTT servers remote that you can provide connection information for me to connect with one of my Inputs?

Mycodo Developer


ReplyQuote
andris_mz
(@andris_mz)
Active Member
Joined: 8 months ago
Posts: 8
Topic starter  

I configured the Raspberry PI so you can connect remotely.

Then you get full access to Mycodo and MQTT.

Please, Kyle, write me privately so I can send to You the login and password.


ReplyQuote
Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 7 years ago
Posts: 612
 

You can contact me privately at https://kylegabriel.com/contact

Mycodo Developer


ReplyQuote
Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 7 years ago
Posts: 612
 

Also, all I need is access to the MQTT server that I can subscribe to, since in order to investigate the issue I need full access to my own Mycodo instance to alter code. So just having access to the MQTT server to subscribe and a detailed step-by-step list of how to replicate the issue is needed.

Mycodo Developer


ReplyQuote
Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 7 years ago
Posts: 612
 
Posted by: @kylegabriel

Can you upgrade to master and see if the issue persists?

I see from logging into your system that you have not upgraded to master. Give this a try before I attempt anything. Also, try my suggestion via email to change the Client IDs of your Input and Output to different values. 

Mycodo Developer


ReplyQuote
Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 7 years ago
Posts: 612
 
Posted by: @kylegabriel

change the Client IDs of your Input and Output to different values

I just verified that changing Client IDs solved the issue. Having the same Client ID causes the Input to be disconnected when the Output logs in to the same server with the same Client ID.

Mycodo Developer


ReplyQuote
andris_mz
(@andris_mz)
Active Member
Joined: 8 months ago
Posts: 8
Topic starter  

Thanks Kyle, problem solved!
Yes, different Client ID names are required for MQTT input and output!

Kindly regards,
Andris


ReplyQuote
malaxy
(@malaxy)
New Member
Joined: 6 months ago
Posts: 3
 

Hello

First I would also thank Gabriel for this great work.

I would like to send the soil moister level to a mqtt broker and read this input in MyCodo. Currently I could visualise the values from the topic witch I subscribed. So fare i think the Input converts it to a float. Now I would like to run a action depends on the value from the esp32. More or less the same code as andris_mz from above. But I got the error that the data type isnt a float. I also try to convert it with "float()" but it didnt change everything. What am I doing wrong? Maye I just forgot something?

Thanks a lot for your help

Screenshots (Dashboard, Input, Function)

https://ibb.co/Yd5DvR4
https://ibb.co/QFRnbX2
https://ibb.co/R64DZZH

Log from Deamon

 

2021-03-31 1014,115 - ERROR - mycodo.daemon - Could not refresh conditional settings: unsupported operand type(s) for +: 'float' and 'NoneType'
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/mycodo_daemon.py", line 711, in refresh_daemon_conditional_settings
    return self.controller['Conditional'][unique_id].refresh_settings()
  File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 137, in refresh_settings
    self.initialize_variables()
  File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 107, in initialize_variables
    self.timer_period = now + self.start_offset
TypeError: unsupported operand type(s) for +: 'float' and 'NoneType'
2021-03-31 1012,186 - INFO - mycodo.controllers.controller_conditional_b22e2920 - Refreshing conditional settings
2021-03-31 1012,237 - ERROR - mycodo.daemon - Could not refresh conditional settings: unsupported operand type(s) for +: 'float' and 'NoneType'
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/mycodo_daemon.py", line 711, in refresh_daemon_conditional_settings
    return self.controller['Conditional'][unique_id].refresh_settings()
  File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 137, in refresh_settings
    self.initialize_variables()
  File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 107, in initialize_variables
    self.timer_period = now + self.start_offset
TypeError: unsupported operand type(s) for +: 'float' and 'NoneType'
2021-03-31 1055,372 - ERROR - mycodo.controllers.controller_conditional_b22e2920 - initialize_variables() Exception: unsupported operand type(s) for +: 'float' and 'NoneType'
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/controllers/base_controller.py", line 79, in run
    self.initialize_variables()
  File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 107, in initialize_variables
    self.timer_period = now + self.start_offset
TypeError: unsupported operand type(s) for +: 'float' and 'NoneType'
2021-03-31 1055,374 - INFO - mycodo.controllers.controller_conditional_b22e2920 - Activated in 72.5 ms
2021-03-31 1706,726 - INFO - mycodo.controllers.controller_input_d06d5f2d - Deactivated in 476.8 ms
2021-03-31 1718,805 - INFO - mycodo.inputs.mqtt_paho_d06d5f2d - Connected to broker.hivemq.com as mycodo_mqtt_client
2021-03-31 1718,807 - INFO - mycodo.controllers.controller_input_d06d5f2d - Activated in 390.3 ms

ReplyQuote
Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 7 years ago
Posts: 612
 
Posted by: @malaxy

File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 107, in initialize_variables self.timer_period = now + self.start_offset TypeError: unsupported operand type(s) for +: 'float' and 'NoneType'

It's stating your Start Offset is None. This can be seen in your Function where you do not have the Start Offset set.

Mycodo Developer


ReplyQuote
malaxy
(@malaxy)
New Member
Joined: 6 months ago
Posts: 3
 

@kylegabriel Thanks for the fast answer. Small thing that I didnt look at it. Now it worked :)

 


ReplyQuote
Page 1 / 2