Coder Social home page Coder Social logo

mwittig / pimatic-unipi-evok Goto Github PK

View Code? Open in Web Editor NEW
1.0 5.0 2.0 117 KB

Pimatic Plugin for UniPi boards and Neuron PLCs - http://www.unipi.technology

License: Apache License 2.0

CoffeeScript 99.75% JavaScript 0.25%
unipi unipi-board home-automation internet-of-things pimatic pimatic-plugin iot

pimatic-unipi-evok's Introduction

pimatic-unipi

Dependency Status npm version Build Status

Pimatic Plugin for UniPi Technology PLC boards based on the Evok UniPi API. The plugin has been tested with Evok 2.0 using a UniPi 1.1 board. It should also work UniPi Lite and Neuron boards. Note, Evok 1.0 is no longer supported.

Contributions

If you like this plugin, please consider ★ starring the project on github. Contributions to the project are welcome. You can simply fork the project and create a pull request with your contribution to start with.

Getting Started

To be able to use the plugin you need to install Evok 2.0 on the Raspberry Pi mounted on the UniPi board. Pimatic can either be installed on the same Raspberry Pi or on another host on the local network. Note, Evok 1.0 is also known to work, but will no longer be supported.

Plugin Configuration

You can load the plugin by editing your config.json to include the following in the plugins section. You need to provide the URL of the Evok Web Server.

{
   "plugin": "unipi-evok",
   "url": "http://unipi.fritz.box"
}

The plugin has the following configuration properties:

Property Default Type Description
url - String URL of the Evok Web Server
debug false Boolean Provide additional debug output if true
timeout 10 Number Timeout in seconds for HTTP REST Requests

Device Configuration

As of pimatic version 0.9, devices can be added easily using the discovery function of the pimatic frontend. However, if you wish to add devices directly to the config file instead, snippets are provided for all device types.

Relay Device

The Relay Device is based on the PowerSwitch device class. You need to provide the circuit id as shown by Evok.

{
      "id": "unipiRelay-1",
      "class": "UniPiRelay",
      "name": "Relay 1",
      "circuit": "1"
}

The Relay Device has the following configuration properties:

Property Default Type Description
circuit "1" String Circuit id as shown by Evok

The Relay Device exhibits the following attributes:

Property Unit Type Acronym Description
state - Boolean - Switch State, true is on, false is off

The following predicates and actions are supported:

  • {device} is turned on|off
  • switch {device} on|off
  • toggle {device}

Digital Output Device (Neuron Boards)

The Digital Output Device is based on the PowerSwitch device class. You need to provide the circuit id as shown by Evok.

{
      "id": "unipiRelay-1",
      "class": "UniPiRelay",
      "name": "Relay 1",
      "circuit": "1"
}

The Digital Output Device has the following configuration properties:

Property Default Type Description
circuit "1" String Circuit id as shown by Evok

The Digital Output Device exhibits the following attributes:

Property Unit Type Acronym Description
state - Boolean - Switch State, true is on, false is off

The following predicates and actions are supported:

  • {device} is turned on|off
  • switch {device} on|off
  • toggle {device}

Digital Input Device

The Digital Input Device is based on the ContactSensor device class. You need to provide the circuit id as shown by Evok.

{
      "id": "unipiDigitalInput-1",
      "class": "UniPiDigitalInput",
      "name": "Digital Input"
      "circuit": "1"
}

The Digital Input Device has the following configuration properties:

Property Default Type Description
circuit "1" String Circuit id as shown by Evok

The following predicates are supported:

  • {device} is opened|closed

Analog Input Device

The Analog Input Device is based on the Sensor Device device class. You need to provide the circuit id as shown by Evok.

{
      "id": "unipiAnalogInput-1",
      "class": "UniPiAnalogInput",
      "name": "Analog Input",
      "circuit": "2"
}

The Analog Input Device has the following configuration properties:

Property Default Type Description
circuit "1" String Circuit id as shown by Evok

The Analog Input Device exhibits the following attributes:

Property Unit Type Acronym Description
inputVoltage V Number U Input Voltage

The following predicates are supported:

  • inputVoltage of {device} is equal to | is less than | is greater than {value}, more comparison operators are supported

Analog Output Device

The Analog Output Device is based on the DimmerActuator device class.

{
      "id": "unipiAnalogOutput-1",
      "class": "UniPiAnalogOutput",
      "name": "Analog Output",
      "circuit": "1"
}

The Analog Output Device has the following configuration properties:

Property Default Type Description
circuit "1" String Circuit id as shown by Evok

The Analog Output Device exhibits the following attributes:

Property Unit Type Acronym Description
outputVoltage V Number U Output Voltage
dimlevel - Number - 0-100% (Output Voltage Control)

The following predicates and actions are supported:

  • outputVoltage of {device} is equal to | is less than | is greater than {value}, more comparison operators are supported
  • dim {device} to {Value}, where {Value} is 0-100

Temperature Device

The Temperature Device is based on the TemperatureSensor device class.

{
  "id": "unipiTemperature-1",
  "class": "UniPiTemperature",
  "name": "Temperature",
  "circuit": "2832ECD906000025"
}

The Temperature Device has the following configuration properties:

Property Default Type Description
circuit "1" String Circuit id as shown by Evok

The Temperature Device exhibits the following attributes:

Property Unit Type Acronym Description
temperature °C Number T Temperature

The following predicates are supported:

  • temperature of {device} is equal to | is less than | is greater than {value}, more comparison operators are supported

Trouble Shooting

  • "Error: unable to get status for device circuit ... Internal Server Error (500)"

    If you get this error occasionally, it most likely occurs because you have setup a pimatic device with a circuit id which no longer exist in your Evok configuration, e.g. a 1wire sensor which has been unplugged from the the board.

  • "TypeError: Buffer.alloc is not a function" during installation

    Make sure, you have node version 4.5 or greater installed.

Acknowledgments

I would like to thank UniPi.technology for providing me with a UniPi 1.1 board for development. In particular, I would like to thank Tomáš Hora for his excellent support!

History

See Release History.

License

Copyright (c) 2015 - 2020, Marcus Wittig and contributors

All rights reserved.

MIT

pimatic-unipi-evok's People

Contributors

greenkeeper[bot] avatar greenkeeperio-bot avatar mwittig avatar sedlons avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

sedlons bertreb

pimatic-unipi-evok's Issues

Unipi DeviceClass not available after update from version 0.1 to 0.3.1 "Buffer.alloc is not a function"

I would like to share an issue I had when I updated from version 0.1 to 0.3.1. I also updated the evok version from 1.0 to 2.0 (1.0 seems not to work with pimatic-unipi-evok 0.3.x). After updating pimatic-unipi-evok to 0.3.1 no UniPi device class was available in pimatic anymore, exiting devices were not able to be managed.
The pimatic-daemon.log throw an error "Buffer.alloc is not a function" which seems to be connected to the Node version <4.5. Compare lovell/sharp#847
After updating to 4.8.3 as it it recommended in the Pimatic installation guide everything worked well.
Maybe an update of the installation dependencies of this plugin would help. Put there are already some movements in pimatic to go forward with more current node versions...

losing Events on Digital Inputs

Hi,

I have connected a pulse counter from a hal-sensor (Flow Meter) to a digital input from my unipi. I am trying to run

"when unipi-digital-input-2_01 is opened then set $flow2-liters = $flow2-liters + 0.0833"

(my hal senor give on pulse for every 0.0833 liters of liquid)

Does not work well when receiving multiple events per second. Is there any option with pimatic-unipi-evok to read the counter value? or an different way to count frequent digital inputs ?

Kind Regards,
Manon

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml
  • The new Node.js version is in-range for the engines in 1 of your package.json files, so that was left alone

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

plugin issue since update to version 0.3.1

Since update to version 0.3.1 the unipi devices are not functional anymore. The pimatic web frontend does not show the switches or sensors (only the box and the device name). I cannot add new unipi devices class unipi not available anymore. Version 0.2.10 worked well until update.
I also checked the direct unipi website which is also working well.

Improve error handling for malformed URLs

error [pimatic-unipi-evok]: [UniPiUpdateManager] Web Socket Closed
00:44:49error [pimatic-unipi-evok]: [UniPiUpdateManager] Web Socket Error: Error: getaddrinfo ENOTFOUND 82ws 82ws:80
00:44:30error [pimatic-unipi-evok]: Error
   at Object.stack (/home/pi/pimatic-app/node_modules/pimatic-unipi-evok/node_modules/pimatic-plugin-commons/lib/index.js:251:100)
   at Object.rejectWithErrorString (/home/pi/pimatic-app/node_modules/pimatic-unipi-evok/node_modules/pimatic-plugin-commons/lib/index.js:155:21)
   at /home/pi/pimatic-app/node_modules/pimatic-unipi-evok/unipi-update-manager.coffee:166:18
   at tryCatcher (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/util.js:16:23)
   at Promise._settlePromiseFromHandler (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:512:31)
   at Promise._settlePromise (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:569:18)
   at Promise._settlePromise0 (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:614:10)
   at Promise._settlePromises (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:690:18)
   at _drainQueueStep (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/async.js:138:12)
   at _drainQueue (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/async.js:131:9)
   at Async._drainQueues (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/async.js:147:5)
   at Immediate.Async.drainQueues [as _onImmediate] (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/async.js:17:14)
   at runCallback (timers.js:705:18)
   at tryOnImmediate (timers.js:676:5)
   at processImmediate (timers.js:658:5)
   at process.topLevelDomainCallback (domain.js:120:23)
00:44:30error [pimatic-unipi-evok]: [UniPiUpdateManager] Error: unable to get status for all devices, exception caught: Error: getaddrinfo ENOTFOUND 82rest 82rest:80

"The local ip in plugin configuration was missing the htt://"
https://forum.pimatic.org/topic/4509/node-v8-plugin-compatibility/15

Updating values from unipi doesn't work

Evok sending updates as array. Sometimes one dimensional / sometimes multidimensional.

Response example for input update:
20:04:45.469 [pimatic-unipi-evok] [UniPiUpdateManager] received update: [{"counter_modes": ["Enabled", "Disabled"], "glob_dev_id": 2, "modes": ["Simple", "DirectSwitch"], "value": 0, "circuit": "UART_3_2_01", "debounce": 50, "counter": 15, "counter_mode": "Enabled", "dev": "input", "mode": "Simple"}, {"circuit": "UART_3_2_01", "value": 0, "glob_dev_id": 2, "dev": "wd", "timeout": 5000, "was_wd_reset": 0, "nv_save": 0}]

Pimatic stops without network

Hi!

I have a strange issue. I have a Unipi Neuron device installed EVOK2.0 and Pimatic on it. Raspberry is set to fix IP, plugin installed on Pimatic. I connect to it directly with a windows computer, everything works fine, until I disconnect the computer. EVOK keeps working (inputs trigger outputs), but Pimatic rules stop working. I think it is some network related setting, but could not figure it out so far... Thank you for the help in advance...

Cannot load device list

Raspbian Jessie with EVOK v2.0 on Neuron 103.

Crashing with this error:

[UniPiUpdateManager] Error: unable to get device status, exception caught: SyntaxError: Unexpected token o 18:59:56.813 [pimatic-unipi-evok] Error 18:59:56.813 [pimatic-unipi-evok]> at Object.members.stack (/home/pi/pimatic-app/node_modules/pimatic-unipi-evok/node_modules/pimatic-plugin-commons/lib/index.js:250:100) 18:59:56.813 [pimatic-unipi-evok]> at Object.members.rejectWithErrorString (/home/pi/pimatic-app/node_modules/pimatic-unipi-evok/node_modules/pimatic-plugin-commons/lib/index.js:155:21) 18:59:56.813 [pimatic-unipi-evok]> at /home/pi/pimatic-app/node_modules/pimatic-unipi-evok/unipi-update-manager.coffee:155:20 18:59:56.813 [pimatic-unipi-evok]> at tryCatcher (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/util.js:16:23) 18:59:56.813 [pimatic-unipi-evok]> at Promise._settlePromiseFromHandler (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:512:31) 18:59:56.813 [pimatic-unipi-evok]> at Promise._settlePromise (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:569:18) 18:59:56.813 [pimatic-unipi-evok]> at Promise._settlePromise0 (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:614:10) 18:59:56.813 [pimatic-unipi-evok]> at Promise._settlePromises (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:689:18) 18:59:56.813 [pimatic-unipi-evok]> at Async._drainQueue (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/async.js:133:16) 18:59:56.813 [pimatic-unipi-evok]> at Async._drainQueues (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/async.js:143:10) 18:59:56.813 [pimatic-unipi-evok]> at Immediate.Async.drainQueues [as _onImmediate] (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/async.js:17:14) 18:59:56.813 [pimatic-unipi-evok]> at processImmediate [as _immediateCallback] (timers.js:383:17) 18:59:56.823 [pimatic-unipi-evok] [UniPiUpdateManager] Error: unable to get device status, exception caught: SyntaxError: Unexpected token o

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.