1-Wire (OWFS) controller

Allows to communicate with 1-Wire equipment via OWFS (built-in). Supports both OWFS servers and direct 1-Wire bus access.

Setup

Use the template EVA_DIR/share/svc-tpl/svc-tpl-controller-w1.yml:

# 1-Wire (OWFS) controller service
command: svc/eva-controller-w1
bus:
  path: var/bus.ipc
config:
  # OWFS path, socket or I2C init command
  path: localhost:4304
  # default retry attempts for all operations (0 - no retries, give up if the
  # first attempt fails)
  retries: 2
  # an optional delay betwen writing tags and verifying written value
  #verify_delay: 0.1
  # event queue size, pull events ARE DROPPED on overflow. consider ALWAYS
  # having queue size > max possible tags pulled
  queue_size: 32768
  # ttl cache for pull events (sec, skip non-modified)
  pull_cache_sec: 3600
  #pull:
    #- oid: sensor:tests/s1
      #interval: 1 # pull interval (sec)
      #path: 29.F2FBE3467CC2/temperature
      #value_delta: 0.5 # report event only if the new value difference is >=
      # perform value transformations
      #transform:
        #- func: multiply # multiply the value by N
          #params: [ 1000 ]
        #- func: divide # divide the value by N
          #params: [ 1000 ]
        #- func: round # round the value to N digits after comma
          #params: [ 2 ]
        #- func: calc_speed # use the value as calc-speed gauge (with N seconds delta)
          #params: [ 1 ]
        #- func: invert # invert the value between 0/1
        # #params: []
  # action queue size, per item, actions on overflow are not dropped but wait
  # their attempt to enter the queue. The core marks an action as failed if it
  # does not enter the queue for <action timeout> seconds
  action_queue_size: 32
  # verify written data for actions
  actions_verify: true
  # OID map for actions
  #action_map:
    #unit:tests/u1:
      #path: 29.F2FBE3467CC2/PIO.0
user: nobody
react_to_fail: true

Create the service using eva-shell:

eva svc create eva.controller.w1_1 /opt/eva4/share/svc-tpl/svc-tpl-controller-w1.yml

or using the bus CLI client:

cd /opt/eva4
cat DEPLOY.yml | ./bin/yml2mp | \
    ./sbin/bus ./var/bus.ipc rpc call eva.core svc.deploy -

(see eva.core::svc.deploy for more info)

EAPI methods

See EAPI commons for the common information about the bus, types, errors and RPC calls.

action

Description

Executes a mapped unit action

Parameters

See Unit actions

Returns

See Unit actions

kill

Description

Attempts to terinate/cancel all actions for a unit

Parameters

See Unit actions

Returns

See Unit actions

terminate

Description

Attempts to terminate/cancel a unit action

Parameters

See Unit actions

Returns

See Unit actions

w1.get

Description

Get 1-Wire attribute

Parameters

required

Returns

Attribute value

Parameters

Name

Type

Description

Required

path

String

dev.path/attr

yes

timeout

f64

Max operation timeout

no

retries

u8

Retry attempts

no

w1.info

Description

Get 1-Wire device info

Parameters

required

Returns

Device info struct

Parameters

Name

Type

Description

Required

path

String

device path

yes

timeout

f64

Max operation timeout

no

Return payload example:

{
    "attrs": [
        "address",
        "alias",
        "crc8",
        "family",
        "id",
        "latesttemp",
        "locator",
        "power",
        "r_address",
        "r_id",
        "r_locator",
        "scratchpad",
        "temperature",
        "temphigh",
        "templow",
        "type"
    ],
    "family": 10,
    "path": "10.67C6697351FF",
    "type": "DS18S20"
}

w1.scan

Description

Scan 1-Wire bus

Parameters

required

Returns

Scan result (list)

Parameters

Name

Type

Description

Required

types

String/Vec<String>

filter by device type(s)

no

attrs_any

String/Vec<String>

filter by device attrs(s), match any

no

attrs_all

String/Vec<String>

filter by device attrs(s), match all

no

timeout

f64

Max operation timeout

no

full

bool

return extended info (attributes)

no

Return payload example:

[
    {
        "family": 10,
        "path": "10.67C6697351FF",
        "type": "DS18S20"
    },
    {
        "family": 5,
        "path": "05.4AEC29CDBAAB",
        "type": "DS2405"
    },
    {
        "family": 29,
        "path": "29.F2FBE3467CC2",
        "type": "DS2408"
    }
]

w1.set

Description

Set 1-Wire attribute

Parameters

required

Returns

nothing

Parameters

Name

Type

Description

Required

path

String

dev.path/attr

yes

value

Any

value to set

yes

verify

bool

Read the attribute back and verify its value

no

timeout

f64

Max operation timeout

no

retries

u8

Retry attempts

no