标签: hassio

  • armbian更新后auditd提示错误解决方法

    armbian更新后auditd提示错误解决方法

    Aug 23 05:35:52 raspberrypi systemd[1]: Starting Security Auditing Service…
    Aug 23 05:35:52 raspberrypi auditd[3146]: Error – audit support not in kernel
    Aug 23 05:35:52 raspberrypi systemd[1]: auditd.service: Control process exited, code=exited, status=1/FAILURE
    Aug 23 05:35:52 raspberrypi auditd[3146]: Cannot open netlink audit socket
    Aug 23 05:35:52 raspberrypi systemd[1]: auditd.service: Failed with result ‘exit-code’.
    Aug 23 05:35:52 raspberrypi auditd[3146]: The audit daemon is exiting.
    Aug 23 05:35:52 raspberrypi auditd[3145]: Cannot daemonize (Success)
    Aug 23 05:35:52 raspberrypi systemd[1]: Failed to start Security Auditing Service.
    Aug 23 05:35:52 raspberrypi auditd[3145]: The audit daemon is exiting.
    dpkg: error processing package auditd (–configure):
    installed auditd package post-installation script subprocess returned error exit status 1
    Errors were encountered while processing:
    auditd
    E: Sub-process /usr/bin/dpkg returned an error code (1)

     

    这样解决了

    cd /var/lib/dpkg/
    sudo mv info/ info_bak # 现将info文件夹更名
    sudo mkdir info # 再新建一个新的info文件夹
    sudo apt-get update # 更新
    sudo apt-get -f install # 修复
    sudo mv info/* info_bak/ # 执行完上一步操作后会在新的info文件夹下生成一些文件,现将这些文件全部移到info_bak文件夹下
    sudo rm -rf info # 把自己新建的info文件夹删掉
    sudo mv info_bak info # 把以前的info文件夹重新改回名

    [start-plane type=”1″]原文地址:armbian更新后auditd提示错误解决方法[/start-plane]

  • Hassio添加Home Assistant Community Add-ons

    Hassio升级了几次,偶然发现原来的supervisor里的Node-Red变成了灰色且无法通过WEBUI升级,而且只显示Official add-ons

    然后google一下找到了,添加Home Assistant Community Add-ons的办法

    在supervisor-加载商店-仓库(Repo)(WEB界面右上角三点 . )

    添加:https://github.com/hassio-addons/repository

     

    参考:https://community.home-assistant.io/t/cant-install-node-red/226245/15

  • homeassistant设备原生接入homekit

    刚开始接触homeassistant,使用的是qnap的T228设备,该设备不知为啥一直无法使用了官方的docker的homeassitant镜像,后来没办法找了一个能跑Ubuntu的镜像,自己安装python3.6,并安装homeassistant,版本105。在网上大量充斥着需要homebridge的方法,其实原生支持也挺好用的

    ,原生支持 sensor,switch,water_heater,lock,fan,binary_sensor等组件。


    只需要在配置文件configuration.yaml 中加入一句话

    homekit:

    重启homeassistant就能在通知栏发现配对码。在ios设备的家庭中添加该桥就行

    注意:homekit: 冒号后面有个空格

    可能存在的问题:

    • 必须安装 libavahi-compat-libdnssd-dev  包,命令如下
    apt-get install libavahi-compat-libdnssd-dev
    • 无法发现相关实体

      查看相关支持列表,支持组件相对还是较少,类型不对推送不到homekit中

  • Docker – 通过容器安装部署Mosquitto服务教程(MQTT服务器)

    1,MQTT 介绍

        MQTT 是一个基于客户端-服务器的消息发布/订阅传输协议。MQTT 协议是轻量、简单、开放和易于实现的,这些特点使它适用范围非常广泛:
    • 在很多情况下,包括受限的环境中,如:机器与机器(M2M)通信和物联网(IoT)。
    • 其在,通过卫星链路通信传感器、偶尔拨号的医疗设备、智能家居、及一些小型化设备中已广泛使用。

    2,Mosquitto 介绍

        Mosquitto 是一款实现了消息推送协议 MQTT v3.1 的开源消息代理软件,提供轻量级的,支持可发布/可订阅的的消息推送模式,使设备对设备之间的短消息通信变得简单,比如现在应用广泛的低功耗传感器,手机、嵌入式计算机、微型控制器等移动设备。

    3,安装步骤

    (1)首先执行如下命令将镜像下载到本地:
    1
    docker pull eclipse-mosquitto

    (2)接着执行如下命令创建目录:

    1
    2
    3
    mkdir -p /mosquitto/config
    mkdir -p /mosquitto/data
    mkdir -p /mosquitto/log

    (3)然后执行如下命令创建初始化配置文件:

    1
    vi /mosquitto/config/mosquitto.conf

    #此处是个坑,一定要先运行此步,否则 docker run创建的是一个 mosquitto.conf 文件夹
    (4)在配置文件中添加如下内容,然后保存退出。

    1
    2
    3
    persistence true
    persistence_location /mosquitto/data
    log_dest file /mosquitto/log/mosquitto.log

    (5)接着执行如下命令为目录授权(其中日志目录要最大权限):

    1
    2
    chmod -R 755 /mosquitto
    chmod -R 777 /mosquitto/log

    (6)最后执行如下命令即可启动 mosquitto 容器:

    1
    2
    3
    4
    5
    6
    docker run -d --name=mosquitto --privileged \
    -p 1883:1883 -p 9001:9001 \
    -v /mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf \
    -v /mosquitto/data:/mosquitto/data \
    -v /mosquitto/log:/mosquitto/log \
    eclipse-mosquitto

     

    4,连接测试

        mosquitto 服务启动后,我们可以使用 MQTTBox 这个客户端工具测试消息的发布和订阅,具体用法可以参考我之前写的文章:MQTT系列教程3(客户端工具MQTTBox的安装和使用)
    原文:Docker - 通过容器安装部署Mosquitto服务教程(MQTT服务器)

     

    附:配置权限

    (1)有时为了安全我们希望连接 mosquitto 服务时需要用户名密码,首先修改配置文件(/mosquitto/config/mosquitto.conf),添加以下配置:
    1
    2
    3
    4
    # 关闭匿名模式
    allow_anonymous false
    # 指定密码文件
    password_file /mosquitto/config/pwfile.conf

    (2)接着执行如下命令进入容器:

    1
    docker exec -it mosquitto sh

    (3)执行如下命令建立 pwfile.conf 文件,并设置权限:

    1
    2
    touch /mosquitto/config/pwfile.conf
    chmod -R 755 /mosquitto/config/pwfile.conf

    (4)然后使用 mosquitto_passwd 命令创建用户(比如下面我们创建了一个名为 hangge 的用户,密码为 123),添加完毕后执行 exit 退出容器。

    1
    mosquitto_passwd -b /mosquitto/config/pwfile.conf hangge 123

    (5)最后执行如下命令启动容器,这样就为 mosquitto 服务增加了权限验证功能,需要使用我们前面创建的用户密码才能连接。

    1
    docker restart mosquitto

    原文出自:www.hangge.com  转载请保留原文链接:https://www.hangge.com/blog/cache/detail_2896.html