GPIO 1-Wire Temp sensors on Raspberry Pi with openHABian

thanks for the tutorial.
I’m almost getting there.

I get “[sudo] password for openhabian” when i try to run the scripts.
I’m new to openhab and tried the standard password “passwd”, no success
also tried password “openhabian” but then i get output “(standard_in) 1: illegal character: ^M”

Do you know what goes wrong?

That is the default…
You could also try pi:raspberry . Is is possibly a keyboard/language setting? Ive come across a few posts on the forum about different language keyboards running into this problem (QUERTY vs. QUERTZ?). If you have just done fresh install it wouldnt be too much to stsrt over with a new .img and try again. Good luck!

No need to go overboard :slight_smile:

  1. The default username and password are “openhabian”. See
  2. keyboard problems are only present if you are physically working on the RPi. I’d strongly suggest to work from a PC via SSH. This way you do also not encounter the keyboard problem.
  3. illegal character: ^M" is one of the classics of Linux problems when you are working with different operation systems. See here for what to do:

Why is the temperature value as String type?
How to convert String type to Number type?
It is not possible to operate whit it!

@Bagunda the temp value output of the script is a string. I am not aware of a way around this with the original script, but I’m sure it’s possible.

There are several examples on the forum of how to convert/cast/parse the String to a Number/Decimal, such as:

I have followed my own tutorial a few times (fresh installs) and receive a working setup each time. If you find a more efficient way of implementing this using Number items please reply with your code and I’d be happy to update the tutorial.

I think in openhab2 and the exec bindnig this is not possible anymore.
As the output channel of the exec binding will always be a string.

Maybe this helps.

hello, i know that this is a fairly old post now, but i’m having difficulty with this script. i can the the UI happening but cannot work out how to get it to read the temp sensors. any help on this would be most appreciated.


Great tutorial, thanks. Has anyone successfully connected an AM2301 censor through 1-wire? I’ve gone through the steps and I see the /sys/bus/w1 directory but it only contains w1_bus_master subdirectory and nothing with sensor ID’s. Anyone know where to look?

P.S. Adafruit DHT reads the temperature and humidity fine.

AM2301 sensors are not Dallas OneWire sensors, they use their own protocol. I am building up the selection of modules for MQTTany and plan to include one to provide access to DHT/AM23 sensors over MQTT as well as Dallas OneWire sensors.

1 Like

I’m not an expert in RPI nor Linux nor Python.
I tried installing and running MQTTany, but so far failed :sleepy:

Please provide some real example config files for beginners.
Thank you

2019-11-26 19:38:15,048 [ERROR] [mqttany ] yaml.parser.ParserError: while parsing a block mapping
2019-11-26 19:38:15,049 [ERROR] [mqttany ] in “/etc/mqttany/mqttany.yml”, line 206, column 3
2019-11-26 19:38:15,050 [ERROR] [mqttany ] expected , but found ‘’
2019-11-26 19:38:15,051 [ERROR] [mqttany ] in “/etc/mqttany/mqttany.yml”, line 218, column 5

Looks like there are a couple of errors in your config file. Have a look at line 206 and 218, as shown in the log you posted.

If you still need help, please open an issue on github and post your entire config file using code fences.

Hi, yes I also understand that something is wrong in those lines… that’s why I would like examples of working config files because it’s not clear when to use ’ signs and when not… if you make it more dummy proof more people will use your code…

1 Like

I’m working on it, but currently the program is about 4 months old and I have 2 users that I know of, only one of which is using the OneWire module. I don’t have a lot of feedback to go on.

Please open an issue on github as this forum is for openhab support only. Post your config file, or at least the OneWire section and we can sort out your problem and discuss improvements to the documentation further.

Maybe a stupid remark but… is the breadboard diagram correct? The A4 pin seems to go to the wrong side of the bus.


Yes, you are right, it should go to the ground

1 Like

could you please provide an example file (mqttany.xml) for providing onewire DS18B20-signals to bus?
I think, your mqttany would be THE perfect tool for GPIO I/O - but your abstract documentation is unfortunately not “dummy proof”…
Please: just provide some (working) lines of code, how to output any ‘28-…’.
Thanks in advance!

Why not just use the existing binding for these sensors?

…because - for me - Tasmota is much more reliable and I am going to de-centralize some important smart actions (point–to–point from gpio via mqttany via broker to tasmota).
Nevertheless I want to read these values in openhab too.
So the best way for me is: not installing thousands of bindings for each “thing”, but installing (and understanding!) bindings only essential openhab-bindings.

Fair enough…
my system has 5 temp sensor Things from a single GPIO binding and has been very reliable


I have CAT5 Cables in my whole house. 3 loops in each floor. The length of each floor is about 20m.
Is that a problem for the raspberrypi ? should I take the 3,3V from external ?
or is for that kind of project the raspberry pi not possible?