Ok, dann kann ich das aus den Items wieder entfernen.
Dann passt die Doku.
Dann passt die Doku.
curl --anyauth -u "<USER>":"<PASSWORD>" "https://fritz.box:49443/upnp/control/hosts" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:dslforum-org:service:Hosts:1#GetSpecificHostEntry" -d "<?xml version='1.0' encoding='utf-8'?><s:Envelope s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'><s:Body><u:GetSpecificHostEntry xmlns:u='urn:dslforum-org:service:Hosts:1'><s:NewMACAddress>XX:XX:XX:XX:XX:XX</s:NewMACAddress></u:GetSpecificHostEntry></s:Body></s:Envelope>" -s -k
[[[fritzbox_7490]]] [[[[iPad]]]] mac = xx:xx:xx:xx:xx:xx avm_data_type@fritzbox_7490 = network_device type = bool visu_acl = ro [[[[[ip]]]]] # these items need to be child items from network_device, an @... must not be set type = str avm_data_type = device_ip visu_acl = ro [[[[[connection_type]]]]] # these items need to be child items from network_device, an @... must not be set type = str avm_data_type = device_connection_type visu_acl = ro [[[[[hostname]]]]] # these items need to be child items from network_device, an @... must not be set type = str avm_data_type = device_hostname visu_acl = ro
def _update_host(self, item): """ Retrieves information related to a network_device represented by its MAC address, e.g. the status of the network_device can be used for simple presence detection | Uses: http://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/hostsSCPD.pdf | Also reference: https://blog.pregos.info/2015/11/07/anwesenheitserkennung-fuer-smarthome-mit-der-fritzbox-via-tr-064/ :param item: item to be updated (Supported item avm_data_types: network_device, child item avm_data_types: device_ip, device_connection_type, device_hostname) """ url = self._build_url("/upnp/control/hosts") headers = self._header.copy() if self.get_iattr_value(item.conf, 'avm_data_type') == 'network_device': if 'mac' not in item.conf: self.logger.error("No mac attribute provided in network_device item") return action = 'GetSpecificHostEntry' headers['SOAPACTION'] = "%s#%s" % (self._urn_map['Hosts'], action) soap_data = self._assemble_soap_data(action, self._urn_map['Hosts'], {'NewMACAddress': item.conf['mac']}) else: self.logger.error( "Attribute %s not supported by plugin method" % self.get_iattr_value(item.conf, 'avm_data_type')) return try: response = self._session.post(url, data=soap_data, timeout=self._timeout, headers=headers, auth=HTTPDigestAuth(self._fritz_device.get_user(), self._fritz_device.get_password()), verify=self._verify) self.logger.error(response.content) xml = minidom.parseString(response.content) except Exception as e: self.logger.error("Exception when sending POST request: %s" % str(e)) return tag_content = xml.getElementsByTagName('NewActive') if len(tag_content) > 0: item(tag_content[0].firstChild.data) for child in item.return_children(): if 'avm_data_type' in child.conf: if child.conf['avm_data_type'] == 'device_ip': device_ip = xml.getElementsByTagName('NewIPAddress') if len(device_ip) > 0: if not device_ip[0].firstChild is None: child(device_ip[0].firstChild.data) else: child('') else: self.logger.error( "Attribute %s not available on the FritzDevice" % self.get_iattr_value(item.conf, 'avm_data_type')) elif child.conf['avm_data_type'] == 'device_connection_type': device_connection_type = xml.getElementsByTagName('NewInterfaceType') if len(device_connection_type) > 0: if not device_connection_type[0].firstChild is None: child(device_connection_type[0].firstChild.data) else: child('') else: self.logger.error( "Attribute %s not available on the FritzDevice" % self.get_iattr_value(item.conf, 'avm_data_type')) elif child.conf['avm_data_type'] == 'device_hostname': data = self._get_value_from_xml_node(xml, 'NewHostName') if not data is None: child(data) else: self.logger.error( "Attribute %s not available on the FritzDevice" % self.get_iattr_value(item.conf, 'avm_data_type')) else: item(0) self.logger.debug( "MAC Address not available on the FritzDevice - ID: %s" % self._fritz_device.get_identifier())
fb1: class_name: AVM class_path: plugins.avm username: geheim # optional password: 'geheim' host: fritz.box port: 49443 cycle: 300 ssl: True # use https or not verify: False # verify ssl certificate call_monitor: 'True' call_monitor_incoming_filter: "... ## optional, don't set if you don't want to watch only one specific number with your call monitor" instance: fritzbox_7490
avm: uptime_7490: type: num visu_acl: ro avm_data_type@fritzbox_7490: uptime uptime_1750: type: num visu_acl: ro avm_data_type@wlan_repeater_1750: uptime serial_number_7490: type: str visu_acl: ro avm_data_type@fritzbox_7490: serial_number serial_number_1750: type: str visu_acl: ro avm_data_type@wlan_repeater_1750: serial_number firmware_7490: type: str visu_acl: ro avm_data_type@fritzbox_7490: software_version .....
{% extends "rooms.html" %} {% macro callmonitor_small(id, txt, gad_event, gad_last_caller, gad_last_call_date, gad_duration) %} {% block content %} <h1><img class="icon" src='{{ icon0 }}audio_audio.svg' />FritzBox</h1> <div class="block"> <div class="set-2" data-role="collapsible-set" data-theme="c" data-content-theme="a" data-mini="true"> <div data-role="collapsible" data-collapsed="false"> <h3>FritzBox</h3> {{ basic.symbol(id~'ring', gad_event, '', icon1~'phone_ring.png', 'ring') }} {{ basic.symbol(id~'call', gad_event, '', icon1~'phone_call_out.png', 'call') }} {{ basic.symbol(id~'connect', gad_event, '', icon1~'phone_call.png', 'connect') }} {{ basic.symbol(id~'disconnect', gad_event, '', 'icons/ws/phone_call_end.svg', 'disconnect') }} {{ basic.value(id~'phone_status.fritz.last_caller', gad_last_caller)}}, {{ basic.value(id~'phone_status.fritz.last_call_date', gad_last_call_date)}}<br/> Dauer: {{ basic.value(id~'gad_duration', gad_duration)}} Sekunden </div> </div> </div> {% endblock %} {% endmacro %}
8183.2018-01-23 21:44:36 INFO Main Loading '/usr/local/smarthome/plugins/avm/plugin.yaml' to 'OrderedDict' 8184.2018-01-23 21:44:36 WARNING Main YAML-file not found: /usr/local/smarthome/plugins/avm/plugin.yaml 8185.2018-01-23 21:44:36 INFO Main plugin 'avm': No metadata found 8186.2018-01-23 21:44:36 ERROR Main Plugin 'avm' from section 'fb1' exception: invalid syntax (<string>, line 1) 8187.Traceback (most recent call last): 8188. File "/usr/local/smarthome/lib/plugin.py", line 111, in __init__
5182.2018-01-24 11:34:50 ERROR plugins.avm_fritzbox_7490 Attribute uptime not available on the FritzDevice 5183.2018-01-24 11:34:50 ERROR plugins.avm_fritzbox_7490 Attribute serial_number not available on the FritzDevice 5184.2018-01-24 11:34:50 ERROR plugins.avm_fritzbox_7490 Attribute software_version not available on the FritzDevice 5185.2018-01-24 11:34:50 ERROR plugins.avm_fritzbox_7490 Attribute hardware_version not available on the FritzDevice 5186.2018-01-24 11:34:51 ERROR plugins.avm_fritzbox_7490 Attribute wan_upstream not available on the FritzDevice 5187.2018-01-24 11:34:51 ERROR plugins.avm_fritzbox_7490 Attribute wan_downstream not available on the FritzDevice 5188.2018-01-24 11:34:51 ERROR plugins.avm_fritzbox_7490 Attribute wan_total_packets_sent not available on the FritzDevice 5189.2018-01-24 11:34:51 ERROR plugins.avm_fritzbox_7490 Attribute wan_total_packets_received not available on the FritzDevice 5190.2018-01-24 11:34:52 ERROR plugins.avm_fritzbox_7490 Attribute wan_total_bytes_sent not available on the FritzDevice 5191.2018-01-24 11:34:52 ERROR plugins.avm_fritzbox_7490 Attribute wan_total_bytes_received not available on the FritzDevice 5192.2018-01-24 11:34:52 ERROR plugins.avm_fritzbox_7490 Attribute wan_link not available on the FritzDevice 5193.2018-01-24 11:34:54 ERROR plugins.avm_fritzbox_7490 Attribute wlan_guest_time_remaining not available on the FritzDevice 5194.2018-01-24 11:34:54 ERROR plugins.avm_fritzbox_7490 Attribute aha_device not available on the FritzDevice 5195.2018-01-24 11:34:55 ERROR plugins.avm_fritzbox_7490 Attribute aha_device not available on the FritzDevice
Wir verarbeiten personenbezogene Daten über die Nutzer unserer Website mithilfe von Cookies und anderen Technologien, um unsere Dienste bereitzustellen. Weitere Informationen findest Du in unserer Datenschutzerklärung.
Indem Du unten auf "ICH stimme zu" klickst, stimmst Du unserer Datenschutzerklärung und unseren persönlichen Datenverarbeitungs- und Cookie-Praktiken zu, wie darin beschrieben. Du erkennst außerdem an, dass dieses Forum möglicherweise außerhalb Deines Landes gehostet wird und bist damit einverstanden, dass Deine Daten in dem Land, in dem dieses Forum gehostet wird, gesammelt, gespeichert und verarbeitet werden.
Kommentar