Thanks - it was! I actually figured it out soon after I posted my previous, then was so busy dealing with the influx of tasty, tasty data that I forgot to come back and post that I’d solved it.
@TD22057 would love to see this work with python3. I’ve got your code running right now in a freebsd jail with an Eagle (first gen), but I run all my stuff in Kubernetes(docker) at the moment. Working on trying to port your code into a docker container based on alpine, having difficulty though (never wrote a docker container before). I’ll post here if I get it working, thanks for posting your code!
Here’s a start to the Dockerfile, if anyone is interested in taking a look/contributing. It works as is, you need to change configs for MQTT broker IP and port, of course, but I’ll add in variables for those shortly. Once it’s fully ready I’ll push to dockerhub.
This is great! I’m just getting comfortable with Docker containers and will try this out in the coming weeks. Thanks for making it much easier to consume and address this problem with the Eagle!
Thanks. I’m going to continue working on it, I’m pretty fresh when it comes to making my own docker containers, so if you want to contribute anything it would be appreciated!
I use a lot of dockers but have yet to venture into making them. I’ve made a tweak to your readme. I’ll see if I can play with this next week…
Thanks!
@evanrich I’m trying to run the container and am getting this error.
I tried last night to run the command to pull the image from the github page but I could nto get it to work. Any suggestions from anyone on the command to pull the image when it is not in Dockerhub?
@poldim - thanks. The documentation upgrades helped a bit. See my question above. Any thoughts? And thanks to whowever put in the instructions to make edits. That helps me a lot and i’ll try to contribute if I can offer edits!
Thanks!
Unable to find image 'evanrich/py-eagle-mqtt:latest' locally
docker: Error response from daemon: repository evanrich/py-eagle-mqtt not found: does not exist or no pull access.
See 'docker run --help'.
I haven’t posted it to docker hub yet, give me a moment and I will, was waiting till I had further tested it
Edit: I’m pushing it up right now, I’ll tag you @kozoke when it’s ready.
Edit2: @kozoke it’s ready https://hub.docker.com/r/evanrich/py-eagle-mqtt/tags/
Edit3: If there are no issues I’ll start working on trying to make a python 3.x version, maybe optimize the Dockerfile a little more.
@poldim thanks! I’ve merged your changes in, Pushed the first version using an automated build to https://hub.docker.com/r/evanrich/py-eagle-mqtt/tags/
Just tested in my K8s install, works great, and metrics are coming in via the pod now instead of standalone python code I was running. Please let me know if anyone has issues using it!
Great post! I recently found out that my utility provider supports the Eagle-200, so I will probably be ordering one soon. I just have few questions for those of you with one:
- How stable is the Eagle-200? I have read a lot of poor reviews from Amazon, but would like to know the opinion of the technical community.
-
What is the update interval of kWh?
-
Has anyone tried this with Hass.io? I am running Hass.io and will need to learn how to install dockerfiles…
Thanks
@adamg I don’t have the 200, just the 100, but it’s pretty stable as long as you don’t spam it with queries. I used to have a script that polled the box for metrics every 10 seconds, it would lock up and require a reboot (power removal/reinsert) every couple hours. I ended up putting it on a remote switch that I could script to turn off and back on every few hours. if you use the webserver, it’s a lot more stable (using the docker/code i posted and letting it export metrics). the 200 has a newer processor so it should perform just as well.
Regarding the interval, it’s about every 8-10 seconds or so, at least with the 100.
ok, Thank you.
From what I have been reading, the Eagle-100 worked quite well and the Eagle-200 has been plagued with problems. I will let others chime in to see what their results were with specifically the Eagle-200 before I purchase one.
Hi - I am using the rest api polling with hassio on my eagle 100. I had the same problems as @evanrich so i’m looking at polling instead. happy to share my configs off-line. Others have done the api thing as well. Tricky party was converting values from hex for me (you will see my trials with that in my history). But, this community rocks and helped me out in no time… Totally doable. I’ve even gotten to having daily rolling energy usage so I can see how much electricity and cost I use each day (because I can).
Hi
I was able to start the container and I added a port mapping based on examining the code. It connected once but won’t reconnect.
I put this in for the cloud provider:
http://192.168.0.156:22042
Is there a path i’m missing? How did you configure the cloud provider URL?
Thanks!
docker run --name py-eagle-mqtt-1 -d \
-e "MQTT_BROKER_IP=192.168.###.###" \
-p 22042:22042 \
-e "MQTT_BROKER_PORT=1883" \
evanrich/py-eagle-mqtt
keep in mind im using it in kubernetes. this is basically fancy docker, but here’s my service.yaml:
apiVersion: v1
kind: Service
metadata:
name: py-eagle-mqtt
labels:
app: py-eagle-mqtt
spec:
selector:
app: py-eagle-mqtt
type: NodePort
ports:
- name: py-eagle
port: 22042
nodePort: 31242
Basically, either of my Kubernetes nodes listens on 31242, and in tern forwards that to port 22042 in the container. This effectively matches what you have. you then set the cloud URL to “http://192.168.x.y:31242”, inserting your docker host’s IP address in place of “192.168.x.y” in my photo, 192.168.1.20 is the IP of one of my kubernetes nodes, which in your case would just be your docker host. BTW, the default is 1883, so you could leave the PORT env variable out. Here’s my K8s deployment file (tested and working so I know its not the container)
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: py-eagle-mqtt
spec:
replicas: 1
template:
metadata:
labels:
app: py-eagle-mqtt
spec:
containers:
- name: py-eagle-mqtt
image: evanrich/py-eagle-mqtt:latest
env:
- name: MQTT_BROKER_IP
value: '192.168.1.20'
- name: MQTT_BROKER_PORT
value: '31333'
ports:
- name: py-eagle
containerPort: 22042
readinessProbe:
tcpSocket:
port: py-eagle
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: py-eagle
initialDelaySeconds: 15
periodSeconds: 20
just uploaded a python3 version, container starts, haven’t fully tested it in my setup though.
Edit: Also just added price information
Thank you. I was able to see the instant demand and the timestamp. I did not see the summation come through. (Maybe I missed it).
I submitted a PR to uncomment and add in Price Cluster so I can pull rate/kwh and tier. I’m guessing this will allow me to see those fields but i’m not sure.
@kozoke . Thanks for the PR. I’ve closed it since I already implemented Pricing info in the python3 branch/tag (just merged into master). you can subscribe to this using power/elec/Home/price
MQTT topic. Here are the sensors I set up for Tier and Price:
- platform: mqtt
name: Current Power Price
icon: mdi:flash
state_topic: "power/elec/Home/price"
value_template: '{{ value_json.price }}'
unit_of_measurement: '$'
force_update: true
- platform: mqtt
name: Current Meter Tier
icon: mdi:flash
state_topic: "power/elec/Home/price"
value_template: '{{ value_json.tier }}'
unit_of_measurement: ''
force_update: true
Thank you. It works! Appreciate it!