magcode / mpower-tools Goto Github PK
View Code? Open in Web Editor NEWTools for operating Ubiquiti Networks mPower devices
License: Apache License 2.0
Tools for operating Ubiquiti Networks mPower devices
License: Apache License 2.0
Good day,
could I ask you for advice? I am trying to install MQTT server, unfortunately with the following error:
Thank you for your help.
MF.v2.1.11# sh install-client.sh
Installing mPower MQTT v2 ...
/libmosquitto.so.1: Read-only file system
/mosquitto_pub: Read-only file system
/mosquitto_sub: Read-only file system
mkdir: cannot create directory '/client': Read-only file system
find: /client: No such file or directory
/client/mqrun.sh: No such file or directory
/client/mqpub-static.sh: No such file or directory
/client/mqpub.sh: No such file or directory
/client/mqsub.sh: No such file or directory
/client/mqstop.sh: No such file or directory
/client/mpower-pub.cfg: No such file or directory
/client/mqtt.cfg: No such file or directory
/client/led.cfg: No such file or directory
chmod: /mosquitto_pub: No such file or directory
chmod: /mosquitto_sub: No such file or directory
chmod: /client/mqrun.sh: No such file or directory
chmod: /client/mqpub-static.sh: No such file or directory
chmod: /client/mqpub.sh: No such file or directory
chmod: /client/mqsub.sh: No such file or directory
chmod: /client/mqstop.sh: No such file or directory
Found /etc/persistent/rc.poststart entry. File will not be changed
Done!
Please configure mqtt.cfg
Please configure mpower-pub.cfg
Please configure led.cfg
run 'save' command if done.
Tried installing as per direction, getting a file not found error on running mqrun.sh that mqpub.sh and mqsub.sh do not exist (they do exist). When examining the files in vi, both contain windows based ^M line breaks (as well as mqpub-static.sh) that is preventing them from running.
Hi!
I am trying to install this MQTT addon to my mPower device, but when I start install-client.sh, all the files are empty....
Any advice?
Thank you!
Hi, i noticed within the Mosquitto log that the mPower devices are frequently reconnecting to my MQTT Broker Mosquitto. I have a few devices speaking with my broker but only the mPower show that behavior.
1546212156: New client connected from 192.168.11.7 as mosqpub|23132-Wz-Ubnt-M (c1, k60, u'dirk'). 1546212156: Client mosqpub|23132-Wz-Ubnt-M disconnected. 1546212156: New connection from 192.168.11.7 on port 1883. 1546212156: New client connected from 192.168.11.7 as mosqpub|23137-Wz-Ubnt-M (c1, k60, u'dirk'). 1546212156: Client mosqpub|23137-Wz-Ubnt-M disconnected. 1546212156: New connection from 192.168.11.7 on port 1883. 1546212156: New client connected from 192.168.11.7 as mosqpub|23141-Wz-Ubnt-M (c1, k60, u'dirk'). 1546212156: Client mosqpub|23141-Wz-Ubnt-M disconnected. 1546212156: New connection from 192.168.11.7 on port 1883. 1546212156: New client connected from 192.168.11.7 as mosqpub|23145-Wz-Ubnt-M (c1, k60, u'dirk'). 1546212156: Client mosqpub|23145-Wz-Ubnt-M disconnected. 1546212156: New connection from 192.168.11.7 on port 1883. 1546212156: New client connected from 192.168.11.7 as mosqpub|23149-Wz-Ubnt-M (c1, k60, u'dirk'). 1546212156: Client mosqpub|23149-Wz-Ubnt-M disconnected. 1546212156: New connection from 192.168.11.7 on port 1883. 1546212156: New client connected from 192.168.11.7 as mosqpub|23152-Wz-Ubnt-M (c1, k60, u'dirk'). 1546212156: Client mosqpub|23152-Wz-Ubnt-M disconnected. 1546212156: New connection from 192.168.11.7 on port 1883. 1546212156: New client connected from 192.168.11.7 as mosqpub|23155-Wz-Ubnt-M (c1, k60, u'dirk'). 1546212156: Client mosqpub|23155-Wz-Ubnt-M disconnected. 1546212156: New connection from 192.168.11.7 on port 1883. 1546212156: New client connected from 192.168.11.7 as mosqpub|23158-Wz-Ubnt-M (c1, k60, u'dirk'). 1546212156: Client mosqpub|23158-Wz-Ubnt-M disconnected. 1546212156: New connection from 192.168.11.7 on port 1883. 1546212156: New client connected from 192.168.11.7 as mosqpub|23160-Wz-Ubnt-M (c1, k60, u'dirk'). 1546212156: Client mosqpub|23160-Wz-Ubnt-M disconnected. 1546212156: New connection from 192.168.11.7 on port 1883. 1546212156: New client connected from 192.168.11.7 as mosqpub|23162-Wz-Ubnt-M (c1, k60, u'dirk'). 1546212157: Client mosqpub|23162-Wz-Ubnt-M disconnected.
I'm just using MQTT in the mPower a few days but the log of Mosquitto is already 20M big and growing frequently:
-rw------- 1 107 111 20M Dez 31 00:21 mosquitto.log.1
I openend a new topic to better explain my problem.
I haven't given you all the information on my real problems and I'm sorry.
For instance:
What is the command to have output on your guide?
homie/mpower-1/port1/relay=0
homie/mpower-1/port2/relay=1
homie/mpower-1/port3/relay=0
homie/mpower-1/port1/power=0.0
homie/mpower-1/port2/power=7.2
homie/mpower-1/port3/power=0.0
homie/mpower-1/port1/energy=0
homie/mpower-1/port2/energy=4
homie/mpower-1/port3/energy=8
homie/mpower-1/port1/voltage=0.0
homie/mpower-1/port2/voltage=234.9
homie/mpower-1/port3/voltage=0.0
And this below:
homie/mpower-1/$homie=2.1.0
homie/mpower-1/$name=mpower-1
homie/mpower-1/$fw/version=MF.v2.1.11-mq-0.2
homie/mpower-1/$fw/name=mPower=MQTT
homie/mpower-1/$localip=192.168.1.26
homie/mpower-1/$nodes=port1,port2,port3
homie/mpower-1/$stats/uptime=2589629.67
homie/mpower-1/port1/relay/$settable=true
homie/mpower-1/port2/relay/$settable=true
homie/mpower-1/port3/relay/$settable=true
homie/mpower-1/port1/lock/$settable=true
homie/mpower-1/port2/lock/$settable=true
homie/mpower-1/port3/lock/$settable=true
Control socket via MQTT
1 - You can control the sockets by sending 0 or 1 to the topic /port/relay/set
2 - You can lock the sockets by sending 0 or 1 to the topic /port/lock/set
Can you better explain these two point above? Also with referral links if you want
And then your last point in your guide:
Integration in openHAB
Where should I write this example of the script below?
Switch switchmp "My mpower switch" { mqtt=">[mosquitto:homie/mpower1/port1/relay/set:command:ON:1],>[mosquitto:homie/mpower1/port1/relay/set:command:OFF:0],<[mosquitto:homie/mpower1/port1/relay:state:MAP(mpowerrelay.map)]"}
Number energymp "Energy consumption [%d Wh]" { mqtt="<[mosquitto:homie/mpower1/port1/energy:state:default]" }
Number powermp "Current power [%.1f W]" { mqtt="<[mosquitto:homie/mpower1/port1/power:state:default]" }
I have installed openhab 2.5.4 on Ubuntu 18.04 server and I created mqtt binding and mqtt broker by web browser but i 'm not able to get openhab to communicate with mpower pro.
What are my issue?
As the title suggests, it is impossible to copy the repository correctly. To partially work around this problem, you need to manually copy and paste the files.
The real problem arises when I have to copy the following files: libmosquitto.so.1, mosquitto_pub, mosquitto_sub
These being system files must necessarily be cloned as they cannot be copied and pasted as they are registry and system files.
How can I solve the problem?
Thank you
I stumbled on another one that helped me get connected into my mPower mini after I hadn't touched it for quite a while and forgot the alternate key exchange and cipher gotchas.
https://github.com/malensek/mpower
I ended up forking it to add in the reset-smart-bulb.sh script that I use to fix individual smart bulbs that fall out of the mesh using a desk lamp + mPower mini so that I don't have to mess with re-adding 3-4 in a ceiling fan at once, just the misbehaving one.
Working like a charm at home, thank you !
Is it planned to add the possibility to fill in user/password to publish, and especially to receive an order from the MQTT broker?
Firstly, thanks for this. top rate
Have been testing with home-assistant and mosquitto on a hass.io platform. Everything works great except if doesn't get the number of ports right on my mPowerPro P8U.
For know I have hard-coded the PORTS value in the mqrun script and it sems to work
Here is the board.inc
$board_id="0xe648";
$board_name="mPower Pro";
$board_raw_name="mPower Pro";
$board_shortname="P8U";
$board_subtype="";
$board_hwaddr="F09FC246AAEE";
$reboot_time=30;
$upgrade_time=150;
$radio_count=1;
$radio1_name="";
$radio1_shortname="";
$radio1_bus="ahb";
$radio1_ccode=840;
$radio1_ccode_locked=0;
$radio1_subsystemid="0xe648";
$radio1_subvendorid="0x0777";
$radio1_txpower_max=23;
$radio1_txpower_offset=5;
$radio1_low_txpower_atten=0;
$radio1_low_txpower_limit=0;
$radio1_ieee_modes=10;
$radio1_ieee_mode="11nght";
$radio1_ant_count=1;
$radio1_def_antenna=4;
$radio1_ant_id[0]=4;
$radio1_ant_name[0]=dict_translate("Combined");
$radio1_ant_gain[0]=0;
$radio1_ant_builtin[0]=1;
$radio1_caps=16404;
$radio1_distance_limit_km=0;
$radio1_chains=2;
$radio1_ieee_mode_bg=1;
$radio1_low_txpower_mode=0;
$radio1_legacy=0;
$radio_outdoor=0;
$feature_advanced_ethernet=1;
$feature_poe_passthrough=0;
$feature_advanced_ethernet_phy=1;
$feature_rssi_leds=0;
$feature_power=1;
Not much use except for the shortname
perhaps the easiest solution would be do add something to the mpower-pub.cfg to override
Let me start by thanking you for the really great work. Your solution makes my mPower PRO integrate smoothly with my Home Assistant instance.
One thing I noticed is that instead on maintaining continuous connection to Mosquitto server, my mPower constantly connects and disconnects to the Mosquitto server every second. It reads commands and posts states as it should, but by connecting and disconnecting so frequently it floods my HA logs.
Is connecting and disconnecting the desired behaviour? Is there a way to make mPower maintain constant connection to the Mosquitto server?
HI,
if I follow the guide .. I don't get the files installed.
I pull only a empty install-client.sh file also Mosquitto_pup, etc are empty.
Can you please help me. Thanks
Just wanted to comment that i have the US version of the Mfi MPower 3 plug device.
Running firmware MF.v2.1.11
Works as described.
If it indeed is making wifi more stable it's well worth the install.
Thanks
Hi any idea what's going wrong here ?
Ran install script , edited defaults,... and when i try to save and reboot:
MF.v2.1.11# save
Found Active on[1] ...
Found Backup1 on[2] ...
Bus error
MF.v2.1.11#
Anything to debug this ?
Hi magcode
I was following your github guide. My first problem was your script that not worked for me. So copied and pasted manually every your single file in the folder:
mqtt/client
save
reboot
After that i started mqtt with this below command:
/var/etc/persistent/mqtt/client/mqrun.sh
this output gives me back:
MF.v2.1.11# /var/etc/persistent/mqtt/client/mqrun.sh
mqtt: killing old instances
killall: mqsub.sh: no process killed
mqtt: Using temp file /tmp/mqtmp.XXXX33WiDi
mqtt: starting pub and sub scripts
MF.v2.1.11# mqtt: Found 6 ports.
mqtt: MQTT listening...
mqtt: Publishing to 10.1.10.1 with topic homie/mFi-bedroom
in the file "/var/etc/persistent/mqtt/client/mqtt.cfg" i set the following string:
mqtthost=10.1.10.10
with the ip of my mpower device itself
Now, if i do well until here ,I'm definitely blocked after this command below:
MF.v2.1.11# tail -f /var/log/messages
Jan 1 14:23:34 mFi-bedroom user.err syslog: ace_reporter.reporter_fail(): initial contact failed #3, url=http://mfi:6080/inform, rc=3
Jan 1 14:24:04 mFi-bedroom user.debug syslog: ace_reporter.reporter_timedout(): Connect(http://mfi:6080/inform) has timed out
Jan 1 14:24:04 mFi-bedroom user.err syslog: ace_reporter.reporter_fail(): server unreachable
Jan 1 14:24:04 mFi-bedroom user.err syslog: ace_reporter.reporter_fail(): initial contact failed #4, url=http://mfi:6080/inform, rc=3
Jan 1 14:24:34 mFi-bedroom user.debug syslog: ace_reporter.reporter_timedout(): Connect(http://mfi:6080/inform) has timed out
Jan 1 14:24:34 mFi-bedroom user.err syslog: ace_reporter.reporter_fail(): server unreachable
Jan 1 14:24:34 mFi-bedroom user.err syslog: ace_reporter.reporter_fail(): initial contact failed #5, url=http://mfi:6080/inform, rc=3
Jan 1 14:25:04 mFi-bedroom user.debug syslog: ace_reporter.reporter_timedout(): Connect(http://mfi:6080/inform) has timed out
Jan 1 14:25:04 mFi-bedroom user.err syslog: ace_reporter.reporter_fail(): server unreachable
Jan 1 14:25:04 mFi-bedroom user.err syslog: ace_reporter.reporter_fail(): initial contact failed #6, url=http://mfi:6080/inform, rc=3
Jan 1 14:25:34 mFi-bedroom user.debug syslog: ace_reporter.reporter_timedout(): Connect(http://mfi:6080/inform) has timed out
Jan 1 14:25:34 mFi-bedroom user.err syslog: ace_reporter.reporter_fail(): server unreachable
Jan 1 14:25:34 mFi-bedroom user.err syslog: ace_reporter.reporter_fail(): initial contact failed #7, url=http://mfi:6080/inform, rc=3
Where am i doing wrong?
Thanks for your eventual help
spyrito79
Hi,
are the Thermostat script working on mPort ? With the mFi THS one or any other module connected to the mPort ?
I try use and mosquito_sub don't detect any comming from mPort, mPower outlets working fine, just all my mPorts not working in mqtt.
Any solution to this ?
Regards,
Luis
first thanks for the great work.
I faced a problem while executing save command. It doesn't write but throw errors like 'bus error' or 'segmentation fault'. The solution was to cleanup the /var/etc/persistent/data directory which seems to contain too much statistical data.
Hi, first of all it is working very easy! Thanks for your great work!
I have 2 devices mPower Mini and 3 Port Outlet.
With the Mini i have all subs as expected, voltage, power, energy everything is fine.
But with the 3 Port mPower i don't have any energy value it is always 0 for all ports.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.