Comments (16)
Hmm, that would be handy, wouldn't it? It's not possible right now, but I'll have a think about it and see if I can include it next time I work on the project.
from mqtt-io.
Cool sounds good....
from mqtt-io.
Reopening to keep the feature request around for if I ever get some time off to work on it.
from mqtt-io.
Is that possible to add support for MCP23017 - it has 16 I/O ports , I2C and each port can be loaded with 20mA , it has as well switchable active pullup resistors. I probably will use ur project to control my smart house based on PCF, but MCP is good idea as well. For now i see that will need at least two expanders on pcf... If i use two expanders with same addresses whether those two will be work same - i mean - if ill connect leds to both - the states of leds will be same or on i2c will be conflict due to same addresses ? i need one pcf to connect to control lamps ( leds )for my house. Anyway great project! Keep going like that!!! regards
from mqtt-io.
Hey @eXCepT74
The MCP23017 is certainly suitable for use with this project, but could you make a separate Issue please? You can just copy and paste your comment into a new one.
Cheers
from mqtt-io.
from mqtt-io.
Following :)
from mqtt-io.
Currently I'm working on the interrupt issue (#5), but how may a yaml config for dht11/dht22 look? You have two values on one sensor, that should appear in two different topics. My suggestion (I steel the config idea as I've implemented it for lm75 i2c temperatur sensor in pullrequest #52)
sensor_modules: //list for all sensor_modules, like for gpio_modules
- name: dht11_sensor_temperature
module: dht11
gpio: 16 //pin dht11 sensor is connected to
value: temperatur
- name: dht11_sensor_humidity
module: dht11
gpio: 16 //pin dht11 sensor is connected to
value: humidity
So we config the dht11/22 sensor twice on the same pin. First time with temperature value and second time with humidity value. These values will be passed to module instance and stored intern, to select which value should be returned.
In the sensor_inputs we create two entries, too, first using the dht11_sensor_temperature and second using dht11_sensor_humidity. This gives us the possibility to configure the mqtt topic and for example different update times:
sensor_inputs:
- name: my_temperature // mqtt topic
module: dht11_sensor_temperature
interval: 120 // 2*60sec, each 2 min
digits: 2 // digits to round the value to
- name: my_humidity
module: dht11_sensor_humidity
interval: 240 // e.g. every 4 minutes
digits: 1
This should create the following mqtt topics with values:
mydevice/sensor/my_temperature 19.50
mydevice/sensor/my_temperature 19.50
mydevice/sensor/my_humidity 41.0
mydevice/sensor/my_temperature 19.50
mydevice/sensor/my_temperature 19.50
mydevice/sensor/my_humidity 41.0
Any suggestions or does someone see a problem?
from mqtt-io.
It would be nice to keep the module configs 1:1 with the physical modules, so in sensor_modules
it should be listed once. The module name doesn't have a bearing on the topic, so the temperature/humidity configuration could be on the sensor_inputs
instead. Something like:
sensor_modules:
- name: dht11_sensor
module: dht11
i2c_bus_num: 1
chip_addr: 0x20
sensor_inputs:
- name: livingroom_temp
module: dht11_sensor
interval: 120
digits: 2
sensor: temperature
- name: livingroom_humidity
module: dht11_sensor
interval: 240
digits: 1
sensor: humidity
What do you reckon?
from mqtt-io.
That's of course the better solution. I already implemented this "interface" for LM75 I2C sensor on the other branch: when getting the value from the sensor in the sensor_timer_thread
, the sensor
is passed to the read function. We just need to pass the sens_conf
to the get_value()
function, instead of the sensor
value:
sensor = SENSOR_MODULES[sens_conf["module"]]
try:
value = round(sensor.get_value(sensor),
sens_conf["digits"])
the get_value
function can now evaluate the sensor
attribute and return the value.
I have two other points:
- Does someone know a good, free, usable DHT11/22 library?
- I read, that the DHT11/22 sensor shouldn't be read more often then every 1 or 2 seconds. This should be kept in mind for implementation: if we read the temperature with the first
get_value()
call, and directly after this the humidity with the secondget_value()
, the DHT sensor class must recognize this and return the previous read value, and is not allowed to read the DHT11/22 again within this short time.
from mqtt-io.
Would this work for a ds18b20 as well?
from mqtt-io.
Would this work for a ds18b20 as well?
No, as far as I know, one wire from dht11 and one wire from ds18b20 are incompatible. So you should create a new issue for ds18b20, if you want it to be supported. Maybe you could try a library, that should be supported and mention it there. (e.g. https://github.com/timofurrer/w1thermsensor)
from mqtt-io.
Does someone know a good, free, usable DHT11/22 library?
Maybe this one?
https://github.com/adafruit/Adafruit_Python_DHT
from mqtt-io.
Hello,
I can not walk to module it shows me this error message
Config did not validate:
sensor_inputs:
- 0:
- type:
- unknown field
1:
- type:
- unknown field
here is my config.yml file
mqtt:
host: 192.168.0.85
port: 1883
user: ""
password: ""
topic_prefix: home
sensor_modules:
- name: dht22
module: dht22
type: DHT22
pin: 17
sensor_inputs:
- name: dht22_temperature
module: dht22
interval: 10
digits: 4
type: temperature
- name: dht22_humidity
module: dht22
interval: 10
digits: 4
type: humidity
I work on rasbian Buster I have installed the library Adafruit-DHT,
I also try on rasbian jessie but nothing always the same mistake ...
when I do ./AdafruitDHT.py 22 17 it works well and returns me as a result:
Temp=23.2* Humidity=74.8%
an idea of ββwhere is my problem?
PROBLEM SOLVED i had to redo the installation manually the dht22.py
module was wrong
from mqtt-io.
Hello,
I'm also having the same problem with DHT11.
Installed pi-mqtt-sensor and Adafruit_Python_DHT with pip (sudo privileges)
My config file works without sensor lines. When I add DHT sensor lines;
Config did not validate:
sensor_inputs:
- 0:
- type:
- unknown
here my config.yml
mqtt:
host: (webaddress)
port: (port)
tls:
enabled: yes
cert_reqs: CERT_NONE
insecure: yes
user: "(user)"
password: "(pass)"
topic_prefix: station
status_topic: status
status_payload_running: running
status_payload_stopped: stopped
status_payload_dead: dead
gpio_modules:
- name: raspberrypi
module: raspberrypi
sensor_modules:
- name: dht22
module: dht22
type: dht11
pin: 5
sensor_inputs:
- name: dht22_temperature
module: dht22
interval: 10
digits: 4
type: temperature
from mqtt-io.
I believe this is fixed now. Please feel free to comment if it's not.
from mqtt-io.
Related Issues (20)
- Chip has no attribute 'OPEN_BY_NAME' - Orange Pi Zero HOT 2
- KeyError when trying to run on Orange Pi Zero 2W, Ubuntu 22.04 HOT 2
- Raspberry pi 5 support? HOT 1
- use RPIO instead of RPi.GPIO
- Separate Devices Running MQTT IO Are Recognized as a Single Device in Home Assistant HOT 1
- MQTT Io On OrangePi 5 HOT 1
- Issues with paho-mqtt 2.0 HOT 4
- Crash using gpiod HOT 1
- Release version 2.3.0
- New version not working HOT 12
- Wont Connect to MQTT Broker and getting error in log from python script HOT 2
- DHT22 Adafruit_DHT problem HOT 3
- MCP23017 module not starting in mqtt-io Add-on HOT 1
- Crash on startup HOT 6
- Request support for Orange Pi CM4
- Incompatibility Python typing-extensions HOT 1
- adxl345 Module outdated and does not install HOT 1
- MQTT does not reconnect on authentication failure
- docker not buildable due to "Package docutils (0.21.post1) not found."
- Add support for HTU21d
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mqtt-io.