diff --git a/atom.xml b/atom.xml index 1de806261e..e93403624f 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@
All add-ons are based on Alpine Linux 3.5. Hass.io will automatically substitute the right base image based on the machine architecture.
+All add-ons are based on Alpine Linux 3.5. Hass.io will automatically substitute the right base image based on the machine architecture. Add tzdata
if you need run in correct timezone.
FROM %%BASE_IMAGE%%
ENV LANG C.UTF-8
diff --git a/hassio/run_local/index.html b/hassio/run_local/index.html
index b1d81522bd..1dc372ebb5 100644
--- a/hassio/run_local/index.html
+++ b/hassio/run_local/index.html
@@ -68,12 +68,41 @@
On a normal installation you have access to base machine and can install or add every things of script they you can call with a command_line
sensor/switch. Since Hass.IO use docker and every application is strict limited to other, you can not use this old way to perform local stuff. For first view it look very limited but if you look better to that conecpt you will see that make all very stable and a wrong thing can not break your system. It will also warrenty that your system is in every time clear to eatch running thing.
-If you need run a script to read data for a sensor or switch commands to other device, you can do that with a add-on or on HomeAssistant container with a custom component. We look now to do that in a modern way inside a add-on. For custom component you can look into [custom-component][devoloper site].
-Before you read more on that page, please read the [addons-turtorial][add-ons turtorial]. Now you can resize your horizen to new way to do things safe.
-First you need install a MQTT broker. You can use our [mqtt-addon][mqtt broker add-on]. Make sure you use logins and disable anonymos access if you want control sensible systems. We provide no Hass.IO way to exchange data, that will be not realy good for security and is also to slow to exchange data between containers or stop and go stuff.
+If you need run a script to read data for a sensor or switch commands to other device, you can do that with a add-on or on HomeAssistant container with a custom component. We look now to do that in a modern way inside a add-on. For custom component you can look into devoloper site.
+Before you read more on that page, please read the add-ons turtorial. Now you can resize your horizen to new way to do things safe.
+First you need install a MQTT broker. You can use our mqtt broker add-on. Make sure you use logins and disable anonymos access if you want control sensible systems. We provide no Hass.IO way to exchange data, that will be not realy good for security and is also to slow to exchange data between containers or stop and go stuff.
Sensors
Short story of that caption: We loop in our script to fetch data push to mqtt and wait until next processing is ready. Here is a basic example and struct for that process.
-
+Our Dockerfile need to install:
+RUN apk --no-cache add tzdata jq mosquitto-clients
+
+
+Now we can process it with run.sh
:
+#!/bin/bash
+set -e
+
+CONFIG_PATH=/data/options.json
+
+# possible options for processing
+MQTT_SERVER=$(jq --raw-output '.server' $CONFIG_PATH)
+MQTT_PORT=$(jq --raw-output '.port' $CONFIG_PATH)
+TOPIC=$(jq --raw-output '.topic' $CONFIG_PATH)
+USER=$(jq --raw-output '.user' $CONFIG_PATH)
+PASSWORD=$(jq --raw-output '.password' $CONFIG_PATH)
+WAIT_TIME=$(jq --raw-output '.seconds' $CONFIG_PATH)
+
+# read data
+while true
+do
+ if OUTPUT="$(/read_my_sensor.sh)"
+ then
+ mosquitto_pub -h "$MQTT_SERVER" -p "$MQTT_PORT" -t "$TOPIC" -m "$OUTPUT" || true
+ else
+ echo "$(data) [ERROR] can't read sensor: $OUTPUT"
+ fi
+
+ sleep "$WAIT_TIME"
+done
Commands
diff --git a/sitemap.xml b/sitemap.xml
index b5802b481c..fb4af170f9 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -3460,62 +3460,62 @@
https://home-assistant.io/demo/frontend.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/demo/index.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/demo/panels/ha-panel-dev-event.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/demo/panels/ha-panel-dev-info.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/demo/panels/ha-panel-dev-service.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/demo/panels/ha-panel-dev-state.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/demo/panels/ha-panel-dev-template.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/demo/panels/ha-panel-history.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/demo/panels/ha-panel-iframe.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/demo/panels/ha-panel-logbook.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/demo/panels/ha-panel-map.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/googlef4f3693c209fe788.html
-2017-05-24T14:06:31+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/static/fonts/roboto/DESCRIPTION.en_us.html
-2017-05-24T14:06:32+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/static/fonts/robotomono/DESCRIPTION.en_us.html
-2017-05-24T14:06:32+00:00
+2017-05-24T14:27:20+00:00
https://home-assistant.io/static/mdi-demo.html
-2017-05-24T14:06:32+00:00
+2017-05-24T14:27:20+00:00