Hassio owfs installation/setup

Hi there,

can someone maybe tell me if this is still valid for the latest hassio image based on HassOS?

Interface adapter setup
When an interface adapter is used, sensors can be accessed on Linux hosts via owfs 1-Wire file system. When using an interface adapter and the owfs, the mount_dir option must be configured to correspond a directory, where owfs device tree has been mounted.

I want to use a 1Wire USB interface adapter (DS9490R) to read 1wire sensors using owfs.

Can you help me to set this up ?

Best Regards and thanks in advance

Felix

I’m too trying this, but with an i2c adapter and only with ResinOS. I’ve succeeded in getting owserver to run as an addon and access my adapter. But I never succeeded in getting any further…Anyone has a clue on how to proceed? If the onewire component would be able to access i2c and usb bus adapters, or a running owserver, that would be marvellous.

1 Like

How did you get the OWFS server setup ? :slight_smile: Right now i cant even get that far on HassOS. My setup is working as i tested it with windows… i could install and read the sensor there.

I Installed this addon:

With HassOS I can’t seem to get i2c working though.

Thanks! I will try that one as well and see if it works :slight_smile:

Update: Does not seem to work… it does not even get installed:

18-08-03 13:13:11 INFO (SyncWorker_11) [hassio.docker.interface] Pull image bestlibre/aarch64-owserver tag 0.1.0.
18-08-03 13:13:13 ERROR (SyncWorker_11) [hassio.docker.interface] Can’t install bestlibre/aarch64-owserver:0.1.0 → 404 Client Error: Not Found (“pull access denied for bestlibre/aarch64-owserver, repository does not exist or may require ‘docker login’”)

Seems as if you’re running the 64 bit build, and the repo only has 32 bit builds of owserver?

Oh yes … that could be the issue! Thanks for the hint :smile:

I am thinking of installing an “external” ow server based on a second Raspberry and implement the sensors connected to that Raspberry. Do you happen to know if thats even possible?

Yes it is, I’m running it like that myself at the moment. I’m using MQTT Eventstream: https://www.home-assistant.io/components/mqtt_eventstream/ using the HassOS as master and a raspbian running home assistant as slave.

1 Like

Perfect… i have just setup the owfs server. Can you let me know what do i have to choose for

  publish_topic: MyServerName
  subscribe_topic: OtherHaServerName

This is not clear to me as i these are strings not ip adresses?
And how can i read a temp sensor afterwards for example?

Hm i guess this is only working with 2 instances of HA right? Not with one Raspberry running hassio and a second raspberry running the owfs server based on raspbian stretch?

The mqtt topics are just text strings that prefix the values. The host running the mqtt server is specified in the mqtt configuration. My boxes look like this:

# Master HA (running HassOS, and also running the mqtt server addon)
mqtt:
  broker: localhost
mqtt_eventstream:
  publish_topic: master/topic
  subscribe_topic: slave/#

# Slave HA (running raspbian)
mqtt:
  broker: hassio.lan
mqtt_eventstream:
  publish_topic: slave/raspbian

This way the master HA will read ALL topics under slave/, but the slaves will only know about the sensors connected to them.

1 Like

Sounds good but i think i cant use that cause HA is not installed on my second raspberry only OWFS and MQTT is installed on that one.

Additionally i may have found another way to get the sensor data in, i could do it using nodered as well. Nodered installed on hassio was able to read my sensor connected to the owfs server using a node called:`

node-red-contrib-owfs

Any news how tom use DS9490 USB adapter on hass.io ?

1 Like

Did you get this to work

No i dont run on hassio

any news how run OWFS on HASSIO ?

I have been trying to invent my own method. I have a remote RPi3 with temp sensor. I have installed the mosquitto-client and can make this command work. It sends the w1 data to the mqtt server which is running on the Home Assistant Rpi4 on a remote machine. However, I am unsure what to do with it once it arrives.

#mosquitto_pub -h 192.168.x.x -u username_on_server -P password_on_server -t "dev/test" -m "`cat /sys/devices/w1_bus_master1/28-0000075c24c1/w1_slave`"

I can cron this to run once per minute, but what do I do with this data once it arrives?

Message 1 received on dev/test at 1:38 AM:

5a 01 4b 46 7f ff 06 10 a3 : crc=a3 YES
5a 01 4b 46 7f ff 06 10 a3 t=21625

Okay I have finally figured this out and wow was I going about it all wrong. It’s really quite simple.
So I set up a remote Rpi3 with a DS18B20 Temperature sensor on the 1 wire bus and I needed to get this data into HA without running HA on both devices.

  • Installed the mosquitto-client on the RPi3
  • Installed the paho.mqtt python3 module #sudo pip3 install paho.mqtt
  • Found a python script for reading the DS18B20 sensor and modified it to be mqtt friendly.
  • Removed password setting from the mosquitto server (broker). I have not yet figured out how to send un/pw via the python mqtt client module.
  • added a few lines to configuration.yaml so it can find the new temperature sensor.

This is the python script:

#!/usr/bin/python3.7
import glob
import time
import os
import paho.mqtt.client as mqtt

base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
     
def read_temp_raw():
    f = open(device_file, 'r')
    lines = f.readlines()
    f.close()
    return lines
     
def read_temp():
    lines = read_temp_raw()
    while lines[0].strip()[-3:] != 'YES':
        time.sleep(0.2)
        lines = read_temp_raw()
    equals_pos = lines[1].find('t=')
    if equals_pos != -1:
        temp_string = lines[1][equals_pos+2:]
        temp_c = float(temp_string) / 1000.0
        temp_f = temp_c * 9.0 / 5.0 + 32.0
        return temp_f
  
while True:
    print(read_temp())
    upstairstemp = read_temp()
    client = mqtt.Client()
    client.connect("192.168.254.101",1883,60)
    client.publish("temp/upstairs", upstairstemp);
    client.disconnect();
    time.sleep(10)

And here are the entries I added to configuration.yaml

sensor:
  - platform: mqtt
    state_topic: "temp/upstairs"
    name: Upstairs Temperature

mqtt:
  broker: 192.168.254.101

Any news on the DS9490R (USB I2C Master Bus). I’m trying to get my sensor data into the DS9490R but it doesn’t work. It seems like a hardware/wiring issue to me. Someone who has succeeded in this?