arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.27k stars 4.81k forks source link

Analog0 doesn not come with MQTT #2529

Closed baukeplugge closed 6 years ago

baukeplugge commented 6 years ago

I'm using the nodeMCU hardware to get a mqtt trigger when there is some change in the reading. I have commented the USE_ADC_VCC setting so I can read the anolog0 value. but this value is not send to the MQTT subscriber.

its also not shown in the console output.

any ideas how to capture this output ?

arendst commented 6 years ago

How about:

Make sure these boxes are checked before submitting your issue - Thank you!

Works just fine:

13:50:54 MQT: tele/ring2/SENSOR = {"Time":"2018-04-23T13:50:54","Analog0":4,"INA219":{"Voltage":4.410,"Current":0.020,"Power":0.087}}
baukeplugge commented 6 years ago

Hi

the hardware is the NodeMCU Example image

not sure how I should get the satus 0 output. but this is what is in the start of the console output:

12:12:46 MQT: sonoff/AN01-SW-IOT06/SENSOR = {"Time":"2018-04-23T12:12:46","Analog0":0}
12:17:29 APP: Serieel logging uitgeschakeld
12:17:47 MQT: sonoff/AN01-SW-IOT06/STATE = {"Time":"2018-04-23T12:17:47","Uptime":"0T00:10:20","Wifi":{"AP":1,"SSId":"xxxxxx IOT","RSSI":100,"APMac":"xxxxxxxxxx"}}

once in the 5 minutes I get this messages in the console

13:27:55 MQT: sonoff/AN01-SW-IOT06/STATE = {"Time":"2018-04-23T13:27:55","Uptime":"0T01:20:28","Wifi":{"AP":1,"SSId":"xxxx IOT","RSSI":88,"APMac":"xxxxxxx"}}
13:27:55 MQT: sonoff/AN01-SW-IOT06/SENSOR = {"Time":"2018-04-23T13:27:55","Analog0":520}

but im not getting the update on the sonoff/AN01-SW-IOT06/Analog0 for example as soon as there has been a change.

arendst commented 6 years ago

I see you get the teleperiod update message at 13:27:55 as designed.

You won't get an update when something changes as that would impact the performance of the device massively. You might want to play with command teleperiod.

See wiki regarding command usage and syntax.

I see no problem here.

baukeplugge commented 6 years ago

thx,

I have checked the TelePeriod now. but the lowest to go is 10 sec. i want to readout the voltage change from my doorbell. so if it is only reading it once per 10 second there would be a big change the doorbell will ring in between.

is it possible to overwrite the 10 sec minimal setting? can I maybe change that in the source code somewhere ?

Frogmore42 commented 6 years ago

Using the ADC input to tell if your doorbell button is pushed is generally not a great idea. It is not what it was designed to do. While it is possible to make it work, it would be much easier to use a gpio pin and configure it as an input.

To safely measure your doorbell voltage, you must have a conversion circuit to concert the typically 24VAC to less than 3.3VDC that analog in on NodeMCU can handle. If you have this, just hook it up to one of the gpio pins and configure it as a button in the module configuration. Note that depending on how you conversion circuit works, this might not work, since there is a pull-up on the gpio. I am not sure there is a way to disable that from the commands.

The reason you want to use a gpio pin is because they support interrupts and don't require polling to not miss events. If you want to use ADC, you would have to regularly (every 20-50ms) check the voltage and that would have to be done in the Tasmota code. Even with that it might miss really short presses.

arendst commented 6 years ago

With version 5.12.0n you have to possibility to use a rule triggering on any analog change. See Wiki rules example 6.

ascillato commented 6 years ago

Hi @baukeplugge

If your issue was solved, please, close it. Thanks :+1: