OneWire (owhttpd) dies after seconds

Hi,

I am just installing OH2 after using OH1 with 1wire for a few years. My status:

  • 1Wire installed with openhabian-config
  • Config adjusted
  • lsusb shows the unwire USB devices
  • owfs is missing -> installed
  • (Applied differend bugfixes from different sites (can send details if needed)
  • Services are created, but owhttpd dies after a few seconds
    Nov 24 10:15:36 openhab systemd[1]: owhttpd.service: Main process exited, code=killed, status=11/SEGV
    Nov 24 10:15:36 openhab systemd[1]: owhttpd.service: Failed with result ‘signal’.

I get the service for a few seconds on port 2121

I see with “ls /mnt/1wire” a part of my Sensors, but not all of them. That was the case previously, as well, I am not sure, if it is a problem. (about. 30 sensors).

I would be happy for some help!

Best,
Florian

This forum is in english only, please
For help in German please go to: https://openhabforum.de/

2 Likes

sorry, translated the post!

1 Like

Hi,

My experience is OWFS has poor error logging, and tends to just exit (see below for command line debug). One working however, it stays working very well. You don’t mention the 1-Wire interface you are using, but suggest it is USB, such as a DS1420.

A few suggestions:

  • Use hardcoded ‘real’ IPv4 addresses in /etc/owfs.conf, not even localhost as it may try to use IPv6.
  • I have seen the USB interface fail after boot, but work fine after it is unplugged, re-plugged, and owserver restarted.

To debug, I suggest:

sudo systemctl restart owserver.service 
sudo systemctl status owserver.service 
vim /etc/init.d/owserver
vim /etc/owfs.conf
sudo /usr/bin/owserver  --help
/usr/bin/owserver -c /etc/owfs.conf
man /usr/bin/owserveronf
# foreground, full logging, log to console - all fails silently!
sudo /usr/bin/owserver --foreground --error_print=2 --error_level=5
sudo journalctl -f
sudo vim /etc/owfs.conf
  #server: port = localhost:4304
  server: port = 127.0.0.1:4304

sudo systemctl enable owserver.service
sudo systemctl restart owserver.service
sudo systemctl status owserver.service
  • PaperUI > Inbox > (+) > OneWire Binding > OW Server > Config Params > Network Address > localhost
  • Note the OW Server id (onewire:owserver:87654321)
  • PaperUI > Inbox > (+) > OneWire Binding > Add discovered Thing(s)

Hi James,

thanks for the suggestions. I am using the
Dallas Semiconductor DS1490F 2-in-1 Fob, 1-Wire adapter.

I changed the /etc/owfs.conf to 127.0.0.1:4304 and

sudo systemctl enable owserver.service
sudo systemctl restart owserver.service
sudo systemctl status owserver.service
and
sudo systemctl restart owhttpd.service

The owserver ist running and not crashing, but the owhttpd crashes after I browse to
http://192.168.178.47:2121 (it shows the devices though). But after I click refresh, it is dead.

sudo systemctl status owhttpd.service

[11:15:10] openhabian@openhab:~$ sudo systemctl status owhttpd.service 
● owhttpd.service - Tiny webserver for 1-wire control
   Loaded: loaded (/lib/systemd/system/owhttpd.service; enabled; vendor preset: enabled)
   Active: failed (Result: signal) since Tue 2019-11-26 11:15:07 CET; 4min 45s ago
     Docs: man:owhttpd(1)
  Process: 6964 ExecStart=/usr/bin/owhttpd --foreground -c /etc/owfs.conf (code=killed, signal=SEGV)
 Main PID: 6964 (code=killed, signal=SEGV)

Nov 26 11:13:00 openhab systemd[1]: Starting Tiny webserver for 1-wire control...
Nov 26 11:13:00 openhab systemd[1]: Started Tiny webserver for 1-wire control.
Nov 26 11:15:07 openhab systemd[1]: owhttpd.service: Main process exited, code=killed, status=11/SEGV
Nov 26 11:15:07 openhab systemd[1]: owhttpd.service: Failed with result 'signal'.

After restarting owhttpd I can access it again for one click. I unplugged the USP-Adapter and plugged it back in again, but that did not change anything.

Is it normal that the /mnt/1-wire is empty from time to time:

[11:22:15] openhabian@openhab:~$ ls /mnt/1wire/
bus.0  bus.1  settings  statistics  structure  system  uncached
[11:23:53] openhabian@openhab:~$ ls /mnt/1wire/
bus.0  bus.1  settings  statistics  structure  system  uncached
[11:23:55] openhabian@openhab:~$ ls /mnt/1wire/
bus.0  bus.1  settings  statistics  structure  system  uncached
[11:23:57] openhabian@openhab:~$ ls /mnt/1wire/
bus.0  bus.1  settings  statistics  structure  system  uncached
[11:23:58] openhabian@openhab:~$ ls /mnt/1wire/
bus.0  bus.1  settings  statistics  structure  system  uncached
[11:23:59] openhabian@openhab:~$ ls /mnt/1wire/
20.0FE101000000  28.4AD984000003  28.FF7259A21503  bus.0  settings      statistics  system
20.0FE101000000  28.4AD984000003  alarm            bus.1  simultaneous  structure   uncached

I started the owhttpd:
/usr/bin/owhttpd --debug -c /etc/owfs.conf

and I get to the error (probably):

   CALL: ow_parsename.c:(174) path=[/alarm]
  DEBUG: ow_regex.c:(53) Not found
  DEBUG: ow_regex.c:(53) Not found
  DEBUG: ow_regex.c:(53) Not found
  DEBUG: ow_parsename.c:(133) /alarm
  DEBUG: ow_dir.c:(199) ret=0
  DEBUG: ow_parsename.c:(133) /
  DEBUG: ow_net_server.c:(259) Normal completion.
   CALL: owhttpd_handler.c:(62) PreParse line=GET / HTTP/1.1

  DEBUG: owhttpd_handler.c:(370) URL parse file=/, request=, value=
   CALL: owhttpd_handler.c:(71) WLcmd: GET	file: /	request: 	value: 	version: HTTP/1.1
> compiled to 0x2813824) Reg Ex expression <host *: *([^ ]+) *
  DEBUG: owhttpd_handler.c:(566) Test line <Host: 192.168.178.47:2121
>
   CALL: owhttpd_handler.c:(62) PreParse line=GET /favicon.ico HTTP/1.1

  DEBUG: owhttpd_handler.c:(370) URL parse file=/favicon.ico, request=, value=
   CALL: owhttpd_handler.c:(71) WLcmd: GET	file: /favicon.ico	request: 	value: 	version: HTTP/1.1
><DEBUG: ow_regex.c:(100) 0: 0->26 found <><Host: 192.168.178.47:2121
>
Segmentation fault

Any ideas?

The issue does happen, if I visit 192.168.178.47:2121 with safari. With chrome it does not seem to crash!

Hi Florian,

I don’t personally use owhttpd' but suspect modern web browsers ask for items not supported by the OneWire HTTP server, such as the bookmark favorite icon shown in you logs - /favicon.ico. The basic owhttpd is probably only HTTP1, with browsers trying HTTP2 & HTTPS.

For openHAB to access 1-Wire devices, only owserver.service is needed on port 4304. I don’t use owhttps.service, and found it unreliable for testing in the past.

Personally, I use owserver and let the openHAB binding auto-discover all OneWire devices. These can them be added as Items, and displayed on your sitemap, or graphed all accessible from a browser.

I also found probems with ofws, so use the command line client owdir for testing only:

sudo systemctl status owserver.service
owdir
owdir /uncached
owget /<sensor listed by owdir>/temperature

# if that doesn't work - check the daemon is running and accessible via the network
sudo systemctl status owserver.service
telnet 127.0.0.1 4304

I’ve run owserver on Fedora for >10 years, on Raspbian, and now on default openhabian using a RPi4. Avoiding owhttpd and ofws seems to work! :slight_smile:

The openHAB OneWire Binding works well, and auto-discovers all items it finds. The only bug used to be displaying too many digits in the logs, but that is fixed now:

2019-11-26 19:12:17.194 [vent.ItemStateChangedEvent] - owOutside changed from 5.04851 to 5.03358

I hope this helps!

Hi,

thanks for the advice, that is a good option! I am little bit further:

sudo systemctl status owserver.service
# running, fine, but:
telnet 127.0.0.1 4304
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.

I changed the /etc/owfs.conf to

server: port = localhost:4304
or
server: port = 127.0.0.1:4304

and did a
sudo systemctl restart observer.service
each time, but it did not work.

I would really appreciate any advice?

Hi Florian,

A couple of things to check:

  • My /etc/owfs.conf is very simple - less is more here, so make a copy, and remove all other lines, leaving only what is needed:
! server: server = localhost:4304
server: usb = all
server: port = 127.0.0.1:4304
  • Don’t run owhttps, only owserver, and after changing the config file, check if is running:
sudo systemctl stop owhttps.service
sudo systemctl disable owhttps.service
sudo systemctl enable owserver.service
sudo systemctl restart owserver.service
sudo systemctl status owserver.service
  • owserver isn’t really designed for human interaction - the telnet command is only designed to show if the port is open for connections, you can’t actually do anything like a command line.
    As you saw Connected to 127.0.0.1., it is working, so test using the command line client:
owdir
owdir /uncached
  • If owdir works, you can try the binding:
* PaperUI > Inbox > (+) > OneWire Binding > OW Server > Config Params > Network Address > localhost
* Note the `OW Server` id (onewire:owserver:87654321)
* PaperUI > Inbox > (+) > OneWire Binding > Add discovered Thing(s)

Thanks again! I applied your suggestions and this still works:

owdir /uncached
/uncached/20.0FE101000000
/uncached/28.4AD984000003
/uncached/28.FF7259A21503
/uncached/28.FF4A76001602
/uncached/28.FFDA55001602
/uncached/28.FF465CA21503
/uncached/28.FFA67D021603
/uncached/bus.0
/uncached/settings
/uncached/system
/uncached/statistics
/uncached/structure
/uncached/simultaneous
/uncached/alarm

but sometimes there are no devices.

In openhab2 I work with config files only. I do not get the onewire working. My config:
onewire.config:
ip=127.0.0.1

onewire.things:
Bridge onewire:owserver:mybridge [
network-address=“127.0.0.1”
] {

   /*** temperature OneWireFridgeXXXXX   [ id="28.FFA67D021603" ] did not work as well ***/
   
   
    
/** KĂŒche **/
   Thing basic OneWireFridge [
       id="28.FFA67D021603", 
       refresh=60
       ] {
           Channels:
               Type temperature-por-res : temperature [
                   ignorepor=true,
                   resolution="11"
               ]
       }

1wire.items
Number OneWireFridge "Fridge [%.1f °C]" <smoke> (GroupKitchen) {channel="onewire:owserver:mybridge:OneWireFridge:temperature"}

sitemap contains:
Text item=OneWireKuehlschrank

Any suggestions?

One suggestion - stop attempting to manually create a complex config file manually. You will get it wrong.

I also use config files (I’m a Unix greybeard sys admin), but only where it makes sense.

Use autodiscovery to find the devices and create Things for them. You can them manually define Items using the automatic Thing IDs with your own names for use in rules, sitemaps, etc.

  • PaperUI > Inbox > (+) > OneWire Binding

  • PaperUI > Configuration > Things > Edit > OW Server > Config Params > localhost

  • Note the OW Server id (onewire:owserver:87654321)

  • PaperUI > Inbox > (+) > OneWire Binding > Add discovered Thing(s)

  • PaperUI > Configuration > Things > iButton

  • Note the OneWire Thing ID, such as onewire:ibutton:87654321:81_DEADBEAF0000

  • Create a new items file, such as /etc/openhab2/items/ow.items and use the Thing ID:

/* onewire item */
/* https://github.com/openhab/openhab/wiki/One-Wire-Binding */
Number	owInside	"Inside  [%.1f C]"	<temperature>	["InsideTemperature"]	{channel="onewire:temperature:8764321:99_DEADBEAF0000:temperature"}

I now found some time to try again:

[19:31:11] openhabian@openhab:~$ ls /mnt/1wire/
bus.0  bus.1  settings  statistics  structure  system  uncached
[19:31:30] openhabian@openhab:~$ ls /mnt/1wire/
20.0FE101000000  26.743F1B010000  28.FF4F5DA21503  28.FF8F6BA21503  28.FFDA55001602  settings
26.49D984000003  26.B8A915020000  28.FF7259A21503  28.FF916DA21503  28.FFDF6CA21503  simultaneous
26.54D984000003  28.4AD984000003  28.FF7362001601  28.FF9624A21503  81.275535000000  statistics
26.55D984000003  28.FF0D64001601  28.FF81A5921501  28.FF9972021603  alarm            structure
26.655A38020000  28.FF465CA21503  28.FF8957A21503  28.FFA67D021603  bus.0            system
26.6F5A38020000  28.FF4A76001602  28.FF8F5BA21503  28.FFD56CA21503  bus.1            uncached

services/onewire.cfg:
ip=127.0.0.1

services/addons.cfg:
binding =knx,network,homekit,denonmarantz,onewire

things/onewire.things:
Bridge onewire:owserver:mybridge [network-address=“localhost”, port=4304 ] {
Thing basic OneWireKuehlschrank [
id=“28.FFDA55001602”,
refresh=60
] {
Channels:
Type temperature-por-res : temperature [
resolution=“11”
]
}

}

http://192.168.178.47:9001:
2019-12-27 19:38:49.871 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘onewire.things’
==> /var/log/openhab2/events.log <==
2019-12-27 19:38:49.899 [hingStatusInfoChangedEvent] - ‘onewire:owserver:bridge’ changed from UNINITIALIZED to INITIALIZING
2019-12-27 19:38:49.903 [hingStatusInfoChangedEvent] - ‘onewire:owserver:bridge’ changed from INITIALIZING to UNKNOWN
2019-12-27 19:38:49.909 [hingStatusInfoChangedEvent] - ‘onewire:owserver:bridge’ changed from UNKNOWN to ONLINE
==> /var/log/openhab2/openhab.log <==
2019-12-27 19:38:50.987 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘onewire.things’

/items/onewire.items:
Number:Temperature OneWireKuehlschrank "KĂŒhlschrank [%.1f °C]" <smoke> (GroupKueche, Kuehli,GroupTemperaturAlle) {channel="onewire:basic:owserver:mybridge:OneWireKuehlschrank:temperature"}

http://192.168.178.47:9001:
2019-12-27 19:40:47.559 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘onewire.items’
==> /var/log/openhab2/events.log <==
2019-12-27 19:40:47.587 [.ItemChannelLinkAddedEvent] - Link ‘OneWireKuehlschrank-onewire:basic:owserver:mybridge:OneWireKuehlschrank:temperature’ has been added.
==> /var/log/openhab2/openhab.log <==
2019-12-27 19:40:48.613 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘onewire.items’

in the sitemap I have:
Text item=OneWireKuehlschrank

I do not use paperUi, but there it says that the onewire bindung is installed.

Under configuration->Things it says “OW Server” online. But if I click on it, there are no Channels listed. At the KNX Thing, there are all my things


If I click on inbox -> “+” -> Onewire Binding, nothing happens, it searches forever.

If I add it manually, it appears at Configuration->Things and Stays at “initializing”. If I add it to the items/onewire.items:
Number:Temperature OneWireKuehlschrank "KĂŒhlschrank [%.1f °C]" <smoke> (GroupKueche, Kuehli,GroupTemperaturAlle) {channel="onewire:temperature:c7135fa0"}
it does not work.

2019-12-27 20:01:28.575 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type 'channel' of item 'OneWireKuehlschrankPaperUi' could not be parsed correctly.
org.eclipse.smarthome.model.item.BindingConfigParseException: UID must have at least 4 segments.

Any ideas on debugging?