nodeMCU dimmer/switch/temp.sensor without arduino

6 years 7 months ago #757 by cdj
yes my file end in this way :
if hum then
       return h
    else   
       return t --, h
    end
  end
  -- expose interface
  M = {
    read = read,
  }
end
return M

Please Log in or Create an account to join the conversation.

6 years 7 months ago - 6 years 7 months ago #760 by Dennis
Hm, no idea what goes wrong. The first time it can give this result sometimes, but it should work the second time? Just tested right after esp reboot, this is what I get on two sequential tries:

> =dofile("dht22.lua").read(4,false,false)

nil 2
> =dofile("dht22.lua").read(4,false,false)

220
>

I've now created a github repository to not clutter this thread with always new code versions:

github.com/DennisSc/easyIoT-nodeMCU

Maybe you should erase everything on your nodeMCU, and start over with freshly downloaded files from there.

Also, now added code in init.lua to properly close tcp connection after each request, to fix bug with sensor showing 0,00 every 5th read.

regards

Please Log in or Create an account to join the conversation.

6 years 7 months ago - 6 years 7 months ago #761 by cdj
Ok changed file again and rock'n'roll... it works !
But you read from GPIO2 and not GPIO0 :) pin 4 :P
this is the issue...
very happy ! just one cosmetic things... is it difficult to put % after hum and ° after temp ?

thanks
Dario
The following user(s) said Thank You: Dennis

Please Log in or Create an account to join the conversation.

6 years 7 months ago #762 by Dennis
You can add the unit in the module settings in easyIoT.

regards
The following user(s) said Thank You: cdj

Please Log in or Create an account to join the conversation.

6 years 7 months ago #765 by EasyIoT

Dennis wrote: Hello Dario,

I suppose it is possible, but I've no BMP080 or BMP180 here to test.
edit - but I think when it needs two pins, then we can only connect BMP sensor and nothing else with ESP-01 modules. And esp is very power-hungry, I had a node running on 9V block with regulator set to 3,3v, it lasted only one day...

Hello easyIoT,

If I update position, then event to send value is triggered again - this is why sometimes it goes in loop. So I've removed position update. I don't know better method to disable event when value is updated.


The "update" event is triggered by graphical change of wheel position? What about triggering separate "graphical update" event for wheel, when sensor value changes, without triggering another update event for value change?
So that you've got two events: one for "real" change in module's values (initiated by user or automation; which also triggers graphical change event), the other just for the graphical change of wheel position (triggers *no* other event)?
ATM the numeric dimmer value works just like this I think, even with new js script you provided, it is visually updated properly on all clients when changed. Without loop.

edit - or you need to somehow differenciate between "wheel changed by user interaction" and "wheel changed by graphical update mechanism" to get wheel position updates to work properly?

edit2 - or what about detaching the "value changed" event handler while updating the wheel position, and re-enable the event handler afterwards? Something like here: stackoverflow.com/questions/744494/winfo...ble-an-event-handler

regards


You are right, but it doesn't work like that. When I change value event is also triggered. I didn't find a way to detach event. This happens in javascript in browser. I think it's bug in knob control.

Please Log in or Create an account to join the conversation.

6 years 7 months ago - 6 years 7 months ago #793 by cdj
Hey Dennis, i've seen in your GitHub new version with value.txt that record dimmer value! Great Idea, because before if module reset led goes off ! Thank you.

Now i've edited your init.lua to use bmp180. I've seen that Vladimir has done also query module for it.
Here it is !

Changing init.lua for me is very simple... but ... what is necessary to change in query module? :) thanks a lot

Regards
Dario

Please Log in or Create an account to join the conversation.

Time to create page: 0.326 seconds