we are a group of students, developing a binding for the open erp tool “odoo”.
We want to automatically generate a bill for using a meeting room.
The hole scenario (as we plan to implement it) is following: someone is entering a meeting room, a sensor is changing the status of the room to occupied. After leaving the room, the status is set back to free. This is triggering an openhab event and the odoo-binding is called.
The odoo binding is then reading the meeting informationen (start and ending time, organisator, used items (light, etc.) which are currently saved in an item.
The information are passed on to the odoo web-service, from where the data is read into odoo and the bill can be created.
We have the first and the last part developed.
Now we struggle with adressing the binding. Is triggering the binding via an event the right way? And how do we implement it correctly?
For testing we have developed a Binding skeleton and integrated the part where we call the odoo webservice.
Thank you very much for your advice!
My suggestions for how to go about doing this depend on what your “sensors” are and what information they can collect.
I think you need to expand (or maybe go away and think about it if you haven’t) how you plan to collect start time (should be easy via the “event” trigger), end time (again should be easy by triggering and event), organiser, used items etc so that we (or at least I) can help more.
This sounds to me more like an action than a binding.
The binding would be responsible for the sensor (and presumably already exists? Lightwave/zwave etc).
The odoo part is then an action (like twitter is) which you can call from a rule.
The rule can assemble all the info from the sensors/event bus and pass that to the odoo action call.
@danielwalters86 and @richbeales thanks for your answers!
We connect a calendar via caldav-binding.
The sensor is a motion sensor and changes from off to on, when someone enters the room.
The change is logged in a database.
With the calendar event (start and ending time) information, we query the database for all items logged between the period of the meeting (e.g. the actual start and ending time).
These information shall be passed on to odoo (via a binding?) where the bill can be created.
We suspect our professor really wants us to do the odoo-binding, so how would we adress the binding?
And what are the differences between a binding and an action? We just figured out that an action is usually used for tools and can be addressed via rules (and is way easier to implement than a binding).
A binding provides a way to represent a sensor or actuator as an Item in your openHAB configuration. It usually provides a connection to some sort of IoT device (e.g. Nest) or network (e.g. zwave) and handles the communication between those and openHAB. An Item is something that has a state (ON/OFF, OPEN/CLOSED, number, date time, text, etc).
An action is something you can cause to happen in a rule. Unlike Items, Actions do not have a state. They are entirely outward facing. They cause something to happen or send a message but do not wait around for data coming in. For example, the
say("Some text") action causes the server to say “Some text” using text to speech. As another example, the PushBullet action will cause a message to be sent to a PushBullet client.
From what I can gather, I agree with @richbeales. Odoo sounds more like it should be an action that gets called from a rule. Whatever event that takes place to trigger when the bill should trigger a rule which then passes the appropriate information to odoo through a call to the odoo action.