I got one of these from Kickstarter and it finally arrived recently. While I was waiting for it, I noticed in there “Maker” community forums that new cards could be created with MQTT. (https://getoboo.com/community/topic/creating-your-own-card/)
The software on the device is far from full baked and has a lot of issues. Send a mal-formed mqtt command and it will crash the “card-manager” for example. I’ve also not yet figured out a way to automatically start the HomeAssistant Card after a crash or after a reboot, this has to be done manually by triggering an script in HA to send the mqtt command to set up the card.
The first step to get this working is to bridge the MQTT broker running on the Oboo to your HA MQTT broker. This lets all the mqtt traffic from the Oboo be available on your HA broker and allows your HA configured broker to publish messages that the Oboo can pick up.
I run hass.io and have this running on my test setup right now running on a pi. Using the Official Mosquito MQTT addon.
You can create an advanced config file that the addon will read under:
/share/mosquito
Create a new file called “bridge.conf” or similar.
in the file enter the following details:
connection oboo
address 192.168.1.xxx (the Oboo ip address)
clientid some_name
try_private false
start_type automatic
topic # both
this creates the connection between the 2 MQTT brokers. Restart the hassio mqtt broker and you should be good to go.
To add an HA logo to the card you have to convert the image and upload it to the oboo.
I used this png and the oboo online converter to create the bin. https://getoboo.com/image-converter/
you have to upload this the the oboo filesystem. (to get access use the scripts here to enable ssh: https://github.com/ouellettetech/oboo)
add to
/usr/bin/img
next up create a new script for HA which will publish the mqtt command to create a basic card on the oboo with some entries to later fill in with values from HA:
'oboo_create_card':
alias: Create Oboo HA Card
sequence:
- service: mqtt.publish
data_template:
topic: "/card"
payload: >
{% set createcard = {"cmd":"new_card","bg_color":0,"responseTopic":"/homeassistant_card_240226371106","elements":[{"id":0,"type":"image","value":"/usr/bin/img/img_ha_logo.bin","position":{"x":10,"y":5}},{"id":3,"type":"text","value":"--","position":{"x":75,"y":5,"align":"Left"},"size":23},{"id":4,"type":"text","value":"--","position":{"x":75,"y":30,"align":"Left"},"size":23},{"id":1,"type":"text","value":"--","position":{"x":10,"y":65,"align":"Left"},"size":23},{"id":2,"type":"text","value":"--","position":{"x":10,"y":90,"align":"Left"},"size":23}]} %}
{{ createcard | tojson }}
This creates a “shell” of a card like below on the oboo. the “–” are place holders for text that HA will eventually send.
So let’s send some data now. first up is the top 2 “–” lines in my example these are for the Day of the week and the date.
For this I’m using the time_date sensor in ha with some templates to format the date values:
sensor:
- platform: time_date
display_options:
- 'time'
- 'date'
- platform: template
sensors:
date_long:
friendly_name: 'Date Month Long'
entity_id: sensor.date
value_template: >
{% set months = ["January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] %}
{% set month = months[now().strftime('%m') | int -1] %}
{{ month + ' ' + now().strftime('%d') }}
day_long:
friendly_name: 'Date Day Long'
entity_id: sensor.date
value_template: >
{% set days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] %}
{{ days[now().weekday()] }}
Now we can create a script to update the date on the oboo:
'update_oboo_date':
alias: Update oboo date
sequence:
- service: mqtt.publish
data_template:
topic: "/card"
payload: >
{% set updatedate = {"cmd":"update_card","id":5,"elements":[{"id":3,"value": states.sensor.day_long.state },{"id":4,"value": states.sensor.date_long.state }]} %}
{{ updatedate | tojson }}
trigger the script and:
Now an automation to update the date each day:
- id: 'update_oboo_date'
alias: oboo date
trigger:
- event_data:
entity_id: sensor.date_long
event_type: state_changed
platform: event
condition: []
action:
- data: {}
service: script.update_oboo_date
let’s send some sensor data now. It’s the same principle you just map the element id to the value.
new script:
'oboo_send_temperature':
alias: Oboo Send Temperature
sequence:
- service: mqtt.publish
data_template:
topic: "/card"
payload: >
{% set sendtemp = {"cmd": "update_card","id": 5,"elements":[{"id": 1,"value": "Room Temperature " + states.sensor.bme280_temperature.state + " °F" }]} %}
{{ sendtemp | tojson }}
and automation to update:
- id: 'update_temp_on_oboo'
alias: oboo Temp
trigger:
- event_data:
entity_id: sensor.bme280_temperature
event_type: state_changed
platform: event
condition: []
action:
- data: {}
service: script.oboo_send_temperature
You can fill in the last id the same way with another sensor just some text based off a trigger event like I did in the twitter video for motion.
Another option is to use a notification:
(https://getoboo.com/community/topic/software-update-september-28-2018/)
Create 2 script squences to show and then clear the notification:
'oboo_motion_detected_notifcation':
alias: Oboo Notification Motion On
sequence:
- service: mqtt.publish
data_template:
topic: "/notification"
payload: >
{% set notification = {"cmd":"set","text":"MOTION DETECTED","size":30} %}
{{ notification | tojson }}
'oboo_clear_notifcation':
alias: Clear Oboo Notification
sequence:
- service: mqtt.publish
data_template:
topic: "/notification"
payload: >
{% set clear = {"cmd":"clear"} %}
{{ clear | tojson }}
And automations to trigger them:
- id: '1556137514709'
alias: oboo motion notification
trigger:
- entity_id: binary_sensor.pir_sensor
from: 'off'
platform: state
to: 'on'
condition: []
action:
- service: script.oboo_motion_detected_notifcation
- id: '1556137576453'
alias: oboo motion notification clear
trigger:
- entity_id: binary_sensor.pir_sensor
from: 'on'
platform: state
to: 'off'
condition: []
action:
- service: script.oboo_clear_notifcation
And that is the basics with some examples so I hope this can help someone.
I ended up using scripts versus publishing the commands directly from he automation because I was able to get it to work a bit smoother. I’m guessing someone could format these correctly to just do via automation but as you know there are multiple ways to do everything!
I’m hoping to figure out a way to detect a fresh boot of the oboo or a crash of the card monitor to trigger HA to set up the ha card. but have not done that yet. If the automations to update the card are running after a crash or reboot they will crash the card manager as there is not matching card for the data.